Add settings. Issue 419

This commit is contained in:
Victor Shcherb 2011-05-15 02:01:36 +02:00
parent abb8ea203a
commit de1faa64bf
6 changed files with 21 additions and 2 deletions

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="level_to_switch_vector_raster_descr">Max zoom level to use vector rendering instead of raster</string>
<string name="level_to_switch_vector_raster">Zoom vector level</string>
<string name="tip_location_sharing">Location sharing</string>
<string name="tip_location_sharing_t">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.

View file

@ -50,6 +50,8 @@
<CheckBoxPreference android:key="show_view_angle" android:title="@string/show_view_angle" android:summary="@string/show_view_angle_descr"></CheckBoxPreference>
<ListPreference android:key="rotate_map" android:title="@string/rotate_map_to_bearing" android:summary="@string/rotate_map_to_bearing_descr"></ListPreference>
<ListPreference android:key="map_screen_orientation" android:title="@string/map_screen_orientation" android:summary="@string/map_screen_orientation_descr"></ListPreference>
<ListPreference android:title="@string/level_to_switch_vector_raster" android:summary="@string/level_to_switch_vector_raster_descr"
android:key="level_to_switch_vector_raster"></ListPreference>
<EditTextPreference android:title="@string/application_dir" android:key="external_storage_dir"></EditTextPreference>
<ListPreference android:key="default_metric_system" android:title="@string/unit_of_length" android:summary="@string/unit_of_length_descr"></ListPreference>
<ListPreference android:key="position_on_map" android:title="@string/position_on_map" android:summary="@string/position_on_map_descr"></ListPreference>

View file

@ -489,6 +489,9 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Integer> 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<Integer> 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<Boolean> MAP_VIEW_3D = new BooleanPreference("map_view_3d", false, false);

View file

@ -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<entries.length; i++){
entries[i] = RouteService.values()[i].getName();

View file

@ -53,7 +53,8 @@ public class RendererLayer implements OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, boolean nightMode) {
if (view.getZoom() >= 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();
}
}

View file

@ -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;