From c93193c128b2de591364d7fe974ee1c204d7752b Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Fri, 15 May 2020 11:42:52 +0300 Subject: [PATCH] Fix #8470 --- OsmAnd/src/net/osmand/plus/OsmandSettings.java | 1 + .../osmand/plus/monitoring/OnSaveCurrentTrackFragment.java | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index b70668e34d..93094f835e 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -2022,6 +2022,7 @@ public class OsmandSettings { public final CommonPreference SAVE_GLOBAL_TRACK_TO_GPX = new BooleanPreference("save_global_track_to_gpx", false).makeGlobal().cache(); public final CommonPreference SAVE_GLOBAL_TRACK_INTERVAL = new IntPreference("save_global_track_interval", 5000).makeProfile().cache(); public final CommonPreference SAVE_GLOBAL_TRACK_REMEMBER = new BooleanPreference("save_global_track_remember", false).makeProfile().cache(); + public final CommonPreference SHOW_SAVED_TRACK_REMEMBER = new BooleanPreference("show_saved_track_remember", true).makeGlobal(); // this value string is synchronized with settings_pref.xml preference name public final CommonPreference SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false).makeProfile().cache(); diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java index 8fcef48379..d31107135d 100644 --- a/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/monitoring/OnSaveCurrentTrackFragment.java @@ -50,7 +50,6 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment { public static final String TAG = "OnSaveCurrentTrackBottomSheetFragment"; public static final String SAVED_TRACKS_KEY = "saved_track_filename"; - private boolean showOnMap = true; private boolean openTrack = false; private File file; private String savedGpxDir = ""; @@ -121,10 +120,11 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment { }); SwitchCompat showOnMapButton = (SwitchCompat) mainView.findViewById(R.id.btn_show_on_map); + showOnMapButton.setChecked(app.getSettings().SHOW_SAVED_TRACK_REMEMBER.get()); showOnMapButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - showOnMap = isChecked; + app.getSettings().SHOW_SAVED_TRACK_REMEMBER.set(isChecked); } }); View openTrackBtn = mainView.findViewById(R.id.open_track_button); @@ -160,7 +160,8 @@ public class OnSaveCurrentTrackFragment extends BottomSheetDialogFragment { public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog); if (file != null) { - if (showOnMap) { + OsmandApplication app = getMyApplication(); + if (app != null && app.getSettings().SHOW_SAVED_TRACK_REMEMBER.get()) { showOnMap(file, !openTrack); } FragmentActivity activity = getActivity();