Use user property name instead of property name and remove unused methods
(cherry picked from commit 89e20efc84
)
This commit is contained in:
parent
f6e4080b72
commit
5138d21730
2 changed files with 3 additions and 35 deletions
|
@ -146,9 +146,9 @@ public class RouteInfoCard extends BaseCard {
|
|||
if (contrastRatio < MINIMUM_CONTRAST_RATIO) {
|
||||
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("_", " "));
|
||||
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);
|
||||
legend.setText(text);
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package net.osmand.plus.views;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -11,7 +9,6 @@ import android.widget.ImageButton;
|
|||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
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.TextInfoWidget;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import static net.osmand.plus.views.mapwidgets.MapWidgetRegistry.*;
|
||||
|
||||
public class MapInfoLayer extends OsmandMapLayer {
|
||||
|
@ -360,32 +356,4 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
public boolean drawInScreenPixels() {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue