Fix exception

This commit is contained in:
Victor Shcherb 2013-08-05 01:36:33 +02:00
parent 0d9e9d74a5
commit d8928258ce
4 changed files with 11 additions and 2 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -563,7 +563,12 @@ public class OsmandSettings {
"default_application_mode", ApplicationMode.DEFAULT, ApplicationMode.values()).makeGlobal();
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()).makeGlobal().cache();
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
protected boolean setValue(Object prefs, DrivingRegion val) {
((CommonPreference<MetricsConstants>)METRIC_SYSTEM).cachedValue = null;
return super.setValue(prefs, val);
};
}.makeGlobal().cache();
// this value string is synchronized with settings_pref.xml preference name
// cache of metrics constants as they are used very often

View file

@ -622,6 +622,7 @@ public class RouteInfoWidgetsFactory {
ptext.setTextAlign(Align.CENTER);
final BaseMapWidget alarm = new BaseMapWidget(ma) {
private int textDy = 0;
private String text = "";
private Bitmap img = null;
private int imgId;
@ -646,11 +647,13 @@ public class RouteInfoWidgetsFactory {
}
if(alarm != null) {
int locimgId = 0;
int textDy = 0;
String text = null;
if(alarm.getType() == AlarmInfo.SPEED_LIMIT) {
text = alarm.getIntValue() +"";
if(settings.DRIVING_REGION.get() == DrivingRegion.US_CANADA){
locimgId = R.drawable.warnings_speed_limit_us;
textDy = (int) (-12 * scaleCoefficient);
}
} else if(alarm.getType() == AlarmInfo.SPEED_CAMERA) {
locimgId = R.drawable.warnings_speed_camera;
@ -683,6 +686,7 @@ public class RouteInfoWidgetsFactory {
}
if(text != null && !text.equals(this.text)) {
this.text = text;
this.textDy = textDy;
invalidate();
}
}
@ -702,7 +706,7 @@ public class RouteInfoWidgetsFactory {
canvas.drawBitmap(img, 0, 0, paintCircle);
}
if(text.length() > 0) {
canvas.drawText(text, getWidth() / 2, getHeight() / 2 + ptext.descent() + 3 * scaleCoefficient, ptext);
canvas.drawText(text, getWidth() / 2 , getHeight() / 2 + ptext.descent() + 3 * scaleCoefficient - textDy, ptext);
}
}