From 789c49baf190d5823961a7782036fde68f9ea104 Mon Sep 17 00:00:00 2001 From: sonora Date: Wed, 23 Oct 2013 22:50:04 +0200 Subject: [PATCH] consolidate auto_zoom_map and route_view_distance Settings --- OsmAnd/res/values-be/strings.xml | 8 ++--- OsmAnd/res/values/strings.xml | 10 +++---- OsmAnd/res/xml/navigation_settings.xml | 4 +-- .../src/net/osmand/plus/OsmandSettings.java | 29 ++++++++++--------- .../osmand/plus/activities/MapActivity.java | 6 +++- .../SettingsNavigationActivity.java | 15 +++++----- .../plus/base/MapViewTrackingUtilities.java | 5 ++-- 7 files changed, 39 insertions(+), 38 deletions(-) diff --git a/OsmAnd/res/values-be/strings.xml b/OsmAnd/res/values-be/strings.xml index 9386a4b2a4..5abe34afc5 100644 --- a/OsmAnd/res/values-be/strings.xml +++ b/OsmAnd/res/values-be/strings.xml @@ -9,10 +9,10 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> - No auto zoom - Зачыніць - To mid-range - To long-range + No auto zoom + Зачыніць + To mid-range + To long-range Map magnifier Асноўная мапа сьвету Стыль мапы diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index ff2a507e18..039b9bde35 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -11,12 +11,10 @@ --> The possible route is too long to be calculated by OsmAnd offline router. In average routing is possible between points located in 200km radius, please add a waypoint to see the route. - No auto zoom - To close-up - To mid-range - To long-range - Configure map view distance (TODO naming) - Map view distance (TODO naming) + No auto zoom + To close-up + To mid-range + To long-range Map magnifier World basemap Map Styles diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml index e2ea099712..3457630cb4 100644 --- a/OsmAnd/res/xml/navigation_settings.xml +++ b/OsmAnd/res/xml/navigation_settings.xml @@ -6,8 +6,7 @@ - - @@ -18,5 +17,4 @@ android:key="use_compass_navigation"> - diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 929c4bdd41..85e4a9e406 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -678,9 +678,15 @@ public class OsmandSettings { RouteService.values()).makeProfile(); // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference ROUTE_VIEW_DISTANCE = - new EnumIntPreference("route_view_distance", RouteViewDistance.FARTHEST, - RouteViewDistance.values()).makeProfile().cache(); + public final OsmandPreference AUTO_ZOOM_MAP = + new EnumIntPreference("auto_zoom_map", AutoZoomMap.NONE, + AutoZoomMap.values()); + { + AUTO_ZOOM_MAP.makeProfile().cache(); + AUTO_ZOOM_MAP.setModeDefaultValue(ApplicationMode.CAR, AutoZoomMap.FARTHEST); + AUTO_ZOOM_MAP.setModeDefaultValue(ApplicationMode.BICYCLE, AutoZoomMap.NONE); + AUTO_ZOOM_MAP.setModeDefaultValue(ApplicationMode.PEDESTRIAN, AutoZoomMap.NONE); + } public final CommonPreference SNAP_TO_ROAD = new BooleanPreference("snap_to_road", false).makeProfile().cache(); { @@ -770,12 +776,6 @@ public class OsmandSettings { SHOW_VIEW_ANGLE.setModeDefaultValue(ApplicationMode.BICYCLE, true); SHOW_VIEW_ANGLE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true); } - - // this value string is synchronized with settings_pref.xml preference name - public final CommonPreference AUTO_ZOOM_MAP = new BooleanPreference("auto_zoom_map", false).makeProfile(); - { - AUTO_ZOOM_MAP.setModeDefaultValue(ApplicationMode.CAR, true); - } // this value string is synchronized with settings_pref.xml preference name // seconds to auto_follow @@ -1532,14 +1532,15 @@ public class OsmandSettings { } - public enum RouteViewDistance { - FARTHEST(R.string.route_distance_farthest, 1f), - FAR(R.string.route_distance_far, 1.4f), - CLOSE(R.string.route_distance_close, 2f) + public enum AutoZoomMap { + NONE(R.string.auto_zoom_none, 0f), + FARTHEST(R.string.auto_zoom_farthest, 1f), + FAR(R.string.auto_zoom_far, 1.4f), + CLOSE(R.string.auto_zoom_close, 2f) ; public final float coefficient; public final int name; - RouteViewDistance(int name, float coefficient) { + AutoZoomMap(int name, float coefficient) { this.name = name; this.coefficient = coefficient; diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 5152e3117b..ff093bee6f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -22,6 +22,7 @@ import net.osmand.plus.BusyIndicator; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.AutoZoomMap; import net.osmand.plus.PoiFilter; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; @@ -364,7 +365,10 @@ public class MapActivity extends AccessibleActivity { public void changeZoom(int stp){ // delta = Math.round(delta * OsmandMapTileView.ZOOM_DELTA) * OsmandMapTileView.ZOOM_DELTA_1; - boolean changeLocation = settings.AUTO_ZOOM_MAP.get(); + boolean changeLocation = true; + if (settings.AUTO_ZOOM_MAP.get() == settings.AutoZoomMap.NONE) { + changeLocation = false; + } final int newZoom = mapView.getZoom() + stp; mapView.getAnimatedDraggingThread().startZooming(newZoom, changeLocation); if (app.getInternalAPI().accessibilityEnabled()) diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index 4aae9458e6..6c7a9c540a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -8,7 +8,7 @@ import java.util.Set; import net.osmand.IndexConstants; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.OsmandPreference; -import net.osmand.plus.OsmandSettings.RouteViewDistance; +import net.osmand.plus.OsmandSettings.AutoZoomMap; import net.osmand.plus.R; import net.osmand.plus.routing.RouteProvider.RouteService; import android.app.AlertDialog; @@ -28,7 +28,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { private Preference showAlarms; private Preference speakAlarms; private ListPreference routerServicePreference; - private ListPreference routeViewDistancePreference; + private ListPreference autoZoomMapPreference; public static final String MORE_VALUE = "MORE_VALUE"; public SettingsNavigationActivity() { @@ -63,7 +63,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { PreferenceScreen screen = getPreferenceScreen(); settings = getMyApplication().getSettings(); - registerBooleanPreference(settings.AUTO_ZOOM_MAP, screen); registerBooleanPreference(settings.FAST_ROUTE_MODE, screen); registerBooleanPreference(settings.PRECISE_ROUTING_MODE, screen); registerBooleanPreference(settings.SNAP_TO_ROAD, screen); @@ -85,14 +84,14 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { routerServicePreference = (ListPreference) screen.findPreference(settings.ROUTER_SERVICE.getId()); - entries = new String[RouteViewDistance.values().length]; + entries = new String[AutoZoomMap.values().length]; for(int i=0; i