Base undeleted profile

This commit is contained in:
androiddevkkotlin 2020-12-13 23:40:47 +02:00
parent 42f86ba5b9
commit b3c92ada33
3 changed files with 4 additions and 22 deletions

View file

@ -1050,8 +1050,6 @@ public class RoutingOptionsHelper {
BOAT(MuteSoundRoutingParameter.KEY),
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<String> routingParameters;
@ -1080,10 +1078,6 @@ 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 if (appMode.isDerivedRoutingFrom(ApplicationMode.MOTORCYCLE)) {
return PermanentAppModeOptions.MOTORCYCLE.routingParameters;
} else {
return PermanentAppModeOptions.OTHER.routingParameters;
}

View file

@ -58,7 +58,7 @@ public class ApplicationMode {
private static StateChangedListener<String> iconNameListener;
private static OsmAndAppCustomization.OsmAndAppCustomizationListener customizationListener;
private static OsmandApplication app;
private 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 = createCustomBase(ApplicationMode.CAR, R.string.app_mode_truck, "truck", app)
public static final ApplicationMode TRUCK = create(ApplicationMode.CAR, 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 = createCustomBase(ApplicationMode.CAR, R.string.app_mode_motorcycle, "motorcycle", app)
public static final ApplicationMode MOTORCYCLE = create(ApplicationMode.CAR, R.string.app_mode_motorcycle, "motorcycle")
.icon(R.drawable.ic_action_motorcycle_dark)
.description(R.string.app_mode_motorcycle).reg();
@ -301,7 +301,7 @@ public class ApplicationMode {
}
public boolean isCustomProfile() {
return parentAppMode != null;
return !defaultValues.contains(this);
}
public boolean isDerivedRoutingFrom(ApplicationMode mode) {
@ -678,12 +678,6 @@ 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

@ -976,8 +976,6 @@ 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");
ROUTING_PROFILE.setModeDefaultValue(ApplicationMode.MOTORCYCLE, "motorcycle");
}
public final CommonPreference<RouteService> ROUTE_SERVICE = new EnumStringPreference<>(this, "route_service", RouteService.OSMAND, RouteService.values()).makeProfile().cache();
@ -996,8 +994,6 @@ 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);
NAVIGATION_ICON.setModeDefaultValue(ApplicationMode.MOTORCYCLE,NavigationIcon.DEFAULT);
}
public final CommonPreference<LocationIcon> LOCATION_ICON = new EnumStringPreference<>(this, "location_icon", LocationIcon.DEFAULT, LocationIcon.values()).makeProfile().cache();
@ -1009,8 +1005,6 @@ 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);
LOCATION_ICON.setModeDefaultValue(ApplicationMode.MOTORCYCLE, LocationIcon.CAR);
}
public final CommonPreference<Integer> APP_MODE_ORDER = new IntPreference(this, "app_mode_order", 0).makeProfile().cache();