add save for USE_OSMAND_KEYBOARD

This commit is contained in:
Chumva 2018-03-29 18:00:26 +03:00
parent 7966df89dd
commit 81eda40f4f
3 changed files with 6 additions and 9 deletions

View file

@ -721,6 +721,7 @@ public class OsmandSettings {
public final CommonPreference<Boolean> COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference("coords_input_use_right_side", true).makeGlobal(); public final CommonPreference<Boolean> COORDS_INPUT_USE_RIGHT_SIDE = new BooleanPreference("coords_input_use_right_side", true).makeGlobal();
public final CommonPreference<Integer> COORDS_INPUT_FORMAT = new IntPreference("coords_input_format", CoordinateInputFormats.DD_MM_MMM); public final CommonPreference<Integer> COORDS_INPUT_FORMAT = new IntPreference("coords_input_format", CoordinateInputFormats.DD_MM_MMM);
public final OsmandPreference<Boolean> COORDS_USE_OSMAND_KEYBOARD = new BooleanPreference("coords_use_osmand_keyboard", true).makeGlobal();
public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal(); public final CommonPreference<Boolean> USE_MAPILLARY_FILTER = new BooleanPreference("use_mapillary_filters", false).makeGlobal();
public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal(); public final CommonPreference<String> MAPILLARY_FILTER_USER_KEY = new StringPreference("mapillary_filter_user_key", "").makeGlobal();

View file

@ -37,14 +37,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (savedInstanceState == null) { useOsmandKeyboard = getMyApplication().getSettings().COORDS_USE_OSMAND_KEYBOARD.get();
Bundle args = getArguments();
if (args != null) {
useOsmandKeyboard = args.getBoolean(USE_OSMAND_KEYBOARD);
}
} else {
useOsmandKeyboard = savedInstanceState.getBoolean(USE_OSMAND_KEYBOARD);
}
} }
@Override @Override
@ -65,6 +58,7 @@ public class CoordinateInputBottomSheetDialogFragment extends MenuBottomSheetDia
if (listener != null) { if (listener != null) {
listener.onKeyboardChanged(!useOsmandKeyboard); listener.onKeyboardChanged(!useOsmandKeyboard);
} }
settings.COORDS_USE_OSMAND_KEYBOARD.set(!useOsmandKeyboard);
dismiss(); dismiss();
} }
}) })

View file

@ -182,7 +182,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
}); });
registerMainView(); registerMainView();
// changeKeyboard(getMyApplication().getSettings().COORDS_USE_OSMAND_KEYBOARD.get());
return mainView; return mainView;
} }
@ -351,6 +351,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
boolean isCurrentlyVisible = isOsmandKeyboardCurrentlyVisible(); boolean isCurrentlyVisible = isOsmandKeyboardCurrentlyVisible();
if (!isCurrentlyVisible && !useOsmandKeyboard) { if (!isCurrentlyVisible && !useOsmandKeyboard) {
changeKeyboard(true); changeKeyboard(true);
getMyApplication().getSettings().COORDS_USE_OSMAND_KEYBOARD.set(true);
} else { } else {
changeOsmandKeyboardVisibility(!isCurrentlyVisible); changeOsmandKeyboardVisibility(!isCurrentlyVisible);
} }
@ -454,6 +455,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
super.onResume(); super.onResume();
adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity())); adapter.setScreenOrientation(DashLocationFragment.getScreenOrientation(getActivity()));
startLocationUpdate(); startLocationUpdate();
changeKeyboard(getMyApplication().getSettings().COORDS_USE_OSMAND_KEYBOARD.get());
} }
@Override @Override