Truck profile

This commit is contained in:
androiddevkkotlin 2020-12-09 13:15:04 +02:00
parent 462a6c9f8a
commit 1e8983ce58
4 changed files with 18 additions and 5 deletions

View file

@ -29,6 +29,7 @@ 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),
GEOCODING(R.string.routing_profile_geocoding, R.drawable.ic_action_world_globe);
int stringRes;

View file

@ -1050,6 +1050,7 @@ public class RoutingOptionsHelper {
BOAT(MuteSoundRoutingParameter.KEY),
AIRCRAFT(MuteSoundRoutingParameter.KEY),
SKI(MuteSoundRoutingParameter.KEY, DRIVING_STYLE, GeneralRouter.USE_HEIGHT_OBSTACLES),
TRUCK(MuteSoundRoutingParameter.KEY, AvoidRoadsRoutingParameter.KEY),
OTHER(MuteSoundRoutingParameter.KEY);
List<String> routingParameters;
@ -1078,6 +1079,8 @@ public class RoutingOptionsHelper {
return PermanentAppModeOptions.AIRCRAFT.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.SKI)) {
return PermanentAppModeOptions.SKI.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.TRUCK)) {
return PermanentAppModeOptions.TRUCK.routingParameters;
} else {
return PermanentAppModeOptions.OTHER.routingParameters;
}

View file

@ -108,6 +108,10 @@ 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")
.icon(R.drawable.ic_action_truck_dark)
.description(R.string.app_mode_truck).reg();
public static List<ApplicationMode> values(OsmandApplication app) {
if (customizationListener == null) {
customizationListener = new OsmAndAppCustomization.OsmAndAppCustomizationListener() {
@ -179,13 +183,13 @@ public class ApplicationMode {
}
private static void initRegVisibility() {
// DEFAULT, CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI
ApplicationMode[] exceptDefault = new ApplicationMode[] {CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI};
// DEFAULT, CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI, TRUCK
ApplicationMode[] exceptDefault = new ApplicationMode[] {CAR, BICYCLE, PEDESTRIAN, PUBLIC_TRANSPORT, BOAT, AIRCRAFT, SKI, TRUCK};
ApplicationMode[] all = null;
ApplicationMode[] none = new ApplicationMode[] {};
// left
ApplicationMode[] navigationSet1 = new ApplicationMode[] {CAR, BICYCLE, BOAT, SKI};
ApplicationMode[] navigationSet1 = new ApplicationMode[] {CAR, BICYCLE, BOAT, SKI, TRUCK};
ApplicationMode[] navigationSet2 = new ApplicationMode[] {PEDESTRIAN, PUBLIC_TRANSPORT, AIRCRAFT};
regWidgetVisibility(WIDGET_NEXT_TURN, navigationSet1);
@ -200,8 +204,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);
regWidgetVisibility(WIDGET_MAX_SPEED, CAR);
regWidgetVisibility(WIDGET_SPEED, CAR, BICYCLE, BOAT, SKI, PUBLIC_TRANSPORT, AIRCRAFT, TRUCK);
regWidgetVisibility(WIDGET_MAX_SPEED, CAR, TRUCK);
regWidgetVisibility(WIDGET_ALTITUDE, PEDESTRIAN, BICYCLE);
regWidgetAvailability(WIDGET_INTERMEDIATE_DISTANCE, all);
regWidgetAvailability(WIDGET_DISTANCE, all);

View file

@ -936,6 +936,7 @@ 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);
}
public final OsmandPreference<Float> MIN_SPEED = new FloatPreference(this,
@ -955,6 +956,7 @@ public class OsmandSettings {
ICON_RES_NAME.setModeDefaultValue(ApplicationMode.BOAT, "ic_action_sail_boat_dark");
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");
}
public final CommonPreference<ProfileIconColors> ICON_COLOR = new EnumStringPreference<>(this,
@ -974,6 +976,7 @@ public class OsmandSettings {
ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.BOAT, "boat");
ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.AIRCRAFT, "STRAIGHT_LINE_MODE");
ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.SKI, "ski");
ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.TRUCK, "truck");
}
public final CommonPreference<RouteService> ROUTE_SERVICE = new EnumStringPreference<>(this, "route_service", RouteService.OSMAND, RouteService.values()).makeProfile().cache();
@ -992,6 +995,7 @@ public class OsmandSettings {
NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.BOAT, NavigationIcon.NAUTICAL);
NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.AIRCRAFT, NavigationIcon.DEFAULT);
NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.SKI, NavigationIcon.DEFAULT);
NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.TRUCK,NavigationIcon.DEFAULT);
}
public final CommonPreference<LocationIcon> LOCATION_ICON = new EnumStringPreference<>(this, "location_icon", LocationIcon.DEFAULT, LocationIcon.values()).makeProfile().cache();
@ -1003,6 +1007,7 @@ public class OsmandSettings {
LOCATION_ICON.setModeDefaultValue(ApplicationMode.BOAT, LocationIcon.DEFAULT);
LOCATION_ICON.setModeDefaultValue(ApplicationMode.AIRCRAFT, LocationIcon.CAR);
LOCATION_ICON.setModeDefaultValue(ApplicationMode.SKI, LocationIcon.BICYCLE);
LOCATION_ICON.setModeDefaultValue(ApplicationMode.TRUCK, LocationIcon.CAR);
}
public final CommonPreference<Integer> APP_MODE_ORDER = new IntPreference(this, "app_mode_order", 0).makeProfile().cache();