From 01ad603c4db6d8978657677306e5877447d3e8f9 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Thu, 21 May 2015 15:21:07 +0300 Subject: [PATCH] SHow always map source but ask to enable plugin first --- .../net/osmand/plus/dialogs/ConfigureMapMenu.java | 13 +++++++++++++ .../plus/rastermaps/OsmandRasterMapsPlugin.java | 5 ++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index ab069c929a..8d3eaa39aa 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -17,10 +17,12 @@ import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.activities.PluginActivity; import net.osmand.plus.activities.SettingsActivity; import net.osmand.plus.activities.TransportRouteHelper; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.poi.PoiLegacyFilter; +import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.corenative.NativeCoreContext; @@ -33,6 +35,7 @@ import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.content.DialogInterface.OnMultiChoiceClickListener; import android.view.View; import android.widget.ArrayAdapter; @@ -111,6 +114,14 @@ public class ConfigureMapMenu { if (isChecked) { selectPOILayer(settings); } + } else if (itemId == R.string.layer_map) { + if(OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) == null) { + Intent intent = new Intent(ma, PluginActivity.class); + intent.putExtra(PluginActivity.EXTRA_PLUGIN_ID, OsmandRasterMapsPlugin.ID); + ma.startActivity(intent); + } else { + ma.getMapLayers().selectMapLayer(ma.getMapView()); + } } else if (itemId == R.string.layer_amenity_label) { settings.SHOW_POI_LABEL.set(isChecked); } else if (itemId == R.string.shared_string_favorites) { @@ -157,6 +168,8 @@ public class ConfigureMapMenu { // String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] "; adapter.item(R.string.layer_poi).selected(settings.SELECTED_POI_FILTER_FOR_MAP.get() != null ? 1 : 0) .iconColor(R.drawable.ic_action_info_dark).listen(l).reg(); + adapter.item(R.string.layer_map).iconColor(R.drawable.ic_world_globe_dark) + .listen(l).reg(); adapter.item(R.string.layer_amenity_label).selected(settings.SHOW_POI_LABEL.get() ? 1 : 0) .iconColor(R.drawable.ic_action_text_dark).listen(l).reg(); adapter.item(R.string.shared_string_favorites).selected(settings.SHOW_FAVORITES.get() ? 1 : 0) diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index 6b6f661d36..1b4e7b3460 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -41,7 +41,7 @@ import android.widget.Spinner; import android.widget.Toast; public class OsmandRasterMapsPlugin extends OsmandPlugin { - private static final String ID = "osmand.rastermaps"; + public static final String ID = "osmand.rastermaps"; private OsmandSettings settings; private OsmandApplication app; @@ -214,8 +214,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { return true; } }; - adapter.item(R.string.layer_map).iconColor(R.drawable.ic_world_globe_dark) - .listen(listener).position(3).reg(); + adapter.item(R.string.layer_overlay).selected(overlayLayer != null && overlayLayer.getMap() != null ? 1 : 0). iconColor(R.drawable.ic_layer_top_dark).listen(listener).position(14).reg(); adapter.item(R.string.layer_underlay).selected(underlayLayer != null && underlayLayer.getMap() != null ? 1 : 0)