From de1faa64bf856e6df1d3cf8e00fd54a1a370a219 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sun, 15 May 2011 02:01:36 +0200 Subject: [PATCH] Add settings. Issue 419 --- OsmAnd/res/values/strings.xml | 2 ++ OsmAnd/res/xml/settings_pref.xml | 2 ++ OsmAnd/src/net/osmand/plus/OsmandSettings.java | 3 +++ .../net/osmand/plus/activities/SettingsActivity.java | 10 ++++++++++ OsmAnd/src/net/osmand/plus/render/RendererLayer.java | 5 ++++- .../src/net/osmand/plus/views/OsmandMapTileView.java | 1 - 6 files changed, 21 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index f6ddbf5757..7e87df9812 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -1,5 +1,7 @@ + Max zoom level to use vector rendering instead of raster + Zoom vector level Location sharing Do you find some interresting place on your trip and want to share it\'s location with your friends or family? \nOsmAnd affords you to easily share any location you want. diff --git a/OsmAnd/res/xml/settings_pref.xml b/OsmAnd/res/xml/settings_pref.xml index 2e40de7229..19c42ac0b2 100644 --- a/OsmAnd/res/xml/settings_pref.xml +++ b/OsmAnd/res/xml/settings_pref.xml @@ -50,6 +50,8 @@ + diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index c157ee5d36..399792d85c 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -488,6 +488,9 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference MAX_LEVEL_TO_DOWNLOAD_TILE = new IntPreference("max_level_download_tile", 18, false, true); + + // this value string is synchronized with settings_pref.xml preference name + public final OsmandPreference LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 5, false, true); // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference MAP_VIEW_3D = new BooleanPreference("map_view_3d", false, false); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java index f160561654..c6a90a95b0 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsActivity.java @@ -206,6 +206,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference } registerListPreference(osmandSettings.MAX_LEVEL_TO_DOWNLOAD_TILE, screen, entries, intValues); + startZoom = 3; + endZoom = 18; + entries = new String[endZoom - startZoom + 1]; + intValues = new Integer[endZoom - startZoom + 1]; + for (int i = startZoom; i <= endZoom; i++) { + entries[i - startZoom] = i + ""; //$NON-NLS-1$ + intValues[i - startZoom] = i ; + } + registerListPreference(osmandSettings.LEVEL_TO_SWITCH_VECTOR_RASTER, screen, entries, intValues); + entries = new String[RouteService.values().length]; for(int i=0; i= startZoom && visible) { + Integer zoom = view.getSettings().LEVEL_TO_SWITCH_VECTOR_RASTER.get(); + if (view.getZoom() >= Math.max(zoom, startZoom) && visible) { if (!view.isZooming()){ pixRect.set(0, 0, view.getWidth(), view.getHeight()); updateRotatedTileBox(); @@ -95,6 +96,8 @@ public class RendererLayer implements OsmandMapLayer { canvas.drawBitmap(bmp, null, destImage, paintImg); } } + } else { + resourceManager.getRenderer().clearCache(); } } diff --git a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java index 8c8acacec1..82de021a3d 100644 --- a/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java +++ b/OsmAnd/src/net/osmand/plus/views/OsmandMapTileView.java @@ -23,7 +23,6 @@ import net.osmand.plus.views.MultiTouchSupport.MultiTouchZoomListener; import org.apache.commons.logging.Log; import android.content.Context; -import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color;