Fixing bugs overlay and underlay layers.
This commit is contained in:
parent
aa9cf8d4a8
commit
338c418a40
4 changed files with 27 additions and 12 deletions
|
@ -74,7 +74,9 @@
|
||||||
android:id="@+id/map_transparency_seekbar"
|
android:id="@+id/map_transparency_seekbar"
|
||||||
android:layout_width="@dimen/map_trans_seek_size"
|
android:layout_width="@dimen/map_trans_seek_size"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"/>
|
android:layout_gravity="center"
|
||||||
|
android:paddingLeft="6dp"
|
||||||
|
android:paddingRight="6dp"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/map_transparency_hide"
|
android:id="@+id/map_transparency_hide"
|
||||||
|
|
|
@ -68,6 +68,7 @@ public class RasterMapMenu {
|
||||||
mapActivity.getDashboard().refreshContent(true);
|
mapActivity.getDashboard().refreshContent(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
final MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
||||||
ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
|
ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
public boolean onRowItemClick(ArrayAdapter<?> adapter, View view, int itemId, int pos) {
|
||||||
|
@ -84,24 +85,28 @@ public class RasterMapMenu {
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextMenuClick(final ArrayAdapter<?> adapter,
|
public boolean onContextMenuClick(final ArrayAdapter<?> adapter,
|
||||||
int itemId, int pos, boolean isChecked) {
|
int itemId, int pos, boolean isChecked) {
|
||||||
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
|
||||||
if (itemId == toggleActionStringId) {
|
if (itemId == toggleActionStringId) {
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
|
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
|
||||||
} else {
|
} else {
|
||||||
mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference);
|
mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference);
|
||||||
}
|
}
|
||||||
|
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(isChecked);
|
||||||
plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback);
|
plugin.toggleUnderlayState(mapActivity, type, onMapSelectedCallback);
|
||||||
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) {
|
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY && !isChecked) {
|
||||||
hidePolygonsPref.set(isChecked);
|
hidePolygonsPref.set(false);
|
||||||
mapActivity.getDashboard().refreshContent(true);
|
mapActivity.getDashboard().refreshContent(true);
|
||||||
}
|
}
|
||||||
|
refreshMapComplete(mapActivity);
|
||||||
} else if (itemId == R.string.show_polygons) {
|
} else if (itemId == R.string.show_polygons) {
|
||||||
hidePolygonsPref.set(!isChecked);
|
hidePolygonsPref.set(!isChecked);
|
||||||
refreshMapComplete(mapActivity);
|
refreshMapComplete(mapActivity);
|
||||||
} else if (itemId == R.string.show_transparency_seekbar) {
|
} else if (itemId == R.string.show_transparency_seekbar) {
|
||||||
settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.set(isChecked);
|
settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.set(isChecked);
|
||||||
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(isChecked);
|
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(isChecked);
|
||||||
|
if (isChecked) {
|
||||||
|
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +136,10 @@ public class RasterMapMenu {
|
||||||
contextMenuAdapter.item(R.string.show_polygons).listen(l)
|
contextMenuAdapter.item(R.string.show_polygons).listen(l)
|
||||||
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
||||||
}
|
}
|
||||||
|
Boolean transparencySwitchState = settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.get()
|
||||||
|
&& mapLayers.getMapControlsLayer().isTransparencyBarInitialized();
|
||||||
contextMenuAdapter.item(R.string.show_transparency_seekbar).listen(l)
|
contextMenuAdapter.item(R.string.show_transparency_seekbar).listen(l)
|
||||||
.selected(settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.get() ? 1 : 0).reg();
|
.selected(transparencySwitchState ? 1 : 0).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,8 +439,8 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
|
|
||||||
private static void updateTileSourceEditView(TileSourceTemplate ts, EditText name, final EditText urlToLoad, final EditText minZoom,
|
private static void updateTileSourceEditView(TileSourceTemplate ts, EditText name, final EditText urlToLoad, final EditText minZoom,
|
||||||
final EditText maxZoom, EditText expire, final CheckBox elliptic) {
|
final EditText maxZoom, EditText expire, final CheckBox elliptic) {
|
||||||
minZoom.setText(ts.getMinimumZoomSupported() + "");
|
minZoom.setText(String.valueOf(ts.getMinimumZoomSupported()));
|
||||||
maxZoom.setText(ts.getMaximumZoomSupported() + "");
|
maxZoom.setText(String.valueOf(ts.getMaximumZoomSupported()));
|
||||||
name.setText(ts.getName());
|
name.setText(ts.getName());
|
||||||
expire.setText(ts.getExpirationTimeMinutes() < 0 ? "" : ts.getExpirationTimeMinutes() + "");
|
expire.setText(ts.getExpirationTimeMinutes() < 0 ? "" : ts.getExpirationTimeMinutes() + "");
|
||||||
urlToLoad.setText(ts.getUrlTemplate() == null ? "" :
|
urlToLoad.setText(ts.getUrlTemplate() == null ? "" :
|
||||||
|
@ -470,7 +470,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
|
||||||
} else {
|
} else {
|
||||||
// Underlay expected
|
// Underlay expected
|
||||||
mapTypePreference = settings.MAP_UNDERLAY;
|
mapTypePreference = settings.MAP_UNDERLAY;
|
||||||
exMapTypePreference = settings.MAP_OVERLAY_PREVIOUS;
|
exMapTypePreference = settings.MAP_UNDERLAY_PREVIOUS;
|
||||||
map = underlayLayer.getMap();
|
map = underlayLayer.getMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -637,11 +637,13 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
|
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
|
||||||
MapControlsLayer.settingsToTransparency = transparenPreference;
|
if (MapControlsLayer.settingsToTransparency != transparenPreference) {
|
||||||
if (isTransparencyBarEnabled) {
|
MapControlsLayer.settingsToTransparency = transparenPreference;
|
||||||
transparencyBarLayout.setVisibility(View.VISIBLE);
|
if (isTransparencyBarEnabled) {
|
||||||
|
transparencyBarLayout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
transparencyBar.setProgress(transparenPreference.get());
|
||||||
}
|
}
|
||||||
transparencyBar.setProgress(transparenPreference.get());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideTransparencyBar(CommonPreference<Integer> transparentPreference) {
|
public void hideTransparencyBar(CommonPreference<Integer> transparentPreference) {
|
||||||
|
@ -662,6 +664,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTransparencyBarInitialized() {
|
||||||
|
return settingsToTransparency != null;
|
||||||
|
}
|
||||||
|
|
||||||
private class MapHudButton {
|
private class MapHudButton {
|
||||||
View iv;
|
View iv;
|
||||||
int bgDark;
|
int bgDark;
|
||||||
|
|
Loading…
Reference in a new issue