Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-11-01 15:47:41 +01:00
commit c506ad243e

View file

@ -42,6 +42,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers; import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.PluginActivity;
import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.openseamapsplugin.NauticalMapsPlugin;
import net.osmand.plus.poi.PoiFiltersHelper; import net.osmand.plus.poi.PoiFiltersHelper;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.render.RendererRegistry;
@ -495,20 +496,27 @@ public class ConfigureMapMenu {
final OsmandApplication app = activity.getMyApplication(); final OsmandApplication app = activity.getMyApplication();
Collection<String> rendererNames = app.getRendererRegistry().getRendererNames(); Collection<String> rendererNames = app.getRendererRegistry().getRendererNames();
final String[] items = rendererNames.toArray(new String[rendererNames.size()]); final String[] items = rendererNames.toArray(new String[rendererNames.size()]);
final String[] visibleNames = new String[items.length]; boolean nauticalPluginDisabled = OsmandPlugin.getEnabledPlugin(NauticalMapsPlugin.class) == null;
final List<String> visibleNamesList = new ArrayList<>();
int selected = -1; int selected = -1;
final String selectedName = app.getRendererRegistry().getCurrentSelectedRenderer().getName(); final String selectedName = app.getRendererRegistry().getCurrentSelectedRenderer().getName();
for (int j = 0; j < items.length; j++) { int i = 0;
if (items[j].equals(selectedName)) { for (String item : items) {
selected = j; if (nauticalPluginDisabled && item.equals(RendererRegistry.NAUTICAL_RENDER)) {
continue;
} }
visibleNames[j] = items[j].replace('_', ' ').replace('-', ' '); if (item.equals(selectedName)) {
selected = i;
}
visibleNamesList.add(item.replace('_', ' ').replace('-', ' '));
i++;
} }
bld.setSingleChoiceItems(visibleNames, selected, new DialogInterface.OnClickListener() {
bld.setSingleChoiceItems(visibleNamesList.toArray(new String[visibleNamesList.size()]), selected, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String renderer = items[which]; String renderer = visibleNamesList.get(which);
RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer); RenderingRulesStorage loaded = app.getRendererRegistry().getRenderer(renderer);
if (loaded != null) { if (loaded != null) {
OsmandMapTileView view = activity.getMapView(); OsmandMapTileView view = activity.getMapView();