From 2179e08e23fb0d549658f192e4063ada048a7656 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Thu, 10 Dec 2020 17:16:13 +0200 Subject: [PATCH] Motorcycle, Strings rename Motorcycle profile added Custom profile -> User profile Base profile -> OsmAnd profile --- OsmAnd/res/layout/preference_dropdown_list.xml | 2 +- .../res/layout/profile_preference_toolbar_big.xml | 2 +- OsmAnd/res/values/strings.xml | 2 ++ .../osmand/plus/activities/MapActivityActions.java | 8 ++++---- .../plus/profiles/RoutingProfileDataObject.java | 1 + .../routepreparationmenu/RoutingOptionsHelper.java | 3 +++ .../plus/settings/backend/ApplicationMode.java | 14 +++++++++----- .../plus/settings/backend/OsmandSettings.java | 7 ++++++- .../settings/fragments/BaseSettingsFragment.java | 4 ++-- .../settings/fragments/ExportItemsBottomSheet.java | 2 +- .../fragments/ProfileAppearanceFragment.java | 2 +- 11 files changed, 31 insertions(+), 16 deletions(-) diff --git a/OsmAnd/res/layout/preference_dropdown_list.xml b/OsmAnd/res/layout/preference_dropdown_list.xml index 6f247664fa..80e62be873 100644 --- a/OsmAnd/res/layout/preference_dropdown_list.xml +++ b/OsmAnd/res/layout/preference_dropdown_list.xml @@ -33,7 +33,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:minHeight="60dp" - app:labelText="@string/profile_type_base_string" + app:labelText="@string/profile_type_osmand_string" app:primaryColor="@color/active_color_primary_dark" app:secondaryColor="?android:textColorSecondary"> diff --git a/OsmAnd/res/layout/profile_preference_toolbar_big.xml b/OsmAnd/res/layout/profile_preference_toolbar_big.xml index 6ee4c0d2a0..dd348c785b 100644 --- a/OsmAnd/res/layout/profile_preference_toolbar_big.xml +++ b/OsmAnd/res/layout/profile_preference_toolbar_big.xml @@ -99,7 +99,7 @@ android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size" osmand:typeface="@string/font_roboto_regular" - tools:text="@string/profile_type_base_string" /> + tools:text="@string/profile_type_osmand_string" /> + User profile + OsmAnd profile Add a new segment Split after Split before diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 0213268a05..b62ee46e20 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -740,9 +740,9 @@ public class MapActivityActions implements DialogProvider { Map profilesObjects = getRoutingProfiles(app); for (final ApplicationMode appMode : activeModes) { if (appMode.isCustomProfile()) { - modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_custom_string)); + modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_user_string)); } else { - modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_base_string)); + modeDescription = getProfileDescription(app, appMode, profilesObjects, getString(R.string.profile_type_osmand_string)); } int tag = currentMode.equals(appMode) ? PROFILES_CHOSEN_PROFILE_TAG : PROFILES_NORMAL_PROFILE_TAG; @@ -1048,9 +1048,9 @@ public class MapActivityActions implements DialogProvider { String modeDescription; Map profilesObjects = getRoutingProfiles(app); if (currentMode.isCustomProfile()) { - modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_custom_string)); + modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_user_string)); } else { - modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_base_string)); + modeDescription = getProfileDescription(app, currentMode, profilesObjects, getString(R.string.profile_type_osmand_string)); } int icArrowResId = listExpanded ? R.drawable.ic_action_arrow_drop_up : R.drawable.ic_action_arrow_drop_down; diff --git a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java index da6e370fde..5810d6f87d 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java +++ b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java @@ -30,6 +30,7 @@ public class RoutingProfileDataObject extends ProfileDataObject { PUBLIC_TRANSPORT(R.string.app_mode_public_transport, R.drawable.ic_action_bus_dark), BOAT(R.string.app_mode_boat, R.drawable.ic_action_sail_boat_dark), TRUCK(R.string.app_mode_truck, R.drawable.ic_action_truck_dark), + MOTORCYCLE(R.string.app_mode_motorcycle, R.drawable.ic_action_motorcycle_dark), GEOCODING(R.string.routing_profile_geocoding, R.drawable.ic_action_world_globe); int stringRes; diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index de3924fe0f..31487d2ba7 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -1051,6 +1051,7 @@ public class RoutingOptionsHelper { AIRCRAFT(MuteSoundRoutingParameter.KEY), SKI(MuteSoundRoutingParameter.KEY, DRIVING_STYLE, GeneralRouter.USE_HEIGHT_OBSTACLES), TRUCK(MuteSoundRoutingParameter.KEY, AvoidRoadsRoutingParameter.KEY), + MOTORCYCLE(MuteSoundRoutingParameter.KEY, AvoidRoadsRoutingParameter.KEY), OTHER(MuteSoundRoutingParameter.KEY); List routingParameters; @@ -1081,6 +1082,8 @@ public class RoutingOptionsHelper { return PermanentAppModeOptions.SKI.routingParameters; } else if (appMode.isDerivedRoutingFrom(ApplicationMode.TRUCK)) { return PermanentAppModeOptions.TRUCK.routingParameters; + } else if (appMode.isDerivedRoutingFrom(ApplicationMode.MOTORCYCLE)) { + return PermanentAppModeOptions.MOTORCYCLE.routingParameters; } else { return PermanentAppModeOptions.OTHER.routingParameters; } diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java index b1b98e17f2..40b0c53016 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java @@ -108,10 +108,14 @@ public class ApplicationMode { .icon(R.drawable.ic_action_skiing) .description(R.string.base_profile_descr_ski).reg(); - public static final ApplicationMode TRUCK = createBase(R.string.app_mode_truck, "ic_action_truck_dark") + public static final ApplicationMode TRUCK = createBase(R.string.app_mode_truck, "truck") .icon(R.drawable.ic_action_truck_dark) .description(R.string.app_mode_truck).reg(); + public static final ApplicationMode MOTORCYCLE = createBase(R.string.app_mode_truck, "motorcycle") + .icon(R.drawable.ic_action_motorcycle_dark) + .description(R.string.app_mode_motorcycle).reg(); + public static List values(OsmandApplication app) { if (customizationListener == null) { customizationListener = new OsmAndAppCustomization.OsmAndAppCustomizationListener() { @@ -184,12 +188,12 @@ public class ApplicationMode { private static void initRegVisibility() { // DEFAULT, CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI, TRUCK - ApplicationMode[] exceptDefault = new ApplicationMode[] {CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI, TRUCK}; + ApplicationMode[] exceptDefault = new ApplicationMode[] {CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI, TRUCK, MOTORCYCLE}; ApplicationMode[] all = null; ApplicationMode[] none = new ApplicationMode[] {}; // left - ApplicationMode[] navigationSet1 = new ApplicationMode[] {CAR, BICYCLE, BOAT, SKI, TRUCK}; + ApplicationMode[] navigationSet1 = new ApplicationMode[] {CAR, BICYCLE, BOAT, SKI, TRUCK, MOTORCYCLE}; ApplicationMode[] navigationSet2 = new ApplicationMode[] {PEDESTRIAN, PUBLIC_TRANSPORT, AIRCRAFT}; regWidgetVisibility(WIDGET_NEXT_TURN, navigationSet1); @@ -204,8 +208,8 @@ public class ApplicationMode { regWidgetVisibility(WIDGET_DISTANCE, all); regWidgetVisibility(WIDGET_TIME, all); regWidgetVisibility(WIDGET_INTERMEDIATE_TIME, all); - regWidgetVisibility(WIDGET_SPEED, CAR, BICYCLE, BOAT, SKI, PUBLIC_TRANSPORT, AIRCRAFT, TRUCK); - regWidgetVisibility(WIDGET_MAX_SPEED, CAR, TRUCK); + regWidgetVisibility(WIDGET_SPEED, CAR, BICYCLE, BOAT, SKI, PUBLIC_TRANSPORT, AIRCRAFT, TRUCK, MOTORCYCLE); + regWidgetVisibility(WIDGET_MAX_SPEED, CAR, TRUCK, MOTORCYCLE); regWidgetVisibility(WIDGET_ALTITUDE, PEDESTRIAN, BICYCLE); regWidgetAvailability(WIDGET_INTERMEDIATE_DISTANCE, all); regWidgetAvailability(WIDGET_DISTANCE, all); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index f5283854b6..602dd7ef3e 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -936,7 +936,8 @@ public class OsmandSettings { DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.BOAT, 1.38f); DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.AIRCRAFT, 40f); DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.SKI, 1.38f); - DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.TRUCK, 10.5f); + DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.TRUCK, 12.5f); + DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.MOTORCYCLE, 12.5f); } public final OsmandPreference MIN_SPEED = new FloatPreference(this, @@ -957,6 +958,7 @@ public class OsmandSettings { ICON_RES_NAME.setModeDefaultValue(ApplicationMode.AIRCRAFT, "ic_action_aircraft"); ICON_RES_NAME.setModeDefaultValue(ApplicationMode.SKI, "ic_action_skiing"); ICON_RES_NAME.setModeDefaultValue(ApplicationMode.TRUCK, "ic_action_truck_dark"); + ICON_RES_NAME.setModeDefaultValue(ApplicationMode.MOTORCYCLE, "ic_action_motorcycle_dark"); } public final CommonPreference ICON_COLOR = new EnumStringPreference<>(this, @@ -977,6 +979,7 @@ public class OsmandSettings { ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.AIRCRAFT, "STRAIGHT_LINE_MODE"); ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.SKI, "ski"); ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.TRUCK, "truck"); + ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.MOTORCYCLE, "motorcycle"); } public final CommonPreference ROUTE_SERVICE = new EnumStringPreference<>(this, "route_service", RouteService.OSMAND, RouteService.values()).makeProfile().cache(); @@ -996,6 +999,7 @@ public class OsmandSettings { NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.AIRCRAFT, NavigationIcon.DEFAULT); NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.SKI, NavigationIcon.DEFAULT); NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.TRUCK,NavigationIcon.DEFAULT); + NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.MOTORCYCLE,NavigationIcon.DEFAULT); } public final CommonPreference LOCATION_ICON = new EnumStringPreference<>(this, "location_icon", LocationIcon.DEFAULT, LocationIcon.values()).makeProfile().cache(); @@ -1008,6 +1012,7 @@ public class OsmandSettings { LOCATION_ICON.setModeDefaultValue(ApplicationMode.AIRCRAFT, LocationIcon.CAR); LOCATION_ICON.setModeDefaultValue(ApplicationMode.SKI, LocationIcon.BICYCLE); LOCATION_ICON.setModeDefaultValue(ApplicationMode.TRUCK, LocationIcon.CAR); + LOCATION_ICON.setModeDefaultValue(ApplicationMode.MOTORCYCLE, LocationIcon.CAR); } public final CommonPreference APP_MODE_ORDER = new IntPreference(this, "app_mode_order", 0).makeProfile().cache(); diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java index 3763987e38..daed043002 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/BaseSettingsFragment.java @@ -886,9 +886,9 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl public static String getAppModeDescription(Context ctx, ApplicationMode mode) { String description; if (mode.isCustomProfile()) { - description = ctx.getString(R.string.profile_type_custom_string); + description = ctx.getString(R.string.profile_type_user_string); } else { - description = ctx.getString(R.string.profile_type_base_string); + description = ctx.getString(R.string.profile_type_osmand_string); } return description; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java index f7d8c6ad6f..7bea6bf5f4 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ExportItemsBottomSheet.java @@ -296,7 +296,7 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment { if (!Algorithms.isEmpty(routingProfile)) { builder.setDescription(getString(R.string.ltr_or_rtl_combine_via_colon, getString(R.string.nav_type_hint), routingProfile)); } else { - builder.setDescription(getString(R.string.profile_type_base_string)); + builder.setDescription(getString(R.string.profile_type_osmand_string)); } int profileIconRes = AndroidUtils.getDrawableId(app, modeBean.iconName); ProfileIconColors iconColor = modeBean.iconColor; diff --git a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java index 0374a4a42f..2a15433f26 100644 --- a/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/fragments/ProfileAppearanceFragment.java @@ -393,7 +393,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { ? changedProfile.parent.toHumanString() : getSelectedAppMode().toHumanString()); OsmandTextFieldBoxes baseProfileNameHint = (OsmandTextFieldBoxes) holder.findViewById(R.id.master_profile_otfb); - baseProfileNameHint.setLabelText(getString(R.string.profile_type_base_string)); + baseProfileNameHint.setLabelText(getString(R.string.profile_type_osmand_string)); FrameLayout selectNavTypeBtn = (FrameLayout) holder.findViewById(R.id.select_nav_type_btn); selectNavTypeBtn.setOnClickListener(new View.OnClickListener() { @Override