Motorcycle, Strings rename

Motorcycle profile  added
Custom profile -> User profile
Base profile -> OsmAnd profile
This commit is contained in:
androiddevkkotlin 2020-12-10 17:16:13 +02:00
parent 1e8983ce58
commit 2179e08e23
11 changed files with 31 additions and 16 deletions

View file

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

View file

@ -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" />
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/profile_type"

View file

@ -17,6 +17,8 @@
• Added OAuth authentication method for OpenStreetMap, improved UI of OSM dialogs\n\n
• Support custom colors for favorites and track waypoints\n\n
</string>
<string name="profile_type_user_string">User profile</string>
<string name="profile_type_osmand_string">OsmAnd profile</string>
<string name="plan_route_add_new_segment">Add a new segment</string>
<string name="plan_route_split_after">Split after</string>
<string name="plan_route_split_before">Split before</string>

View file

@ -740,9 +740,9 @@ public class MapActivityActions implements DialogProvider {
Map<String, RoutingProfileDataObject> 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<String, RoutingProfileDataObject> 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;

View file

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

View file

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

View file

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

View file

@ -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<Float> 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<ProfileIconColors> 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<RouteService> 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<LocationIcon> 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<Integer> APP_MODE_ORDER = new IntPreference(this, "app_mode_order", 0).makeProfile().cache();

View file

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

View file

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

View file

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