From a7c0717867b5ad8542395a2b80255886308069d5 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 19 Mar 2015 00:51:30 +0100 Subject: [PATCH] Update icons --- OsmAnd/res/drawable/btn_circle_n.xml | 2 +- OsmAnd/res/values/sizes.xml | 4 +-- .../osmand/plus/views/MapControlsLayer.java | 27 ++++++++++++++++--- .../mapwidgets/MapInfoWidgetsFactory.java | 2 ++ .../plus/views/mapwidgets/TextInfoWidget.java | 1 - 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/drawable/btn_circle_n.xml b/OsmAnd/res/drawable/btn_circle_n.xml index 1890ac9861..f9697ef6a0 100644 --- a/OsmAnd/res/drawable/btn_circle_n.xml +++ b/OsmAnd/res/drawable/btn_circle_n.xml @@ -14,7 +14,7 @@ android:insetRight="@dimen/map_button_inset_shadow" android:insetTop="@dimen/map_button_inset_shadow" > - + diff --git a/OsmAnd/res/values/sizes.xml b/OsmAnd/res/values/sizes.xml index b062c5bf95..4c19d39f9b 100644 --- a/OsmAnd/res/values/sizes.xml +++ b/OsmAnd/res/values/sizes.xml @@ -62,7 +62,7 @@ 50dp 120dp 7dp - 52dp + 54dp 78dp 25sp @@ -78,7 +78,7 @@ 100dp 2dp - 2dp + 1dp 4dp 3dp 1px diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 1934a2910b..92918c3abd 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -527,12 +527,17 @@ public class MapControlsLayer extends OsmandMapLayer { // final Drawable backToLocTrackedWhite = map.getResources().getDrawable(R.drawable.back_to_loc_tracked_white); boolean enabled = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null; boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation(); + if (!enabled) { - backToLocationControl.setIconColorId(R.color.icon_color_light); + backToLocationControl.setBg(R.drawable.btn_circle, R.drawable.btn_circle_night); + backToLocationControl.setIconColorId(R.color.icon_color_light, 0); } else if (tracked) { - backToLocationControl.setIconColorId(R.color.color_distance); + backToLocationControl.setIconColorId(0); + backToLocationControl.setBg(R.drawable.btn_circle_blue); } else { - backToLocationControl.setIconColorId(R.color.color_white); + // TODO different icon + backToLocationControl.setIconColorId(R.color.map_widget_icon_color); + backToLocationControl.setBg(R.drawable.btn_circle_blue); } boolean visible = !(tracked && rh.isFollowingMode()); backToLocationControl.updateVisibility(visible); @@ -628,6 +633,9 @@ public class MapControlsLayer extends OsmandMapLayer { } public MapHudButton setBg(int dayBg, int nightBg) { + if(bgDark == nightBg && dayBg == bgLight) { + return this; + } bgDark = nightBg; bgLight = dayBg; f = true; @@ -648,6 +656,9 @@ public class MapControlsLayer extends OsmandMapLayer { } public MapHudButton setBg(int bg) { + if(bgDark == bg && bg == bgLight) { + return this; + } bgDark = bg; bgLight = bg; f = true; @@ -672,6 +683,16 @@ public class MapControlsLayer extends OsmandMapLayer { f = true; return this; } + + public MapHudButton setIconColorId(int clrLight, int clrDark) { + if (resLight == clrLight && resDark == clrDark) { + return this; + } + resLight = clrLight; + resDark = clrDark; + f = true; + return this; + } public void update(OsmandApplication ctx, boolean night) { if (nightMode == night && !f) { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 451476f79b..a15a2289bc 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -349,6 +349,8 @@ public class MapInfoWidgetsFactory { RouteDataObject rt = locationProvider.getLastKnownRouteSegment(); if(rt != null) { text = RoutingHelper.formatStreetName(rt.getName(), rt.getRef(), rt.getDestinationName()); + } else { + text = ""; } } if(!showNextTurn && updateWaypoint()) { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java index 8a879b53bc..fed6db6269 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/TextInfoWidget.java @@ -4,7 +4,6 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import android.app.Activity; -import android.app.Application; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.view.View;