ApplicationMode - CAR

This commit is contained in:
androiddevkkotlin 2020-12-10 17:48:29 +02:00
parent 2179e08e23
commit da3ebf3bbd
3 changed files with 9 additions and 7 deletions

View file

@ -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;

View file

@ -58,7 +58,7 @@ public class ApplicationMode {
private static StateChangedListener<String> 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;

View file

@ -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<Float> MIN_SPEED = new FloatPreference(this,