Switch for transparency seekbar on map visibility.
This commit is contained in:
parent
8a8e41e0e2
commit
51f983b751
2 changed files with 18 additions and 6 deletions
|
@ -81,8 +81,8 @@ 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) {
|
||||||
MapActivityLayers mapLayers = mapActivity.getMapLayers();
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
|
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,6 +98,7 @@ public class RasterMapMenu {
|
||||||
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);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +129,7 @@ public class RasterMapMenu {
|
||||||
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
||||||
}
|
}
|
||||||
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() ? 0 : 1).reg();
|
.selected(settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.get() ? 1 : 0).reg();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,11 +28,8 @@ import net.londatiga.android.QuickAction;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.core.android.MapRendererContext;
|
import net.osmand.core.android.MapRendererContext;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
|
@ -74,6 +71,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
private SeekBar transparencyBar;
|
private SeekBar transparencyBar;
|
||||||
private LinearLayout transparencyBarLayout;
|
private LinearLayout transparencyBarLayout;
|
||||||
private static CommonPreference<Integer> settingsToTransparency;
|
private static CommonPreference<Integer> settingsToTransparency;
|
||||||
|
private boolean isTransparencyBarEnabled = true;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
|
||||||
private MapRouteInfoMenu mapRouteInfoMenu;
|
private MapRouteInfoMenu mapRouteInfoMenu;
|
||||||
|
@ -639,7 +637,9 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
|
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
|
||||||
MapControlsLayer.settingsToTransparency = transparenPreference;
|
MapControlsLayer.settingsToTransparency = transparenPreference;
|
||||||
transparencyBarLayout.setVisibility(View.VISIBLE);
|
if (isTransparencyBarEnabled) {
|
||||||
|
transparencyBarLayout.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
transparencyBar.setProgress(transparenPreference.get());
|
transparencyBar.setProgress(transparenPreference.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,6 +650,17 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTransparencyBarEnabled(boolean isTransparencyBarEnabled) {
|
||||||
|
this.isTransparencyBarEnabled = isTransparencyBarEnabled;
|
||||||
|
if (settingsToTransparency != null) {
|
||||||
|
if(isTransparencyBarEnabled) {
|
||||||
|
transparencyBarLayout.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
transparencyBarLayout.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class MapHudButton {
|
private class MapHudButton {
|
||||||
View iv;
|
View iv;
|
||||||
int bgDark;
|
int bgDark;
|
||||||
|
|
Loading…
Reference in a new issue