Bottom sheet: Navigation settings > Route parameters
Taping on items with radio button, should apply changes and close the bottom sheet. Main switch: Change text "Enable/Disable" > "Enabled/Disabled". If nav. type "On-foot", bottom sheet: Main switch: Change text "Enable/Disable" > "Enabled/Disabled". Button: "Cancel" > "Close". (check in both "Pedestrian" and "Cycling" profiles.
This commit is contained in:
parent
59132ccf6d
commit
81c32ad4ce
3 changed files with 31 additions and 7 deletions
|
@ -119,7 +119,7 @@ public class BooleanPreferenceBottomSheet extends BasePreferenceBottomSheet {
|
|||
|
||||
@Override
|
||||
protected int getDismissButtonTextId() {
|
||||
return R.string.shared_string_cancel;
|
||||
return R.string.shared_string_close;
|
||||
}
|
||||
|
||||
protected static View getCustomButtonView(OsmandApplication app, ApplicationMode mode, boolean checked, boolean nightMode) {
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.settings.bottomsheets;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -73,6 +74,7 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
appMode = ApplicationMode.valueOfStringKey(savedInstanceState.getString(APP_MODE_KEY), null);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
setDismissButtonTextId(R.string.shared_string_close);
|
||||
|
||||
Map<String, RoutingParameter> routingParameterMap = app.getRouter(appMode).getParameters();
|
||||
RoutingParameter parameter = routingParameterMap.get(USE_HEIGHT_OBSTACLES);
|
||||
|
@ -93,8 +95,8 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
Context themedCtx = UiUtilities.getThemedContext(requireContext(), nightMode);
|
||||
|
||||
on = getString(R.string.shared_string_enable);
|
||||
off = getString(R.string.shared_string_disable);
|
||||
on = getString(R.string.shared_string_enabled);
|
||||
off = getString(R.string.shared_string_disabled);
|
||||
appModeColor = appMode.getIconColorInfo().getColor(nightMode);
|
||||
activeColor = AndroidUtils.resolveAttribute(themedCtx, R.attr.active_color_basic);
|
||||
disabledColor = AndroidUtils.resolveAttribute(themedCtx, android.R.attr.textColorSecondary);
|
||||
|
@ -171,7 +173,17 @@ public class ElevationDateBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
RoutingParameter parameter = parameters.get(selectedEntryIndex);
|
||||
updateSelectedParameters(app, appMode, parameters, parameter.getId());
|
||||
}
|
||||
Fragment target = getTargetFragment();
|
||||
if (target instanceof BaseSettingsFragment) {
|
||||
((BaseSettingsFragment) target).updateSetting(useHeightPref.getId());
|
||||
}
|
||||
updateReliefButtons();
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
dismiss();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}).create();
|
||||
items.add(preferenceItem[0]);
|
||||
|
|
|
@ -285,12 +285,24 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
if (p.getType() == RoutingParameterType.BOOLEAN) {
|
||||
OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
||||
|
||||
SwitchPreferenceEx switchPreferenceEx = (SwitchPreferenceEx) createSwitchPreferenceEx(pref.getId(), title, description, R.layout.preference_with_descr_dialog_and_switch);
|
||||
SwitchPreferenceEx switchPreferenceEx = createSwitchPreferenceEx(pref.getId(), title, description, R.layout.preference_with_descr_dialog_and_switch);
|
||||
switchPreferenceEx.setDescription(description);
|
||||
switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
|
||||
switchPreferenceEx.setSummaryOn(R.string.shared_string_on);
|
||||
switchPreferenceEx.setSummaryOff(R.string.shared_string_off);
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
Object[] vls = p.getPossibleValues();
|
||||
String[] svlss = new String[vls.length];
|
||||
|
@ -403,7 +415,7 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
|||
return;
|
||||
}
|
||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
final float[] angleValue = new float[] {mode.getStrAngle()};
|
||||
final float[] angleValue = new float[]{mode.getStrAngle()};
|
||||
boolean nightMode = !app.getSettings().isLightContentForMode(mode);
|
||||
Context themedContext = UiUtilities.getThemedContext(activity, nightMode);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(themedContext);
|
||||
|
|
Loading…
Reference in a new issue