fix string assignment

This commit is contained in:
sonora 2016-02-12 16:51:28 +01:00
parent df12c29f62
commit 5dc376e891

View file

@ -38,16 +38,19 @@ public class RasterMapMenu {
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;
@StringRes final int mapTypeStringTransparency;
if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) { if (type == OsmandRasterMapsPlugin.RasterMapType.OVERLAY) {
rasterMapLayer = plugin.getOverlayLayer(); rasterMapLayer = plugin.getOverlayLayer();
mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY; mapTransparencyPreference = settings.MAP_OVERLAY_TRANSPARENCY;
mapTypePreference = settings.MAP_OVERLAY; mapTypePreference = settings.MAP_OVERLAY;
mapTypeString = R.string.map_overlay; mapTypeString = R.string.map_overlay;
mapTypeString = R.string.overlay_transparency;
} else if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY){ } else if (type == OsmandRasterMapsPlugin.RasterMapType.UNDERLAY){
rasterMapLayer = plugin.getUnderlayLayer(); rasterMapLayer = plugin.getUnderlayLayer();
mapTransparencyPreference = settings.MAP_TRANSPARENCY; mapTransparencyPreference = settings.MAP_TRANSPARENCY;
mapTypePreference = settings.MAP_UNDERLAY; mapTypePreference = settings.MAP_UNDERLAY;
mapTypeString = R.string.map_underlay; mapTypeString = R.string.map_underlay;
mapTypeString = R.string.map_transparency;
} else { } else {
throw new RuntimeException("Unexpected raster map type"); throw new RuntimeException("Unexpected raster map type");
} }
@ -97,8 +100,7 @@ public class RasterMapMenu {
} }
}; };
// android:max="255" in layout is expected // android:max="255" in layout is expected
// FIXME: For case of "Overlay menu" string needs to display overlay_transparency, for case of "Underlay menu" string needs to be map_transparency, as this then modifies the base map transparency, of course! contextMenuAdapter.item(mapTypeStringTransparency).layout(R.layout.progress_list_item)
contextMenuAdapter.item(R.string.map_transparency).layout(R.layout.progress_list_item)
.progress(mapTransparencyPreference.get()).listenInteger(integerListener).reg(); .progress(mapTransparencyPreference.get()).listenInteger(integerListener).reg();
contextMenuAdapter.item(mapTypeString).layout(R.layout.two_line_list_item).description(mapTypePreference.get()).reg(); contextMenuAdapter.item(mapTypeString).layout(R.layout.two_line_list_item).description(mapTypePreference.get()).reg();
contextMenuAdapter.item(R.string.show_polygons).listen(l).selected(hidePolygonsPref.get() ? 0 : 1).reg(); contextMenuAdapter.item(R.string.show_polygons).listen(l).selected(hidePolygonsPref.get() ? 0 : 1).reg();