Merge pull request #8971 from osmandapp/fix_8470

Fix_8470
This commit is contained in:
max-klaus 2020-05-15 11:46:16 +03:00 committed by GitHub
commit 614eee3446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -2022,6 +2022,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> SAVE_GLOBAL_TRACK_TO_GPX = new BooleanPreference("save_global_track_to_gpx", false).makeGlobal().cache();
public final CommonPreference<Integer> SAVE_GLOBAL_TRACK_INTERVAL = new IntPreference("save_global_track_interval", 5000).makeProfile().cache();
public final CommonPreference<Boolean> SAVE_GLOBAL_TRACK_REMEMBER = new BooleanPreference("save_global_track_remember", false).makeProfile().cache();
public final CommonPreference<Boolean> 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<Boolean> SAVE_TRACK_TO_GPX = new BooleanPreference("save_track_to_gpx", false).makeProfile().cache();

View file

@ -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();