Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2013-11-28 20:21:59 +01:00
commit 6a8c5c61a3
2 changed files with 95 additions and 91 deletions

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="map_widget_appearance">Remaining elements:</string>
<string name="map_widget_map_rendering">Map rendering:</string>
<string name="app_mode_hiking">Hiking</string> <string name="app_mode_hiking">Hiking</string>
<string name="app_mode_motorcycle">Motorcycle</string> <string name="app_mode_motorcycle">Motorcycle</string>
<string name="app_mode_boat">Boat</string> <string name="app_mode_boat">Boat</string>
@ -617,7 +619,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="avoid_in_routing_descr">Avoid toll roads, unpaved, ferries</string> <string name="avoid_in_routing_descr">Avoid toll roads, unpaved, ferries</string>
<string name="map_widget_fluorescent">Fluorescent routes</string> <string name="map_widget_fluorescent">Fluorescent routes</string>
<string name="map_widget_show_ruler">Ruler</string> <string name="map_widget_show_ruler">Ruler</string>
<string name="map_widget_appearance">Miscellaneous:</string>
<string name="map_widget_view_direction">Viewing direction</string> <string name="map_widget_view_direction">Viewing direction</string>
<string name="map_widget_transparent">Transparent skin</string> <string name="map_widget_transparent">Transparent skin</string>
<string name="monitoring_mode_off">Record GPX</string> <string name="monitoring_mode_off">Record GPX</string>

View file

@ -29,71 +29,7 @@ public class AppearanceWidgetsFactory {
public void registerAppearanceWidgets(final MapActivity map, final MapInfoLayer mapInfoLayer, public void registerAppearanceWidgets(final MapActivity map, final MapInfoLayer mapInfoLayer,
final MapWidgetRegistry mapInfoControls) { final MapWidgetRegistry mapInfoControls) {
final OsmandMapTileView view = map.getMapView(); 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<String> 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, final MapWidgetRegistry.MapWidgetRegInfo displayViewDirections = mapInfoControls.registerAppearanceWidget(R.drawable.widget_viewing_direction, R.string.map_widget_view_direction,
"viewDirection", view.getSettings().SHOW_VIEW_ANGLE); "viewDirection", view.getSettings().SHOW_VIEW_ANGLE);
@ -107,32 +43,6 @@ public class AppearanceWidgetsFactory {
if (EXTRA_SETTINGS) { if (EXTRA_SETTINGS) {
// previous extra settings // previous extra settings
/*final OsmandSettings.OsmandPreference<Float> 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, final MapWidgetRegistry.MapWidgetRegInfo showRuler = mapInfoControls.registerAppearanceWidget(R.drawable.widget_ruler, R.string.map_widget_show_ruler,
"showRuler", view.getSettings().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<String> 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<Float> 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(); RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
if(renderer != null && EXTRA_SETTINGS) { if(renderer != null && EXTRA_SETTINGS) {
createCustomRenderingProperties(renderer, map, mapInfoLayer, mapInfoControls); createCustomRenderingProperties(renderer, map, mapInfoLayer, mapInfoControls);