From d8928258cef2cf1fdc26bbeedfb677c0357c1220 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Mon, 5 Aug 2013 01:36:33 +0200 Subject: [PATCH] Fix exception --- .../drawable-hdpi/warnings_speed_limit_us.png | Bin 1267 -> 3035 bytes .../warnings_speed_limit_us.png | Bin 1267 -> 3035 bytes .../src/net/osmand/plus/OsmandSettings.java | 7 ++++++- .../mapwidgets/RouteInfoWidgetsFactory.java | 6 +++++- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/drawable-hdpi/warnings_speed_limit_us.png b/OsmAnd/res/drawable-hdpi/warnings_speed_limit_us.png index 4eb97b9163908a207da14bbc87fded7fa8a0662a..b721c082532a587164be7a8c3fc8dbfea76a4797 100644 GIT binary patch literal 3035 zcmdT`i93|t|9-sLvS%5Cv4jSZC0VnS2-B27uQf}Ir7(m`K0*(01&jbv2*}4 z=FjBi2EXm@@O?0GMp)Qh=LI947ySTS9}lx}jR1gS8h<9oKM!Gd!A+@1E0;*eQ2$8W z&2T>ehr?;!!URS5-VF283=Iz;u9!#z0Kbc^<;Cmx0%l^RfCS=7=B9R)Ri+Czn&x5bwQWye;VP z@NkDOLqkV|Cr`+yO-xKg1)6n?jg3bcjEd&it=rCj|NVDfah}Lu7Q908W(SpfdwYny zPP9^13~gitS`VHWC;8H=I*#JGL@bJ(DsZMdV-ZCfu2srVz%b`hXs8xuqUm_W@PGM} zwaw>!NKh7wWn*J=0fiC)KKqbHy1ToDCB?-LWUO=LdbObfmr_Mqu`v6JVf60$94DZ@ zQJk8VmRC2KNOaMFSn!@qI$)*EQPaihUzeBfQn3ii_GnO|m#X?ocXhwn6~i2*RFN+O z1E^!~oER5*Po6n*CeaI~K9t{Ywx1{Z24s^VZdK-ZhvI&Emd;x%GT>uCm!w@5x$L%X7uzRZIneVt*mbLKGVaqXp$^O zXmdRk4u>l$D^p7~yeKduBO~^7nmi}VItPZ8F|QAvXnLA!9<%;4izRHjDI%Y=GG=tK z$W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9Ud4XTC8XK76=OOlPW>NdNJd%=Nb( zO1|`3Iq&1gkNRzGZE`h>^78YSzkQqQ-Yq95Hz}w~O|Kqpg z#w#=o1Sc-by!Y?lKl!AMH*S3T^yzq8qRq!^3*@x;YR;RS4PTa7XKrque)h~630+-X z|1G8~*pD}Mc9{5PoB4izy=~jJohw(a>~m52=$W7YUO0z8D>U>$`OdrV&j0%Td;iDZ ze-FNVnVD}QRcmNq5U~8M DRIVING_REGION = new EnumIntPreference( - "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)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 diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 3d9c921db4..eb879ff50b 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -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); } }