Hiding controls when map layer disabled
This commit is contained in:
parent
5b40432d72
commit
dc4ca416fa
1 changed files with 23 additions and 20 deletions
|
@ -32,6 +32,7 @@ public class RasterMapMenu {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
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);
|
||||||
|
assert plugin != null;
|
||||||
final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
|
final OsmandSettings.CommonPreference<Integer> mapTransparencyPreference;
|
||||||
final OsmandSettings.CommonPreference<String> mapTypePreference;
|
final OsmandSettings.CommonPreference<String> mapTypePreference;
|
||||||
@StringRes final int mapTypeString;
|
@StringRes final int mapTypeString;
|
||||||
|
@ -102,26 +103,28 @@ public class RasterMapMenu {
|
||||||
int selectedCode = selected ? 1 : 0;
|
int selectedCode = selected ? 1 : 0;
|
||||||
mapTypeDescr = selected ? mapTypeDescr : mapActivity.getString(R.string.shared_string_none);
|
mapTypeDescr = selected ? mapTypeDescr : mapActivity.getString(R.string.shared_string_none);
|
||||||
contextMenuAdapter.item(toggleActionStringId).listen(l).selected(selectedCode).reg();
|
contextMenuAdapter.item(toggleActionStringId).listen(l).selected(selectedCode).reg();
|
||||||
contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item)
|
if (selected) {
|
||||||
.description(mapTypeDescr).reg();
|
contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item)
|
||||||
ContextMenuAdapter.OnIntegerValueChangedListener integerListener =
|
.description(mapTypeDescr).reg();
|
||||||
new ContextMenuAdapter.OnIntegerValueChangedListener() {
|
ContextMenuAdapter.OnIntegerValueChangedListener integerListener =
|
||||||
@Override
|
new ContextMenuAdapter.OnIntegerValueChangedListener() {
|
||||||
public boolean onIntegerValueChangedListener(int newValue) {
|
@Override
|
||||||
mapTransparencyPreference.set(newValue);
|
public boolean onIntegerValueChangedListener(int newValue) {
|
||||||
mapActivity.getMapView().refreshMap();
|
mapTransparencyPreference.set(newValue);
|
||||||
return false;
|
mapActivity.getMapView().refreshMap();
|
||||||
}
|
return false;
|
||||||
};
|
}
|
||||||
// android:max="255" in layout is expected
|
};
|
||||||
contextMenuAdapter.item(mapTypeStringTransparency)
|
// android:max="255" in layout is expected
|
||||||
.layout(R.layout.progress_list_item)
|
contextMenuAdapter.item(mapTypeStringTransparency)
|
||||||
.iconColor(R.drawable.ic_action_opacity)
|
.layout(R.layout.progress_list_item)
|
||||||
.progress(mapTransparencyPreference.get())
|
.iconColor(R.drawable.ic_action_opacity)
|
||||||
.listenInteger(integerListener).reg();
|
.progress(mapTransparencyPreference.get())
|
||||||
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) {
|
.listenInteger(integerListener).reg();
|
||||||
contextMenuAdapter.item(R.string.show_polygons).listen(l)
|
if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY) {
|
||||||
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
contextMenuAdapter.item(R.string.show_polygons).listen(l)
|
||||||
|
.selected(hidePolygonsPref.get() ? 0 : 1).reg();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue