Use user property name instead of property name and remove unused methods

(cherry picked from commit 89e20efc84)
This commit is contained in:
Chumva 2019-07-08 13:54:24 +03:00
parent f6e4080b72
commit 5138d21730
2 changed files with 3 additions and 35 deletions

View file

@ -146,9 +146,9 @@ public class RouteInfoCard extends BaseCard {
if (contrastRatio < MINIMUM_CONTRAST_RATIO) { if (contrastRatio < MINIMUM_CONTRAST_RATIO) {
legendIcon.setBackgroundResource(nightMode ? R.drawable.circle_contour_bg_dark : R.drawable.circle_contour_bg_light); legendIcon.setBackgroundResource(nightMode ? R.drawable.circle_contour_bg_dark : R.drawable.circle_contour_bg_light);
} }
String propertyName = segment.getPropertyName(); String propertyName = segment.getUserPropertyName();
String name = SettingsNavigationActivity.getStringPropertyName(app, propertyName, propertyName.replaceAll("_", " ")); String name = SettingsNavigationActivity.getStringPropertyName(app, propertyName, propertyName.replaceAll("_", " "));
Spannable text = getSpanLegend(name, segment, segment.getPropertyName().equals(selectedPropertyName)); Spannable text = getSpanLegend(name, segment, segment.getUserPropertyName().equals(selectedPropertyName));
TextView legend = (TextView) view.findViewById(R.id.legend_text); TextView legend = (TextView) view.findViewById(R.id.legend_text);
legend.setText(text); legend.setText(text);

View file

@ -1,9 +1,7 @@
package net.osmand.plus.views; package net.osmand.plus.views;
import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -11,7 +9,6 @@ import android.widget.ImageButton;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import net.osmand.data.RotatedTileBox; import net.osmand.data.RotatedTileBox;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
@ -38,7 +35,6 @@ import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.RulerWidget;
import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState; import net.osmand.plus.views.mapwidgets.RouteInfoWidgetsFactory.TimeControlWidgetState;
import net.osmand.plus.views.mapwidgets.TextInfoWidget; import net.osmand.plus.views.mapwidgets.TextInfoWidget;
import java.lang.reflect.Field;
import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.*; import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.*;
public class MapInfoLayer extends OsmandMapLayer { public class MapInfoLayer extends OsmandMapLayer {
@ -360,32 +356,4 @@ public class MapInfoLayer extends OsmandMapLayer {
public boolean drawInScreenPixels() { public boolean drawInScreenPixels() {
return true; return true;
} }
}
public static String getStringPropertyName(Context ctx, String propertyName, String defValue) {
try {
Field f = R.string.class.getField("rendering_attr_" + propertyName + "_name");
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
System.err.println(e.getMessage());
}
return defValue;
}
public static String getStringPropertyDescription(Context ctx, String propertyName, String defValue) {
try {
Field f = R.string.class.getField("rendering_attr_" + propertyName + "_description");
if (f != null) {
Integer in = (Integer) f.get(null);
return ctx.getString(in);
}
} catch (Exception e) {
//e.printStackTrace();
System.err.println(e.getMessage());
}
return defValue;
}
}