Merge pull request #9411 from osmandapp/Canada_speed_limit

Fix #9192 UI Canadian road signs
This commit is contained in:
Vitaliy 2020-07-08 18:51:03 +03:00 committed by GitHub
commit a55f829d94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 6 deletions

View file

@ -22,12 +22,12 @@
<dimen name="map_button_shadow_height">120dp</dimen>
<dimen name="map_button_shadow_margin">6dp</dimen>
<dimen name="map_button_shadow_width">84dp</dimen>
<dimen name="map_alarm_size">116dp</dimen>
<dimen name="map_alarm_size">138dp</dimen>
<dimen name="map_alarm_bottom_text_margin">12dp</dimen>
<dimen name="map_alarm_text_size">35sp</dimen>
<dimen name="map_alarm_text_top_padding">30dp</dimen>
<dimen name="map_alarm_bottom_text_size">22sp</dimen>
<dimen name="map_alarm_bottom_si_text_size">12sp</dimen>
<dimen name="map_alarm_bottom_si_text_size">18sp</dimen>
<dimen name="map_alarm_bottom_margin">131dp</dimen>
<dimen name="map_alarm_bottom_margin_land">81dp</dimen>

View file

@ -114,7 +114,7 @@
<dimen name="map_ruler_width">120dp</dimen>
<dimen name="map_ruler_bottom_margin">9dp</dimen>
<dimen name="map_alarm_size">78dp</dimen>
<dimen name="map_alarm_size">92dp</dimen>
<dimen name="map_alarm_bottom_text_margin">8dp</dimen>
@ -148,7 +148,7 @@
<dimen name="map_alarm_text_size">25sp</dimen>
<dimen name="map_alarm_text_top_padding">20dp</dimen>
<dimen name="map_alarm_bottom_text_size">16sp</dimen>
<dimen name="map_alarm_bottom_si_text_size">8sp</dimen>
<dimen name="map_alarm_bottom_si_text_size">12sp</dimen>
<dimen name="map_widget_text_bottom_margin">1sp</dimen>
<dimen name="map_widget_text_small_bottom_margin">3sp</dimen>
<dimen name="map_widget_icon_margin">2dp</dimen>

View file

@ -1252,6 +1252,7 @@ public class RouteInfoWidgetsFactory {
private int imgId;
private String cachedText;
private String cachedBottomText;
private OsmandSettings.DrivingRegion cachedRegion;
public AlarmWidget(final OsmandApplication app, MapActivity ma) {
layout = ma.findViewById(R.id.map_alarm_warning);
@ -1366,7 +1367,7 @@ public class RouteInfoWidgetsFactory {
icon.setImageResource(locimgId);
}
Resources res = layout.getContext().getResources();
if (!Algorithms.objectEquals(text, cachedText)) {
if (!Algorithms.objectEquals(text, cachedText) || cachedRegion != region) {
cachedText = text;
widgetText.setText(cachedText);
if (alarm.getType() == AlarmInfoType.SPEED_LIMIT && americanType && !isCanadianRegion) {
@ -1376,9 +1377,10 @@ public class RouteInfoWidgetsFactory {
widgetText.setPadding(0, 0, 0, 0);
}
}
if (!Algorithms.objectEquals(bottomText, cachedBottomText)) {
if (!Algorithms.objectEquals(bottomText, cachedBottomText) || cachedRegion != region) {
cachedBottomText = bottomText;
widgetBottomText.setText(cachedBottomText);
cachedRegion = region;
if (alarm.getType() == AlarmInfoType.SPEED_LIMIT && isCanadianRegion) {
int bottomPadding = res.getDimensionPixelSize(R.dimen.map_button_margin);
widgetBottomText.setPadding(0, 0, 0, bottomPadding);