SHow always map source but ask to enable plugin first

This commit is contained in:
Victor Shcherb 2015-05-21 15:21:07 +03:00
parent 040d116852
commit 01ad603c4d
2 changed files with 15 additions and 3 deletions

View file

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

View file

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