Issue #6485 - fix typos, fix off state for switch in RasterMapMenu, cleanup

This commit is contained in:
madwasp79 2019-02-28 17:07:23 +02:00
parent c826afb0d1
commit 9dc249e37e
2 changed files with 9 additions and 14 deletions

View file

@ -17,12 +17,9 @@ import net.osmand.plus.activities.MapActivityLayers;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
import net.osmand.plus.views.GPXLayer;
import net.osmand.plus.views.RouteLayer;
public class RasterMapMenu {
private static final String TAG = "RasterMapMenu";
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
final RasterMapType type) {
ContextMenuAdapter adapter = new ContextMenuAdapter();
@ -122,6 +119,7 @@ public class RasterMapMenu {
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference, true);
} else // if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == currentMapTypeSeekbarMode)
{
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(LayerTransparencySeekbarMode.OFF);
mapLayers.getMapControlsLayer().hideTransparencyBar();
}
}

View file

@ -146,7 +146,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
underlayLayer.getMap() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_UNDERLAY, true);
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_TRANSPARENCY, true);
} else if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY &&
overlayLayer.getMap() != null) {
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
@ -317,7 +317,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
hidePolygonsPref.set(hasUnderlayDescription);
RasterMapMenu.refreshMapComplete(mapActivity);
}
}, isChecked);
});
return false;
}
return true;
@ -572,10 +572,11 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
@NonNull RasterMapType type,
@Nullable OnMapSelectedCallback callback) {
OsmandMapTileView mapView = mapActivity.getMapView();
CommonPreference<String> mapTypePreference;
CommonPreference<String> exMapTypePreference;
OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
boolean isMapSelected;
//boolean isMapSelected;
MapTileLayer layer;
if (type == RasterMapType.OVERLAY) {
mapTypePreference = settings.MAP_OVERLAY;
@ -589,9 +590,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
MapActivityLayers mapLayers = mapActivity.getMapLayers();
ITileSource map = layer.getMap();
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
OsmandRasterMapsPlugin.RasterMapType.OVERLAY ?
OsmandSettings.LayerTransparencySeekbarMode.OVERLAY : OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode = type ==
OsmandRasterMapsPlugin.RasterMapType.OVERLAY
? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY
: OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
if (map != null) {
mapTypePreference.set(null);
if (callback != null) {
@ -605,15 +607,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}
} else {
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode);
selectMapOverlayLayer(mapView, mapTypePreference, exMapTypePreference, false, mapActivity, callback);
showSeekbar = true;
}
}
public enum RasterMapType {
OVERLAY,
UNDERLAY