Disable transparency bar if plugin is gone

This commit is contained in:
Victor Shcherb 2018-05-11 01:09:52 +02:00
parent 90608ee7df
commit e56847043c

View file

@ -30,7 +30,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.core.android.MapRendererContext; import net.osmand.core.android.MapRendererContext;
@ -53,6 +52,7 @@ import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.mapcontextmenu.MapContextMenu; import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu; import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu; import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
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;
@ -84,7 +84,7 @@ public class MapControlsLayer extends OsmandMapLayer {
private SeekBar transparencyBar; private SeekBar transparencyBar;
private LinearLayout transparencyBarLayout; private LinearLayout transparencyBarLayout;
private static CommonPreference<Integer> transparencySetting; private static CommonPreference<Integer> transparencySetting;
private boolean isTransparencyBarEnabled = true; private boolean isTransparencyBarEnabled;
private OsmandSettings settings; private OsmandSettings settings;
private MapRouteInfoMenu mapRouteInfoMenu; private MapRouteInfoMenu mapRouteInfoMenu;
@ -980,6 +980,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}); });
LayerTransparencySeekbarMode seekbarMode = settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get(); LayerTransparencySeekbarMode seekbarMode = settings.LAYER_TRANSPARENCY_SEEKBAR_MODE.get();
if (OsmandPlugin.getEnabledPlugin(OsmandRasterMapsPlugin.class) != null) {
if (seekbarMode == LayerTransparencySeekbarMode.OVERLAY && settings.MAP_OVERLAY.get() != null) { if (seekbarMode == LayerTransparencySeekbarMode.OVERLAY && settings.MAP_OVERLAY.get() != null) {
showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY); showTransparencyBar(settings.MAP_OVERLAY_TRANSPARENCY);
setTransparencyBarEnabled(true); setTransparencyBarEnabled(true);
@ -988,6 +989,7 @@ public class MapControlsLayer extends OsmandMapLayer {
setTransparencyBarEnabled(true); setTransparencyBarEnabled(true);
} }
} }
}
public void showTransparencyBar(CommonPreference<Integer> transparenPreference) { public void showTransparencyBar(CommonPreference<Integer> transparenPreference) {
if (MapControlsLayer.transparencySetting != transparenPreference) { if (MapControlsLayer.transparencySetting != transparenPreference) {