Showing polygons when underlay is turned off.

This commit is contained in:
GaidamakUA 2016-02-23 10:58:36 +02:00
parent 768dbe2841
commit 5b40432d72
2 changed files with 5 additions and 9 deletions

View file

@ -14,7 +14,7 @@
android:id="@+id/icon" android:id="@+id/icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="4dp" android:layout_marginRight="3dp"
tools:src="@drawable/ic_world_globe_dark"/> tools:src="@drawable/ic_world_globe_dark"/>
<TextView <TextView

View file

@ -3,7 +3,6 @@ package net.osmand.plus.dialogs;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Toast;
import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
@ -14,7 +13,6 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivityLayers; import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.views.GPXLayer; import net.osmand.plus.views.GPXLayer;
import net.osmand.plus.views.MapTileLayer;
import net.osmand.plus.views.RouteLayer; import net.osmand.plus.views.RouteLayer;
public class RasterMapMenu { public class RasterMapMenu {
@ -34,19 +32,16 @@ public class RasterMapMenu {
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
final OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
final OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class); final OsmandRasterMapsPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class);
final MapTileLayer rasterMapLayer;
final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference; final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
final OsmandSettings.CommonPreference<String> mapTypePreference; final OsmandSettings.CommonPreference<String> mapTypePreference;
@StringRes final int mapTypeString; @StringRes final int mapTypeString;
@StringRes final int mapTypeStringTransparency; @StringRes final int mapTypeStringTransparency;
if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) { if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) {
rasterMapLayer = plugin.getOverlayLayer();
mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY; mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY;
mapTypePreference = settings.MAP_OVERLAY; mapTypePreference = settings.MAP_OVERLAY;
mapTypeString = R.string.map_overlay; mapTypeString = R.string.map_overlay;
mapTypeStringTransparency = R.string.overlay_transparency; mapTypeStringTransparency = R.string.overlay_transparency;
} else if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) { } else if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) {
rasterMapLayer = plugin.getUnderlayLayer();
mapTransparencyPreference = settings.MAP_TRANSPARENCY; mapTransparencyPreference = settings.MAP_TRANSPARENCY;
mapTypePreference = settings.MAP_UNDERLAY; mapTypePreference = settings.MAP_UNDERLAY;
mapTypeString = R.string.map_underlay; mapTypeString = R.string.map_underlay;
@ -67,9 +62,6 @@ public class RasterMapMenu {
@Override @Override
public void onMapSelected() { public void onMapSelected() {
mapActivity.getDashboard().refreshContent(true); mapActivity.getDashboard().refreshContent(true);
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY && selected) {
Toast.makeText(mapActivity, R.string.consider_turning_polygons_off, Toast.LENGTH_SHORT).show();
}
} }
}; };
ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() { ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
@ -96,6 +88,10 @@ public class RasterMapMenu {
mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference); mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference);
} }
plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback); plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback);
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) {
hidePolygonsPref.set(isChecked);
mapActivity.getDashboard().refreshContent(true);
}
} else if (itemId == R.string.show_polygons) { } else if (itemId == R.string.show_polygons) {
hidePolygonsPref.set(!isChecked); hidePolygonsPref.set(!isChecked);
refreshMapComplete(mapActivity); refreshMapComplete(mapActivity);