diff --git a/OsmAnd/res/layout/elevation_preference.xml b/OsmAnd/res/layout/bottom_sheet_item_with_switch_and_dialog.xml similarity index 91% rename from OsmAnd/res/layout/elevation_preference.xml rename to OsmAnd/res/layout/bottom_sheet_item_with_switch_and_dialog.xml index 55037474bf..8892180fd9 100644 --- a/OsmAnd/res/layout/elevation_preference.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_with_switch_and_dialog.xml @@ -1,6 +1,5 @@ - - routingParameterMap = app.getRouter(appMode).getParameters(); RoutingParameter parameter = routingParameterMap.get(USE_HEIGHT_OBSTACLES); @@ -91,6 +90,11 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment { } } + @Override + protected int getDismissButtonTextId() { + return R.string.shared_string_close; + } + @Override public void createMenuItems(Bundle savedInstanceState) { Context themedCtx = UiUtilities.getThemedContext(requireContext(), nightMode); @@ -178,7 +182,7 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment { ((BaseSettingsFragment) target).updateSetting(useHeightPref.getId()); } updateReliefButtons(); - new Handler().postDelayed(new Runnable() { + app.runInUIThread(new Runnable() { @Override public void run() { dismiss(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java index 55f16da7c4..ea51ebd0db 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/RouteParametersFragment.java @@ -290,19 +290,7 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId())); screen.addPreference(switchPreferenceEx); - if (USE_HEIGHT_OBSTACLES.equals(p.getId()) && !Algorithms.isEmpty(reliefFactorParameters)) { - String summaryOn = getString(R.string.shared_string_enabled); - for (RoutingParameter parameter : reliefFactorParameters) { - if (isRoutingParameterSelected(settings, am, parameter)) { - summaryOn = getString(R.string.ltr_or_rtl_combine_via_comma, summaryOn, getRoutingParameterTitle(app, parameter)); - } - } - switchPreferenceEx.setSummaryOn(summaryOn); - switchPreferenceEx.setSummaryOff(R.string.shared_string_disabled); - } else { - switchPreferenceEx.setSummaryOn(R.string.shared_string_on); - switchPreferenceEx.setSummaryOff(R.string.shared_string_off); - } + setupOtherBooleanParameterSummary(app, am, p, switchPreferenceEx); } else { Object[] vls = p.getPossibleValues(); String[] svlss = new String[vls.length]; @@ -352,6 +340,22 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP setupFastRecalculationPref(); } + private void setupOtherBooleanParameterSummary(OsmandApplication app, ApplicationMode am, RoutingParameter p, SwitchPreferenceEx switchPreferenceEx) { + if (USE_HEIGHT_OBSTACLES.equals(p.getId()) && !Algorithms.isEmpty(reliefFactorParameters)) { + String summaryOn = getString(R.string.shared_string_enabled); + for (RoutingParameter parameter : reliefFactorParameters) { + if (isRoutingParameterSelected(settings, am, parameter)) { + summaryOn = getString(R.string.ltr_or_rtl_combine_via_comma, summaryOn, getRoutingParameterTitle(app, parameter)); + } + } + switchPreferenceEx.setSummaryOn(summaryOn); + switchPreferenceEx.setSummaryOff(R.string.shared_string_disabled); + } else { + switchPreferenceEx.setSummaryOn(R.string.shared_string_on); + switchPreferenceEx.setSummaryOff(R.string.shared_string_off); + } + } + private void addDivider(PreferenceScreen screen) { Preference divider = new Preference(requireContext()); divider.setLayoutResource(R.layout.simple_divider_item);