From da3ebf3bbd1ce73b3316974633f3022b201bdb31 Mon Sep 17 00:00:00 2001 From: androiddevkkotlin Date: Thu, 10 Dec 2020 17:48:29 +0200 Subject: [PATCH] ApplicationMode - CAR --- .../plus/profiles/RoutingProfileDataObject.java | 2 -- .../plus/settings/backend/ApplicationMode.java | 12 +++++++++--- .../osmand/plus/settings/backend/OsmandSettings.java | 2 -- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java index 5810d6f87d..3cd3c74293 100644 --- a/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java +++ b/OsmAnd/src/net/osmand/plus/profiles/RoutingProfileDataObject.java @@ -29,8 +29,6 @@ public class RoutingProfileDataObject extends ProfileDataObject { SKI(R.string.routing_profile_ski, R.drawable.ic_action_skiing), 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/settings/backend/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java index 40b0c53016..10d45dfe60 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/ApplicationMode.java @@ -58,7 +58,7 @@ public class ApplicationMode { private static StateChangedListener iconNameListener; private static OsmAndAppCustomization.OsmAndAppCustomizationListener customizationListener; - private OsmandApplication app; + private static OsmandApplication app; private final int keyName; private final String stringKey; @@ -108,11 +108,11 @@ 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, "truck") + public static final ApplicationMode TRUCK = createCustomBase(ApplicationMode.CAR, R.string.app_mode_truck, "truck", app) .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") + public static final ApplicationMode MOTORCYCLE = createCustomBase(ApplicationMode.CAR, R.string.app_mode_motorcycle, "truck", app) .icon(R.drawable.ic_action_motorcycle_dark) .description(R.string.app_mode_motorcycle).reg(); @@ -678,6 +678,12 @@ public class ApplicationMode { return builder; } + public static ApplicationModeBuilder createCustomBase(ApplicationMode parent, int key, String stringKey, OsmandApplication app) { + ApplicationModeBuilder builder = create(parent, key, stringKey); + builder.getApplicationMode().app = app; + return builder; + } + public static class ApplicationModeBuilder { private ApplicationMode applicationMode; diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 602dd7ef3e..2893a2dae0 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -936,8 +936,6 @@ 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, 12.5f); - DEFAULT_SPEED.setModeDefaultValue(ApplicationMode.MOTORCYCLE, 12.5f); } public final OsmandPreference MIN_SPEED = new FloatPreference(this,