Issue #6485 - fix typos, fix off state for switch in RasterMapMenu, cleanup
This commit is contained in:
parent
c826afb0d1
commit
9dc249e37e
2 changed files with 9 additions and 14 deletions
|
@ -17,12 +17,9 @@ import net.osmand.plus.activities.MapActivityLayers;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.OnMapSelectedCallback;
|
||||||
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
|
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
|
||||||
import net.osmand.plus.views.GPXLayer;
|
|
||||||
import net.osmand.plus.views.RouteLayer;
|
|
||||||
|
|
||||||
public class RasterMapMenu {
|
public class RasterMapMenu {
|
||||||
private static final String TAG = "RasterMapMenu";
|
private static final String TAG = "RasterMapMenu";
|
||||||
|
|
||||||
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
|
public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity,
|
||||||
final RasterMapType type) {
|
final RasterMapType type) {
|
||||||
ContextMenuAdapter adapter = new ContextMenuAdapter();
|
ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||||
|
@ -122,6 +119,7 @@ public class RasterMapMenu {
|
||||||
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference, true);
|
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference, true);
|
||||||
} else // if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == currentMapTypeSeekbarMode)
|
} else // if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == currentMapTypeSeekbarMode)
|
||||||
{
|
{
|
||||||
|
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(LayerTransparencySeekbarMode.OFF);
|
||||||
mapLayers.getMapControlsLayer().hideTransparencyBar();
|
mapLayers.getMapControlsLayer().hideTransparencyBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
|
if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.UNDERLAY &&
|
||||||
underlayLayer.getMap() != null) {
|
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 &&
|
} else if(settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get() == LayerTransparencySeekbarMode.OVERLAY &&
|
||||||
overlayLayer.getMap() != null) {
|
overlayLayer.getMap() != null) {
|
||||||
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
|
layers.getMapControlsLayer().showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY, true);
|
||||||
|
@ -317,7 +317,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
hidePolygonsPref.set(hasUnderlayDescription);
|
hidePolygonsPref.set(hasUnderlayDescription);
|
||||||
RasterMapMenu.refreshMapComplete(mapActivity);
|
RasterMapMenu.refreshMapComplete(mapActivity);
|
||||||
}
|
}
|
||||||
}, isChecked);
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -572,10 +572,11 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
@NonNull RasterMapType type,
|
@NonNull RasterMapType type,
|
||||||
@Nullable OnMapSelectedCallback callback) {
|
@Nullable OnMapSelectedCallback callback) {
|
||||||
OsmandMapTileView mapView = mapActivity.getMapView();
|
OsmandMapTileView mapView = mapActivity.getMapView();
|
||||||
|
CommonPreference<String> mapTypePreference;
|
||||||
CommonPreference<String> exMapTypePreference;
|
CommonPreference<String> exMapTypePreference;
|
||||||
OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
|
OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
|
||||||
|
|
||||||
boolean isMapSelected;
|
//boolean isMapSelected;
|
||||||
MapTileLayer layer;
|
MapTileLayer layer;
|
||||||
if (type == RasterMapType.OVERLAY) {
|
if (type == RasterMapType.OVERLAY) {
|
||||||
mapTypePreference = settings.MAP_OVERLAY;
|
mapTypePreference = settings.MAP_OVERLAY;
|
||||||
|
@ -589,9 +590,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
||||||
ITileSource map = layer.getMap();
|
ITileSource map = layer.getMap();
|
||||||
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
|
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode = type ==
|
||||||
OsmandRasterMapsPlugin.RasterMapType.OVERLAY ?
|
OsmandRasterMapsPlugin.RasterMapType.OVERLAY
|
||||||
OsmandSettings.LayerTransparencySeekbarMode.OVERLAY : OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
|
? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY
|
||||||
|
: OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
mapTypePreference.set(null);
|
mapTypePreference.set(null);
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
|
@ -605,15 +607,10 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode);
|
settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(currentMapTypeSeekbarMode);
|
||||||
|
|
||||||
selectMapOverlayLayer(mapView, mapTypePreference, exMapTypePreference, false, mapActivity, callback);
|
selectMapOverlayLayer(mapView, mapTypePreference, exMapTypePreference, false, mapActivity, callback);
|
||||||
showSeekbar = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public enum RasterMapType {
|
public enum RasterMapType {
|
||||||
OVERLAY,
|
OVERLAY,
|
||||||
UNDERLAY
|
UNDERLAY
|
||||||
|
|
Loading…
Reference in a new issue