diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index f953705bba..ace59e8333 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,6 +11,7 @@ Thx - Hardy --> + Navigation type affects the rules for route calculations. Add new profile \'%1$s\'? Include heading Save heading to each trackpoint while recording. diff --git a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheetDialogFragment.java index 9eba440a90..c5d0609bfd 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/profiles/SelectProfileBottomSheetDialogFragment.java @@ -135,6 +135,7 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo } else if (type.equals(TYPE_NAV_PROFILE)){ items.add(new TitleItem(getString(R.string.select_nav_profile_dialog_title))); + items.add(new LongDescriptionItem(getString(R.string.select_nav_profile_dialog_message))); for (int i = 0; i < profiles.size(); i++) { final int pos = i; final ProfileDataObject profile = profiles.get(i); diff --git a/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java b/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java index 218fe96aa9..abb6aecd49 100644 --- a/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/NavigationFragment.java @@ -1,11 +1,19 @@ package net.osmand.plus.settings; +import android.os.Bundle; import android.support.v7.preference.Preference; import android.support.v7.preference.SwitchPreferenceCompat; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.profiles.EditProfileFragment.RoutingProfilesResources; +import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment; import net.osmand.plus.settings.preferences.SwitchPreferenceEx; +import net.osmand.router.GeneralRouter; + +import static net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.DIALOG_TYPE; +import static net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.SELECTED_KEY; +import static net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment.TYPE_NAV_PROFILE; public class NavigationFragment extends BaseSettingsFragment { @@ -20,7 +28,10 @@ public class NavigationFragment extends BaseSettingsFragment { SwitchPreferenceCompat turnScreenOn = (SwitchPreferenceCompat) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId()); SwitchPreferenceEx animateMyLocation = (SwitchPreferenceEx) findPreference(settings.ANIMATE_MY_LOCATION.getId()); - navigationType.setIcon(getContentIcon(R.drawable.ic_action_car_dark)); + GeneralRouter gr = app.getRoutingConfig().getRouter(getSelectedAppMode().getRoutingProfile()); + RoutingProfilesResources routingProfilesResources = RoutingProfilesResources.valueOf(gr.getProfileName().toUpperCase()); + navigationType.setSummary(routingProfilesResources.getStringRes()); + navigationType.setIcon(getContentIcon(routingProfilesResources.getIconRes())); routeParameters.setIcon(getContentIcon(R.drawable.ic_action_route_distance)); showRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_alert)); speakRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_volume_up)); @@ -42,6 +53,26 @@ public class NavigationFragment extends BaseSettingsFragment { return super.onPreferenceChange(preference, newValue); } + @Override + public boolean onPreferenceClick(Preference preference) { + if (preference.getKey().equals("navigation_type")) { + if (getSelectedAppMode().isCustomProfile()) { + final SelectProfileBottomSheetDialogFragment dialog = new SelectProfileBottomSheetDialogFragment(); + Bundle bundle = new Bundle(); + if (getSelectedAppMode() != null) { + bundle.putString(SELECTED_KEY, getSelectedAppMode().getRoutingProfile()); + } + bundle.putString(DIALOG_TYPE, TYPE_NAV_PROFILE); + dialog.setArguments(bundle); + if (getActivity() != null) { + getActivity().getSupportFragmentManager().beginTransaction() + .add(dialog, "select_nav_type").commitAllowingStateLoss(); + } + } + } + return true; + } + private void setupVehicleParametersPref() { Preference vehicleParameters = findPreference("vehicle_parameters"); int iconRes = getSelectedAppMode().getIconRes();