Hiding controls when map layer disabled

This commit is contained in:
GaidamakUA 2016-02-23 11:06:31 +02:00
parent 5b40432d72
commit dc4ca416fa

View file

@ -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,6 +103,7 @@ 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();
if (selected) {
contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item) contextMenuAdapter.item(mapTypeString).listen(l).layout(R.layout.two_line_list_item)
.description(mapTypeDescr).reg(); .description(mapTypeDescr).reg();
ContextMenuAdapter.OnIntegerValueChangedListener integerListener = ContextMenuAdapter.OnIntegerValueChangedListener integerListener =
@ -124,6 +126,7 @@ public class RasterMapMenu {
.selected(hidePolygonsPref.get() ? 0 : 1).reg(); .selected(hidePolygonsPref.get() ? 0 : 1).reg();
} }
} }
}
private static void refreshMapComplete(final MapActivity activity) { private static void refreshMapComplete(final MapActivity activity) {
activity.getMyApplication().getResourceManager().getRenderer().clearCache(); activity.getMyApplication().getResourceManager().getRenderer().clearCache();