Fix transparency seekbar

This commit is contained in:
Alexey Kulish 2016-04-26 15:38:02 +03:00
parent 3849be68d9
commit a9d2040e7e
4 changed files with 101 additions and 36 deletions

View file

@ -1135,8 +1135,8 @@ public class OsmandSettings {
public final CommonPreference<String> MAP_TILE_SOURCES = new StringPreference("map_tile_sources", public final CommonPreference<String> MAP_TILE_SOURCES = new StringPreference("map_tile_sources",
TileSourceManager.getMapnikSource().getName()).makeGlobal(); TileSourceManager.getMapnikSource().getName()).makeGlobal();
public final CommonPreference<Boolean> SHOW_LAYER_TRANSPARENCY_SEEKBAR = public final CommonPreference<LayerTransparencySeekbarMode> LAYER_TRANSPARENCY_SEEKBAR_MODE =
new BooleanPreference("show_layer_transparency_seekbar", false).makeGlobal(); new EnumIntPreference<>("layer_transparency_seekbar_mode", LayerTransparencySeekbarMode.UNDEFINED, LayerTransparencySeekbarMode.values());
public final CommonPreference<String> MAP_OVERLAY_PREVIOUS = new StringPreference("map_overlay_previous", null).makeGlobal().cache(); public final CommonPreference<String> MAP_OVERLAY_PREVIOUS = new StringPreference("map_overlay_previous", null).makeGlobal().cache();
@ -2579,6 +2579,24 @@ public class OsmandSettings {
} }
} }
public enum LayerTransparencySeekbarMode {
OVERLAY(R.string.overlay_transparency),
UNDERLAY(R.string.map_transparency),
OFF(R.string.shared_string_off),
UNDEFINED(R.string.shared_string_none);
private final int key;
LayerTransparencySeekbarMode(int key) {
this.key = key;
}
public String toHumanString(Context ctx) {
return ctx.getString(key);
}
}
public enum MapMarkersMode { public enum MapMarkersMode {
TOOLBAR(R.string.shared_string_topbar), TOOLBAR(R.string.shared_string_topbar),
WIDGETS(R.string.shared_string_widgets), WIDGETS(R.string.shared_string_widgets),

View file

@ -1,6 +1,8 @@
package net.osmand.plus.dialogs; package net.osmand.plus.dialogs;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
@ -9,10 +11,12 @@ import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity; 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.rastermaps.OsmandRasterMapsPlugin.RasterMapType;
import net.osmand.plus.views.GPXLayer; import net.osmand.plus.views.GPXLayer;
import net.osmand.plus.views.RouteLayer; import net.osmand.plus.views.RouteLayer;
@ -20,7 +24,7 @@ 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 OsmandRasterMapsPlugin.RasterMapType type) { final RasterMapType type) {
ContextMenuAdapter adapter = new ContextMenuAdapter(); ContextMenuAdapter adapter = new ContextMenuAdapter();
adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu); adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
createLayersItems(adapter, mapActivity, type); createLayersItems(adapter, mapActivity, type);
@ -29,7 +33,7 @@ public class RasterMapMenu {
private static void createLayersItems(final ContextMenuAdapter contextMenuAdapter, private static void createLayersItems(final ContextMenuAdapter contextMenuAdapter,
final MapActivity mapActivity, final MapActivity mapActivity,
final OsmandRasterMapsPlugin.RasterMapType type) { final RasterMapType type) {
final OsmandApplication app = mapActivity.getMyApplication(); final 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);
@ -37,15 +41,17 @@ public class RasterMapMenu {
final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference; final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
final OsmandSettings.CommonPreference<String> mapTypePreference; final OsmandSettings.CommonPreference<String> mapTypePreference;
final OsmandSettings.CommonPreference<String> exMapTypePreference; final OsmandSettings.CommonPreference<String> exMapTypePreference;
final LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
type == RasterMapType.OVERLAY ? LayerTransparencySeekbarMode.OVERLAY : LayerTransparencySeekbarMode.UNDERLAY;
@StringRes final int mapTypeString; @StringRes final int mapTypeString;
@StringRes final int mapTypeStringTransparency; @StringRes final int mapTypeStringTransparency;
if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) { if (type == RasterMapType.OVERLAY) {
mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY; mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY;
mapTypePreference = settings.MAP_OVERLAY; mapTypePreference = settings.MAP_OVERLAY;
exMapTypePreference = settings.MAP_OVERLAY_PREVIOUS; exMapTypePreference = settings.MAP_OVERLAY_PREVIOUS;
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 == RasterMapType.UNDERLAY) {
mapTransparencyPreference = settings.MAP_TRANSPARENCY; mapTransparencyPreference = settings.MAP_TRANSPARENCY;
mapTypePreference = settings.MAP_UNDERLAY; mapTypePreference = settings.MAP_UNDERLAY;
exMapTypePreference = settings.MAP_UNDERLAY_PREVIOUS; exMapTypePreference = settings.MAP_UNDERLAY_PREVIOUS;
@ -91,14 +97,8 @@ public class RasterMapMenu {
app.runInUIThread(new Runnable() { app.runInUIThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (isChecked) {
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
} else {
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 == RasterMapType.UNDERLAY) {
hidePolygonsPref.set(isChecked); hidePolygonsPref.set(isChecked);
mapActivity.getDashboard().refreshContent(true); mapActivity.getDashboard().refreshContent(true);
} }
@ -109,11 +109,16 @@ public class RasterMapMenu {
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.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(isChecked); isChecked ? currentMapTypeSeekbarMode : LayerTransparencySeekbarMode.OFF);
if (isChecked) { if (isChecked) {
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference); mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
Log.e("111", "checkbox: show");
} else {
mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference);
Log.e("111", "checkbox: hide");
} }
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(isChecked);
} }
return false; return false;
} }
@ -149,15 +154,14 @@ public class RasterMapMenu {
.setProgress(mapTransparencyPreference.get()) .setProgress(mapTransparencyPreference.get())
.setListener(l) .setListener(l)
.setIntegerListener(integerListener).createItem()); .setIntegerListener(integerListener).createItem());
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) { if (type == RasterMapType.UNDERLAY) {
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder() contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.show_polygons, mapActivity) .setTitleId(R.string.show_polygons, mapActivity)
.hideDivider(true) .hideDivider(true)
.setListener(l) .setListener(l)
.setSelected(!hidePolygonsPref.get()).createItem()); .setSelected(!hidePolygonsPref.get()).createItem());
} }
Boolean transparencySwitchState = settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.get() Boolean transparencySwitchState = isSeekbarVisible(app, type);
&& mapLayers.getMapControlsLayer().isTransparencyBarInitialized();
contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder() contextMenuAdapter.addItem(new ContextMenuItem.ItemBuilder()
.setTitleId(R.string.show_transparency_seekbar, mapActivity) .setTitleId(R.string.show_transparency_seekbar, mapActivity)
.hideDivider(true) .hideDivider(true)
@ -166,6 +170,14 @@ public class RasterMapMenu {
} }
} }
@NonNull
public static Boolean isSeekbarVisible(OsmandApplication app, RasterMapType type) {
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
type == RasterMapType.OVERLAY ? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY : OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
LayerTransparencySeekbarMode seekbarMode = app.getSettings().LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
return seekbarMode == LayerTransparencySeekbarMode.UNDEFINED || seekbarMode == currentMapTypeSeekbarMode;
}
public static void refreshMapComplete(final MapActivity activity) { public static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache(); activity.getMyApplication().getResourceManager().getRenderer().clearCache();
activity.updateMapSettings(); activity.updateMapSettings();

View file

@ -6,6 +6,7 @@ import android.os.AsyncTask;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener; import android.widget.AdapterView.OnItemSelectedListener;
@ -28,6 +29,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.activities.DownloadTilesDialog; import net.osmand.plus.activities.DownloadTilesDialog;
@ -105,6 +107,8 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
}; };
// mapView.addLayer(overlayLayer, 0.7f); // mapView.addLayer(overlayLayer, 0.7f);
settings.MAP_OVERLAY_TRANSPARENCY.addListener(overlayLayerListener); settings.MAP_OVERLAY_TRANSPARENCY.addListener(overlayLayerListener);
} }
@Override @Override
@ -235,7 +239,6 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
public void registerLayerContextMenuActions(final OsmandMapTileView mapView, public void registerLayerContextMenuActions(final OsmandMapTileView mapView,
ContextMenuAdapter adapter, ContextMenuAdapter adapter,
final MapActivity mapActivity) { final MapActivity mapActivity) {
final MapActivityLayers layers = mapActivity.getMapLayers();
ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.OnRowItemClick() { ContextMenuAdapter.ItemClickListener listener = new ContextMenuAdapter.OnRowItemClick() {
@Override @Override
public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) { public boolean onRowItemClick(ArrayAdapter<ContextMenuItem> adapter, View view, int itemId, int position) {
@ -532,24 +535,46 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin {
OsmandMapTileView mapView = mapActivity.getMapView(); OsmandMapTileView mapView = mapActivity.getMapView();
CommonPreference<String> mapTypePreference; CommonPreference<String> mapTypePreference;
CommonPreference<String> exMapTypePreference; CommonPreference<String> exMapTypePreference;
OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
ITileSource map; ITileSource map;
if (type == RasterMapType.OVERLAY) { if (type == RasterMapType.OVERLAY) {
mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY;
mapTypePreference = settings.MAP_OVERLAY; mapTypePreference = settings.MAP_OVERLAY;
exMapTypePreference = settings.MAP_OVERLAY_PREVIOUS; exMapTypePreference = settings.MAP_OVERLAY_PREVIOUS;
map = overlayLayer.getMap(); map = overlayLayer.getMap();
} else { } else {
// Underlay expected // Underlay expected
mapTransparencyPreference = settings.MAP_TRANSPARENCY;
mapTypePreference = settings.MAP_UNDERLAY; mapTypePreference = settings.MAP_UNDERLAY;
exMapTypePreference = settings.MAP_UNDERLAY_PREVIOUS; exMapTypePreference = settings.MAP_UNDERLAY_PREVIOUS;
map = underlayLayer.getMap(); map = underlayLayer.getMap();
} }
boolean isChecked = map == null;
boolean showSeekbar = isChecked && RasterMapMenu.isSeekbarVisible(app, type);
boolean hideSeekbar = !isChecked && RasterMapMenu.isSeekbarVisible(app, type);
MapActivityLayers mapLayers = mapActivity.getMapLayers();
CommonPreference<LayerTransparencySeekbarMode> seekbarModePref = settings.LAYER_TRANSPARENCY_SEEKBAR_MODE;
if (showSeekbar) {
mapLayers.getMapControlsLayer().showTransparencyBar(mapTransparencyPreference);
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(true);
if (seekbarModePref.get() == LayerTransparencySeekbarMode.UNDEFINED) {
final OsmandSettings.LayerTransparencySeekbarMode currentMapTypeSeekbarMode =
type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY ? OsmandSettings.LayerTransparencySeekbarMode.OVERLAY : OsmandSettings.LayerTransparencySeekbarMode.UNDERLAY;
seekbarModePref.set(currentMapTypeSeekbarMode);
}
Log.e("111", "toggleUnderlayState: show");
} else if (hideSeekbar) {
mapLayers.getMapControlsLayer().hideTransparencyBar(mapTransparencyPreference);
mapLayers.getMapControlsLayer().setTransparencyBarEnabled(false);
Log.e("111", "toggleUnderlayState: hide");
}
if (map != null) { if (map != null) {
mapTypePreference.set(null); mapTypePreference.set(null);
if (callback != null) { if (callback != null) {
callback.onMapSelected(); callback.onMapSelected();
} }
MapActivityLayers mapLayers = mapActivity.getMapLayers();
updateMapLayers(mapView, null, mapLayers); updateMapLayers(mapView, null, mapLayers);
} else { } else {
selectMapOverlayLayer(mapView, mapTypePreference, exMapTypePreference, false, mapActivity, callback); selectMapOverlayLayer(mapView, mapTypePreference, exMapTypePreference, false, mapActivity, callback);

View file

@ -14,6 +14,7 @@ import android.os.Build;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -32,6 +33,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.OsmandSettings.CommonPreference; import net.osmand.plus.OsmandSettings.CommonPreference;
import net.osmand.plus.OsmandSettings.LayerTransparencySeekbarMode;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.TargetPointsHelper.TargetPoint;
@ -39,6 +41,7 @@ import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.search.SearchAddressFragment; import net.osmand.plus.activities.search.SearchAddressFragment;
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.corenative.NativeCoreContext; import net.osmand.plus.views.corenative.NativeCoreContext;
@ -68,7 +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> transparencySetting;
private boolean isTransparencyBarEnabled = true; private boolean isTransparencyBarEnabled = true;
private OsmandSettings settings; private OsmandSettings settings;
@ -611,8 +614,8 @@ public class MapControlsLayer extends OsmandMapLayer {
transparencyBarLayout = (LinearLayout) mapActivity.findViewById(R.id.map_transparency_layout); transparencyBarLayout = (LinearLayout) mapActivity.findViewById(R.id.map_transparency_layout);
transparencyBar = (SeekBar) mapActivity.findViewById(R.id.map_transparency_seekbar); transparencyBar = (SeekBar) mapActivity.findViewById(R.id.map_transparency_seekbar);
transparencyBar.setMax(255); transparencyBar.setMax(255);
if (settingsToTransparency != null) { if (transparencySetting != null) {
transparencyBar.setProgress(settingsToTransparency.get()); transparencyBar.setProgress(transparencySetting.get());
transparencyBarLayout.setVisibility(View.VISIBLE); transparencyBarLayout.setVisibility(View.VISIBLE);
} else { } else {
transparencyBarLayout.setVisibility(View.GONE); transparencyBarLayout.setVisibility(View.GONE);
@ -629,8 +632,8 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (settingsToTransparency != null) { if (transparencySetting != null) {
settingsToTransparency.set(progress); transparencySetting.set(progress);
mapActivity.getMapView().refreshMap(); mapActivity.getMapView().refreshMap();
} }
} }
@ -640,15 +643,26 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
transparencyBarLayout.setVisibility(View.GONE); transparencyBarLayout.setVisibility(View.GONE);
settings.SHOW_LAYER_TRANSPARENCY_SEEKBAR.set(false); settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.set(LayerTransparencySeekbarMode.OFF);
hideTransparencyBar(settingsToTransparency); hideTransparencyBar(transparencySetting);
} }
}); });
LayerTransparencySeekbarMode seekbarMode = settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
if (seekbarMode == LayerTransparencySeekbarMode.OVERLAY && settings.MAP_OVERLAY.get() != null) {
showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY);
setTransparencyBarEnabled(true);
Log.e("111", "init: show OVERLAY");
} else if (seekbarMode == LayerTransparencySeekbarMode.UNDERLAY && settings.MAP_UNDERLAY.get() != null) {
showTransparencyBar(settings.MAP_TRANSPARENCY);
setTransparencyBarEnabled(true);
Log.e("111", "init: show UNDERLAY");
}
} }
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) { public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
if (MapControlsLayer.settingsToTransparency != transparenPreference) { if (MapControlsLayer.transparencySetting != transparenPreference) {
MapControlsLayer.settingsToTransparency = transparenPreference; MapControlsLayer.transparencySetting = transparenPreference;
if (isTransparencyBarEnabled) { if (isTransparencyBarEnabled) {
transparencyBarLayout.setVisibility(View.VISIBLE); transparencyBarLayout.setVisibility(View.VISIBLE);
} }
@ -657,15 +671,15 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
public void hideTransparencyBar(CommonPreference<Integer> transparentPreference) { public void hideTransparencyBar(CommonPreference<Integer> transparentPreference) {
if (settingsToTransparency == transparentPreference) { if (transparencySetting == transparentPreference) {
transparencyBarLayout.setVisibility(View.GONE); transparencyBarLayout.setVisibility(View.GONE);
settingsToTransparency = null; transparencySetting = null;
} }
} }
public void setTransparencyBarEnabled(boolean isTransparencyBarEnabled) { public void setTransparencyBarEnabled(boolean isTransparencyBarEnabled) {
this.isTransparencyBarEnabled = isTransparencyBarEnabled; this.isTransparencyBarEnabled = isTransparencyBarEnabled;
if (settingsToTransparency != null) { if (transparencySetting != null) {
if (isTransparencyBarEnabled) { if (isTransparencyBarEnabled) {
transparencyBarLayout.setVisibility(View.VISIBLE); transparencyBarLayout.setVisibility(View.VISIBLE);
} else { } else {
@ -674,10 +688,6 @@ 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;