Skip to content

Commit

Permalink
Check if state is restored when adding new point to the track
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxvd committed Sep 4, 2024
1 parent b4b5af6 commit 15e711c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public static Intent newIntent(Context context) {
private MonitoringViewModel viewModel;
private List<MonitoringEntry> monitoringEntries = new ArrayList<>();

private boolean stateRestored = false;

private final ActivityResultLauncher<Intent> editCurrentCommonFormActivityLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
onFinishConfirm(result.getResultCode(), result.getData());
});
Expand Down Expand Up @@ -696,6 +698,10 @@ public void onEvent(LocationChangedEvent event) {
}

private void addPoint(LatLng point) {
if (!stateRestored) {
return;
}

points.add(point);
if (currentMap != null) {
currentMap.updatePath(points);
Expand Down Expand Up @@ -902,6 +908,7 @@ private void restoreState() {
restorePoints();

updateTypeOfObservationMenus(menu);
this.stateRestored = true;
}

private void restorePoints() {
Expand Down

0 comments on commit 15e711c

Please sign in to comment.