diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/RouteActivityType.java b/OsmAnd-java/src/main/java/net/osmand/osm/RouteActivityType.java
index e7a7a0600a..6f8a0b0e9a 100644
--- a/OsmAnd-java/src/main/java/net/osmand/osm/RouteActivityType.java
+++ b/OsmAnd-java/src/main/java/net/osmand/osm/RouteActivityType.java
@@ -1,31 +1,29 @@
package net.osmand.osm;
public enum RouteActivityType {
- WATER("Water", "yellow", "mx_special_kayak", "activity_type_water"),
- WINTER("Winter", "yellow", "mx_special_skiing", "activity_type_winter"),
- SNOWMOBILE("Snowmobile", "yellow", "mx_special_snowmobile", "activity_type_snowmobile"),
- RIDING("Riding", "yellow", "mx_special_horse", "activity_type_riding"),
- RACING("Racing", "yellow", "mx_raceway", "activity_type_racing"),
- MOUNTAINBIKE("Mountainbike", "blue", "mx_sport_cycling", "activity_type_mountainbike"),
- CYCLING("Cycling", "blue", "mx_special_bicycle", "activity_type_cycling"),
- HIKING("Hiking", "orange", "mx_special_trekking", "activity_type_hiking"),
- RUNNING("Running", "orange", "mx_running", "activity_type_running"),
- WALKING("Walking", "orange", " mx_special_walking", "activity_type_walking"),
- OFFROAD("Off-road", "yellow", "mx_special_offroad", "activity_type_offroad"),
- MOTORBIKE("Motorbike", "green", "mx_special_motorcycle", "activity_type_motorbike"),
- CAR("Car", "green", "mx_shop_car", "activity_type_car");
+ WATER("water", "yellow", "special_kayak"),
+ WINTER("winter", "yellow", "special_skiing"),
+ SNOWMOBILE("snowmobile", "yellow", "special_snowmobile"),
+ RIDING("riding", "yellow", "special_horse"),
+ RACING("racing", "yellow", "raceway"),
+ MOUNTAINBIKE("mountainbike", "blue", "sport_cycling"),
+ CYCLING("cycling", "blue", "special_bicycle"),
+ HIKING("hiking", "orange", "special_trekking"),
+ RUNNING("running", "orange", "running"),
+ WALKING("walking", "orange", "special_walking"),
+ OFFROAD("offroad", "yellow", "special_offroad"),
+ MOTORBIKE("motorbike", "green", "special_motorcycle"),
+ CAR("car", "green", "shop_car");
// less specific bottom order
String name;
String color;
String icon;
- String title;
- RouteActivityType(String nm, String clr, String icon, String title) {
+ RouteActivityType(String nm, String clr, String icon) {
this.name = nm;
this.color = clr;
this.icon = icon;
- this.title = title;
}
public String getName() {
@@ -40,10 +38,6 @@ public enum RouteActivityType {
return icon;
}
- public String getTitle() {
- return title;
- }
-
public static RouteActivityType getTypeFromName(String name) {
for (RouteActivityType rat : values()) {
if (rat.name().equalsIgnoreCase(name)) {
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index 0c2feea060..8b1a73aa95 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -12,19 +12,19 @@
-->
- Car
- Motorbike
- Off-road
- Walking
- Running
- Hiking
- Cycling
- Mountainbike
- Racing
- Riding
- Snowmobile
- Winter
- Water
+ Car
+ Motorbike
+ Off-road
+ Walking
+ Running
+ Hiking
+ Cycling
+ Mountainbike
+ Racing
+ Riding
+ Snowmobile
+ Winter
+ Water
Login to OpenPlaceReviews
Use test.openplacereviews.org
OpenPlaceReviews
diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java
index 545e7b7391..ce7547a2c4 100644
--- a/OsmAnd/src/net/osmand/AndroidUtils.java
+++ b/OsmAnd/src/net/osmand/AndroidUtils.java
@@ -951,6 +951,12 @@ public class AndroidUtils {
return value != null ? value : propertyValue;
}
+
+ public static String getActivityTypeStringPropertyName(Context ctx, String propertyName, String defValue) {
+ String value = getStringByProperty(ctx, "activity_type_" + propertyName + "_name");
+ return value != null ? value : defValue;
+ }
+
private static String getStringByProperty(@NonNull Context ctx, @NonNull String property) {
try {
Field field = R.string.class.getField(property);
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java
index 69772bac1c..119df5a54a 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/travelcards/TravelGpxCard.java
@@ -7,10 +7,10 @@ import android.widget.TextView;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
-import androidx.annotation.StringRes;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
+import net.osmand.AndroidUtils;
import net.osmand.osm.RouteActivityType;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
@@ -21,6 +21,8 @@ import net.osmand.plus.wikivoyage.data.TravelLocalDataHelper;
import java.io.File;
+import static net.osmand.util.Algorithms.capitalizeFirstLetterAndLowercase;
+
public class TravelGpxCard extends BaseTravelCard {
public static final int TYPE = 3;
@@ -48,12 +50,11 @@ public class TravelGpxCard extends BaseTravelCard {
RouteActivityType activityType = RouteActivityType.getTypeFromName(article.activityType);
if (activityType != null) {
int iconId = getActivityTypeIcon(activityType);
- int titleId = getActivityTypeTitle(activityType);
- if (iconId > 0 && titleId > 0) {
+ if (iconId > 0) {
holder.activityTypeIcon.setImageDrawable(getActiveIcon(iconId));
- holder.activityType.setText(titleId);
- holder.activityTypeLabel.setVisibility(View.VISIBLE);
}
+ holder.activityType.setText(getActivityTypeTitle(activityType));
+ holder.activityTypeLabel.setVisibility(View.VISIBLE);
}
holder.distance.setText(OsmAndFormatter.getFormattedDistance(article.totalDistance, app));
holder.diffElevationUp.setText(OsmAndFormatter.getFormattedAlt(article.diffElevationUp, app));
@@ -79,12 +80,12 @@ public class TravelGpxCard extends BaseTravelCard {
@DrawableRes
private int getActivityTypeIcon(RouteActivityType activityType) {
- return app.getResources().getIdentifier(activityType.getIcon(), "drawable", app.getPackageName());
+ return app.getResources().getIdentifier("mx_" + activityType.getIcon(), "drawable", app.getPackageName());
}
- @StringRes
- private int getActivityTypeTitle(RouteActivityType activityType) {
- return app.getResources().getIdentifier(activityType.getTitle(), "string", app.getPackageName());
+ private String getActivityTypeTitle(RouteActivityType activityType) {
+ return AndroidUtils.getActivityTypeStringPropertyName(app, activityType.getName(),
+ capitalizeFirstLetterAndLowercase(activityType.getName()));
}
private void updateSaveButton(final TravelGpxVH holder) {