Merge pull request #7953 from osmandapp/preference_fixes

Preferences fixes
This commit is contained in:
max-klaus 2019-11-20 12:05:57 +03:00 committed by GitHub
commit f768e73a38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View file

@ -2861,7 +2861,7 @@ public class OsmandSettings {
public static final String QUICK_FAB_MARGIN_X_LANDSCAPE_MARGIN = "quick_fab_margin_x_landscape_margin";
public static final String QUICK_FAB_MARGIN_Y_LANDSCAPE_MARGIN = "quick_fab_margin_y_landscape_margin";
public final CommonPreference<String> QUICK_ACTION = new StringPreference("quick_action_new", "").makeProfile();
public final CommonPreference<String> QUICK_ACTION = new StringPreference("quick_action_new", "").makeGlobal();
public final CommonPreference<String> QUICK_ACTION_LIST = new StringPreference("quick_action_list", "").makeGlobal();

View file

@ -664,9 +664,9 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
});
return true;
} else if (preference == defaultSpeed) {
showSeekbarSettingsDialog(this, false);
showSeekbarSettingsDialog(this, false, settings.getApplicationMode());
} else if (preference == defaultSpeedOnly) {
showSeekbarSettingsDialog(this, true);
showSeekbarSettingsDialog(this, true, settings.getApplicationMode());
}
return false;
}
@ -720,14 +720,13 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
return bld.show();
}
public static void showSeekbarSettingsDialog(Activity activity, final boolean defaultSpeedOnly) {
if (activity == null) {
public static void showSeekbarSettingsDialog(Activity activity, final boolean defaultSpeedOnly, final ApplicationMode mode) {
if (activity == null || mode == null) {
return;
}
final OsmandApplication app = (OsmandApplication) activity.getApplication();
final OsmandSettings settings = app.getSettings();
final ApplicationMode mode = settings.getApplicationMode();
GeneralRouter router = getRouter(app.getRoutingConfig(), mode);
SpeedConstants units = settings.SPEED_SYSTEM.get();
String speedUnits = units.toShortString(activity);

View file

@ -102,7 +102,7 @@ public class VehicleParametersFragment extends BaseSettingsFragment implements O
public boolean onPreferenceClick(Preference preference) {
if (preference.getKey().equals(GeneralRouter.DEFAULT_SPEED)) {
RouteService routeService = getSelectedAppMode().getRouteService();
showSeekbarSettingsDialog(getActivity(), routeService == RouteService.STRAIGHT);
showSeekbarSettingsDialog(getActivity(), routeService == RouteService.STRAIGHT, getSelectedAppMode());
return true;
}
return super.onPreferenceClick(preference);