diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index c4a27193e0..bba636dfc8 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 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 --> + Remaining elements: + Map rendering: Hiking Motorcycle Boat @@ -617,7 +619,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A Avoid toll roads, unpaved, ferries Fluorescent routes Ruler - Miscellaneous: Viewing direction Transparent skin Record GPX diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java index 4b7ee8dfcd..af7fff58dc 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java @@ -29,71 +29,7 @@ public class AppearanceWidgetsFactory { public void registerAppearanceWidgets(final MapActivity map, final MapInfoLayer mapInfoLayer, final MapWidgetRegistry mapInfoControls) { final OsmandMapTileView view = map.getMapView(); - final MapWidgetRegistry.MapWidgetRegInfo vectorRenderer = mapInfoControls.registerAppearanceWidget(R.drawable.widget_rendering_style, R.string.map_widget_renderer, - "renderer", view.getSettings().RENDERER); - final OsmandApplication app = view.getApplication(); - vectorRenderer.setStateChangeListener(new Runnable() { - @Override - public void run() { - AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); - bld.setTitle(R.string.renderers); - Collection rendererNames = app.getRendererRegistry().getRendererNames(); - final String[] items = rendererNames.toArray(new String[rendererNames.size()]); - int i = -1; - for(int j = 0; j< items.length; j++) { - if(items[j].equals(app.getRendererRegistry().getCurrentSelectedRenderer().getName())) { - i = j; - break; - } - } - bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - String renderer = items[which]; - RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer); - if (loaded != null) { - view.getSettings().RENDERER.set(renderer); - app.getRendererRegistry().setCurrentSelectedRender(loaded); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - } else { - AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); - } - if(EXTRA_SETTINGS) { - createCustomRenderingProperties(loaded, map, mapInfoLayer, mapInfoControls); - } - dialog.dismiss(); - } - }); - bld.show(); - } - }); - - final MapWidgetRegistry.MapWidgetRegInfo dayNight = mapInfoControls.registerAppearanceWidget(R.drawable.widget_day_night_mode, R.string.map_widget_day_night, - "dayNight", view.getSettings().DAYNIGHT_MODE); - dayNight.setStateChangeListener(new Runnable() { - @Override - public void run() { - AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); - bld.setTitle(R.string.daynight); - final String[] items = new String[OsmandSettings.DayNightMode.values().length]; - for (int i = 0; i < items.length; i++) { - items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(map.getMyApplication()); - } - int i = view.getSettings().DAYNIGHT_MODE.get().ordinal(); - bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - dialog.dismiss(); - } - }); - bld.show(); - } - }); final MapWidgetRegistry.MapWidgetRegInfo displayViewDirections = mapInfoControls.registerAppearanceWidget(R.drawable.widget_viewing_direction, R.string.map_widget_view_direction, "viewDirection", view.getSettings().SHOW_VIEW_ANGLE); @@ -107,32 +43,6 @@ public class AppearanceWidgetsFactory { if (EXTRA_SETTINGS) { // previous extra settings - /*final OsmandSettings.OsmandPreference textSizePref = view.getSettings().MAP_TEXT_SIZE; - final MapWidgetRegistry.MapWidgetRegInfo textSize = mapInfoControls.registerAppearanceWidget(R.drawable.widget_text_size, R.string.map_text_size, - "text_size", textSizePref); - textSize.setStateChangeListener(new Runnable() { - @Override - public void run() { - final Float[] floatValues = new Float[] {0.6f, 0.8f, 1.0f, 1.2f, 1.5f, 1.75f, 2f}; - String[] entries = new String[floatValues.length]; - for (int i = 0; i < floatValues.length; i++) { - entries[i] = (int) (floatValues[i] * 100) +" %"; - } - AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); - b.setTitle(R.string.map_text_size); - int i = Arrays.binarySearch(floatValues, textSizePref.get()); - b.setSingleChoiceItems(entries, i, new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - textSizePref.set(floatValues[which]); - app.getResourceManager().getRenderer().clearCache(); - view.refreshMap(true); - dialog.dismiss(); - } - }); - b.show(); - } - });*/ final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.string.map_widget_show_ruler, "showRuler", view.getSettings().SHOW_RULER); @@ -189,6 +99,99 @@ public class AppearanceWidgetsFactory { } + final MapWidgetRegistry.MapWidgetRegInfo vectorRenderer = mapInfoControls.registerAppearanceWidget(R.drawable.widget_rendering_style, R.string.map_widget_renderer, + "renderer", view.getSettings().RENDERER, map.getString(R.string.map_widget_map_rendering)); + final OsmandApplication app = view.getApplication(); + vectorRenderer.setStateChangeListener(new Runnable() { + @Override + public void run() { + AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); + bld.setTitle(R.string.renderers); + Collection rendererNames = app.getRendererRegistry().getRendererNames(); + final String[] items = rendererNames.toArray(new String[rendererNames.size()]); + int i = -1; + for(int j = 0; j< items.length; j++) { + if(items[j].equals(app.getRendererRegistry().getCurrentSelectedRenderer().getName())) { + i = j; + break; + } + } + bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + String renderer = items[which]; + RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer); + if (loaded != null) { + view.getSettings().RENDERER.set(renderer); + app.getRendererRegistry().setCurrentSelectedRender(loaded); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + } else { + AccessibleToast.makeText(app, R.string.renderer_load_exception, Toast.LENGTH_SHORT).show(); + } + if(EXTRA_SETTINGS) { + createCustomRenderingProperties(loaded, map, mapInfoLayer, mapInfoControls); + } + dialog.dismiss(); + } + }); + bld.show(); + } + }); + + final MapWidgetRegistry.MapWidgetRegInfo dayNight = mapInfoControls.registerAppearanceWidget(R.drawable.widget_day_night_mode, R.string.map_widget_day_night, + "dayNight", view.getSettings().DAYNIGHT_MODE, map.getString(R.string.map_widget_map_rendering)); + dayNight.setStateChangeListener(new Runnable() { + @Override + public void run() { + AlertDialog.Builder bld = new AlertDialog.Builder(view.getContext()); + bld.setTitle(R.string.daynight); + final String[] items = new String[OsmandSettings.DayNightMode.values().length]; + for (int i = 0; i < items.length; i++) { + items[i] = OsmandSettings.DayNightMode.values()[i].toHumanString(map.getMyApplication()); + } + int i = view.getSettings().DAYNIGHT_MODE.get().ordinal(); + bld.setSingleChoiceItems(items, i, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + view.getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.values()[which]); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + dialog.dismiss(); + } + }); + bld.show(); + } + }); + + /*final OsmandSettings.OsmandPreference textSizePref = view.getSettings().MAP_TEXT_SIZE; + final MapWidgetRegistry.MapWidgetRegInfo textSize = mapInfoControls.registerAppearanceWidget(R.drawable.widget_text_size, R.string.map_text_size, + "text_size", textSizePref, map.getString(R.string.map_widget_map_rendering)); + textSize.setStateChangeListener(new Runnable() { + @Override + public void run() { + final Float[] floatValues = new Float[] {0.6f, 0.8f, 1.0f, 1.2f, 1.5f, 1.75f, 2f}; + String[] entries = new String[floatValues.length]; + for (int i = 0; i < floatValues.length; i++) { + entries[i] = (int) (floatValues[i] * 100) +" %"; + } + AlertDialog.Builder b = new AlertDialog.Builder(view.getContext()); + b.setTitle(R.string.map_text_size); + int i = Arrays.binarySearch(floatValues, textSizePref.get()); + b.setSingleChoiceItems(entries, i, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + textSizePref.set(floatValues[which]); + app.getResourceManager().getRenderer().clearCache(); + view.refreshMap(true); + dialog.dismiss(); + } + }); + b.show(); + } + });*/ + RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer(); if(renderer != null && EXTRA_SETTINGS) { createCustomRenderingProperties(renderer, map, mapInfoLayer, mapInfoControls);