From 0ed9cc1665c4a7dc4a2eeff066ebad5466399293 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 31 Jan 2018 18:49:27 +0200 Subject: [PATCH 1/4] Osm notes menu in progress --- .../osmand/plus/dashboard/DashboardOnMap.java | 11 +++++++++-- .../osmand/plus/osmedit/OsmEditingPlugin.java | 19 ++++++++++++++++--- .../net/osmand/plus/osmedit/OsmNotesMenu.java | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index ce7f5efdef..538b9f680d 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -76,6 +76,7 @@ import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu; import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter; import net.osmand.plus.mapillary.MapillaryFiltersFragment; import net.osmand.plus.mapillary.MapillaryPlugin.MapillaryFirstDialogFragment; +import net.osmand.plus.osmedit.OsmNotesMenu; import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener; @@ -189,7 +190,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis UNDERLAY_MAP, MAPILLARY, CONTOUR_LINES, - HILLSHADE + HILLSHADE, + OSM_NOTES } private Map actionButtons = new HashMap<>(); @@ -428,6 +430,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis tv.setText(R.string.srtm_plugin_name); } else if (visibleType == DashboardType.HILLSHADE) { tv.setText(R.string.layer_hillshade); + } else if (visibleType == DashboardType.OSM_NOTES) { + tv.setText(R.string.osm_notes); } ImageView edit = (ImageView) dashboardView.findViewById(R.id.toolbar_edit); edit.setVisibility(View.GONE); @@ -822,7 +826,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis && visibleType != DashboardType.CONFIGURE_SCREEN && visibleType != DashboardType.CONFIGURE_MAP && visibleType != DashboardType.CONTOUR_LINES - && visibleType != DashboardType.HILLSHADE) { + && visibleType != DashboardType.HILLSHADE + && visibleType != DashboardType.OSM_NOTES) { listView.setDivider(dividerDrawable); listView.setDividerHeight(dpToPx(1f)); } else { @@ -879,6 +884,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis cm = ContourLinesMenu.createListAdapter(mapActivity); } else if (visibleType == DashboardType.HILLSHADE) { cm = HillshadeMenu.createListAdapter(mapActivity); + } else if (visibleType == DashboardType.OSM_NOTES) { + cm = OsmNotesMenu.createListAdapter(mapActivity); } if (cm != null) { updateListAdapter(cm); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index d84d952025..9ae8f1160f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -15,6 +15,7 @@ import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; +import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.data.Amenity; import net.osmand.osm.PoiType; @@ -30,6 +31,7 @@ import net.osmand.plus.activities.EnumAdapter; import net.osmand.plus.activities.EnumAdapter.IEnumWithResource; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.TabActivity; +import net.osmand.plus.dashboard.DashboardOnMap.DashboardType; import net.osmand.plus.dashboard.tools.DashFragmentData; import net.osmand.plus.myplaces.AvailableGPXFragment; import net.osmand.plus.myplaces.AvailableGPXFragment.GpxInfo; @@ -258,11 +260,23 @@ public class OsmEditingPlugin extends OsmandPlugin { @Override public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) { - adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_osm_bugs, mapActivity) + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(R.string.layer_osm_bugs, mapActivity) .setSelected(settings.SHOW_OSM_BUGS.get()) .setIcon(R.drawable.ic_action_bug_dark) .setColor(settings.SHOW_OSM_BUGS.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) - .setListener(new ContextMenuAdapter.ItemClickListener() { + .setSecondaryIcon(R.drawable.ic_action_additional_option) + .setListener(new ContextMenuAdapter.OnRowItemClick() { + + @Override + public boolean onRowItemClick(ArrayAdapter adapter, View view, int itemId, int position) { + if (itemId == R.string.layer_osm_bugs) { + mapActivity.getDashboard().setDashboardVisibility(true, + DashboardType.OSM_NOTES, AndroidUtils.getCenterViewCoordinates(view)); + return false; + } + return true; + } @Override public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, int pos, boolean isChecked, int[] viewCoordinates) { @@ -279,7 +293,6 @@ public class OsmEditingPlugin extends OsmandPlugin { }) .setPosition(16) .createItem()); - } @Override diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java new file mode 100644 index 0000000000..6b87268520 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java @@ -0,0 +1,19 @@ +package net.osmand.plus.osmedit; + +import net.osmand.plus.ContextMenuAdapter; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; + +public class OsmNotesMenu { + + public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) { + ContextMenuAdapter adapter = new ContextMenuAdapter(); + adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu); + createLayersItems(adapter, mapActivity); + return adapter; + } + + private static void createLayersItems(final ContextMenuAdapter adapter, final MapActivity mapActivity) { + + } +} From 93e94c2400f2c15d29f85eee254382eaac485614 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 1 Feb 2018 15:25:35 +0200 Subject: [PATCH 2/4] Add items to osm notes menu; add functionality for show/hide closed notes and notes in general --- OsmAnd/res/values/strings.xml | 2 + .../src/net/osmand/plus/OsmandSettings.java | 1 + .../net/osmand/plus/osmedit/OsmBugsLayer.java | 11 +++ .../net/osmand/plus/osmedit/OsmNotesMenu.java | 67 +++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 228afb66a8..b71dfcd62b 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Show closed notes + Show/Hide OSM Notes on the map. GPX - suitable for export to JOSM or other OSM editors. OSC - suitable for export to OpenStreetMap. GPX file diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index d72737873f..0bc65d695a 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1155,6 +1155,7 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference SHOW_OSM_BUGS = new BooleanPreference("show_osm_bugs", false).makeGlobal(); + public final CommonPreference SHOW_CLOSED_OSM_BUGS = new BooleanPreference("show_closed_osm_bugs", false).makeGlobal(); public final CommonPreference MAP_INFO_CONTROLS = new StringPreference("map_info_controls", "").makeProfile(); { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index c84a7aa825..37670867f0 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -127,7 +127,11 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider List fullObjects = new ArrayList<>(); List fullObjectsLatLon = new ArrayList<>(); List smallObjectsLatLon = new ArrayList<>(); + boolean showClosed = activity.getMyApplication().getSettings().SHOW_CLOSED_OSM_BUGS.get(); for (OpenStreetNote o : objects) { + if (!o.isOpened() && !showClosed) { + continue; + } float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude()); float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); @@ -146,6 +150,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider } } for (OpenStreetNote o : fullObjects) { + if (!o.isOpened() && !showClosed) { + continue; + } float x = tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude()); float y = tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude()); Bitmap b; @@ -200,9 +207,13 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider final int rad = getRadiusBug(tb); int radius = rad * 3 / 2; int small = rad * 3 / 4; + boolean showClosed = activity.getMyApplication().getSettings().SHOW_CLOSED_OSM_BUGS.get(); try { for (int i = 0; i < objects.size(); i++) { OpenStreetNote n = objects.get(i); + if (!n.isOpened() && !showClosed) { + continue; + } int x = (int) tb.getPixXFromLatLon(n.getLatitude(), n.getLongitude()); int y = (int) tb.getPixYFromLatLon(n.getLatitude(), n.getLongitude()); if (Math.abs(x - ex) <= radius && Math.abs(y - ey) <= radius) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java index 6b87268520..6b548f03e5 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java @@ -1,6 +1,14 @@ package net.osmand.plus.osmedit; +import android.widget.ArrayAdapter; +import android.widget.Toast; + import net.osmand.plus.ContextMenuAdapter; +import net.osmand.plus.ContextMenuItem; +import net.osmand.plus.OsmandPlugin; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.CommonPreference; +import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; @@ -14,6 +22,65 @@ public class OsmNotesMenu { } private static void createLayersItems(final ContextMenuAdapter adapter, final MapActivity mapActivity) { + final OsmandSettings settings = mapActivity.getMyApplication().getSettings(); + final OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class); + if (plugin == null) { + return; + } + + final int osmNotesStringId = R.string.layer_osm_bugs; + final int showZoomLevelStringId = R.string.show_from_zoom_level; + final int showClosedNotesStringId = R.string.show_closed_notes; + + final OsmandPreference showOsmBugsPref = settings.SHOW_OSM_BUGS; + final CommonPreference showClosedOsmBugsPref = settings.SHOW_CLOSED_OSM_BUGS; + + ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() { + @Override + public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, + int position, boolean isChecked, int[] viewCoordinates) { + if (itemId == osmNotesStringId) { + showOsmBugsPref.set(isChecked); + plugin.updateLayers(mapActivity.getMapView(), mapActivity); + mapActivity.refreshMap(); + } else if (itemId == showZoomLevelStringId) { + Toast.makeText(mapActivity, "show zoom level", Toast.LENGTH_SHORT).show(); //todo + } else if (itemId == showClosedNotesStringId) { + showClosedOsmBugsPref.set(isChecked); + mapActivity.refreshMap(); + } + return false; + } + }; + + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(osmNotesStringId, mapActivity) + .setDescription(mapActivity.getString(R.string.switch_osm_notes_visibility_desc)) + .setIcon(R.drawable.ic_action_bug_dark) + .setListener(l) + .setSelected(showOsmBugsPref.get()) + .createItem()); + + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(showZoomLevelStringId, mapActivity) + .setDescription("11") //todo + .setLayout(R.layout.list_item_single_line_descrition_narrow) + .setIcon(R.drawable.ic_action_map_magnifier) + .setListener(l) + .createItem()); + + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setTitleId(showClosedNotesStringId, mapActivity) + .setIcon(R.drawable.ic_action_note_dark) + .setListener(l) + .setSelected(showClosedOsmBugsPref.get()) + .hideDivider(true) + .createItem()); + + adapter.addItem(new ContextMenuItem.ItemBuilder() + .setLayout(R.layout.card_bottom_divider) + .setClickable(false) + .createItem()); } } From 68f944da14be453cc7e0e63d984f15bc3a50df55 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 1 Feb 2018 17:43:57 +0200 Subject: [PATCH 3/4] Add functionality to zoom setting --- .../src/net/osmand/plus/OsmandSettings.java | 1 + .../net/osmand/plus/osmedit/OsmBugsLayer.java | 4 +- .../net/osmand/plus/osmedit/OsmNotesMenu.java | 46 +++++++++++++++++-- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 0bc65d695a..55fe7647a4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -1156,6 +1156,7 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference SHOW_OSM_BUGS = new BooleanPreference("show_osm_bugs", false).makeGlobal(); public final CommonPreference SHOW_CLOSED_OSM_BUGS = new BooleanPreference("show_closed_osm_bugs", false).makeGlobal(); + public final CommonPreference SHOW_OSM_BUGS_MIN_ZOOM = new IntPreference("show_osm_bugs_min_zoom", 8).makeGlobal(); public final CommonPreference MAP_INFO_CONTROLS = new StringPreference("map_info_controls", "").makeProfile(); { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java index 37670867f0..3372657550 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmBugsLayer.java @@ -50,7 +50,6 @@ import java.util.List; public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider { private static final Log log = PlatformUtil.getLog(OsmBugsLayer.class); - private final static int startZoom = 8; private final OsmEditingPlugin plugin; private OsmandMapTileView view; @@ -65,6 +64,8 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider private OsmBugsLocalUtil local; private MapLayerData> data; + private int startZoom; + public OsmBugsLayer(MapActivity activity, OsmEditingPlugin plugin) { this.activity = activity; this.plugin = plugin; @@ -116,6 +117,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider @Override public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) { + startZoom = activity.getMyApplication().getSettings().SHOW_OSM_BUGS_MIN_ZOOM.get(); if (tileBox.getZoom() >= startZoom) { // request to load data.queryNewData(tileBox); diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java index 6b548f03e5..f18f7b7f72 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java @@ -1,7 +1,9 @@ package net.osmand.plus.osmedit; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; import android.widget.ArrayAdapter; -import android.widget.Toast; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.ContextMenuItem; @@ -12,8 +14,12 @@ import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; +import java.util.Arrays; + public class OsmNotesMenu { + private static Integer[] zoomIntValues = {8, 9, 10, 11, 12, 13, 14, 15, 16}; + public static ContextMenuAdapter createListAdapter(final MapActivity mapActivity) { ContextMenuAdapter adapter = new ContextMenuAdapter(); adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu); @@ -35,17 +41,38 @@ public class OsmNotesMenu { final OsmandPreference showOsmBugsPref = settings.SHOW_OSM_BUGS; final CommonPreference showClosedOsmBugsPref = settings.SHOW_CLOSED_OSM_BUGS; + final CommonPreference showOsmBugsZoomPref = settings.SHOW_OSM_BUGS_MIN_ZOOM; + + final String[] zoomStrings = getZoomStrings(mapActivity); ContextMenuAdapter.OnRowItemClick l = new ContextMenuAdapter.OnRowItemClick() { @Override - public boolean onContextMenuClick(ArrayAdapter adapter, int itemId, - int position, boolean isChecked, int[] viewCoordinates) { + public boolean onContextMenuClick(final ArrayAdapter adapter, int itemId, + final int position, boolean isChecked, int[] viewCoordinates) { if (itemId == osmNotesStringId) { showOsmBugsPref.set(isChecked); plugin.updateLayers(mapActivity.getMapView(), mapActivity); mapActivity.refreshMap(); } else if (itemId == showZoomLevelStringId) { - Toast.makeText(mapActivity, "show zoom level", Toast.LENGTH_SHORT).show(); //todo + int checked = Arrays.asList(zoomIntValues).indexOf(showOsmBugsZoomPref.get()); + + new AlertDialog.Builder(mapActivity) + .setTitle(R.string.show_from_zoom_level) + .setSingleChoiceItems(zoomStrings, checked, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + showOsmBugsZoomPref.set(zoomIntValues[which]); + ContextMenuItem item = adapter.getItem(position); + if (item != null) { + item.setDescription(zoomStrings[which]); + adapter.notifyDataSetChanged(); + } + mapActivity.refreshMap(); + dialog.dismiss(); + } + }) + .setNegativeButton(R.string.shared_string_dismiss, null) + .show(); } else if (itemId == showClosedNotesStringId) { showClosedOsmBugsPref.set(isChecked); mapActivity.refreshMap(); @@ -64,7 +91,7 @@ public class OsmNotesMenu { adapter.addItem(new ContextMenuItem.ItemBuilder() .setTitleId(showZoomLevelStringId, mapActivity) - .setDescription("11") //todo + .setDescription(zoomStrings[Arrays.asList(zoomIntValues).indexOf(showOsmBugsZoomPref.get())]) .setLayout(R.layout.list_item_single_line_descrition_narrow) .setIcon(R.drawable.ic_action_map_magnifier) .setListener(l) @@ -83,4 +110,13 @@ public class OsmNotesMenu { .setClickable(false) .createItem()); } + + private static String[] getZoomStrings(Context context) { + String[] res = new String[zoomIntValues.length]; + for (int i = 0; i < zoomIntValues.length; i++) { + String strVal = String.valueOf(zoomIntValues[i]); + res[i] = i == 0 ? context.getString(R.string.rendering_value_default_name) + " (" + strVal + ")" : strVal; + } + return res; + } } From 7512403c10dd7679760596ed7b57628e63cce4da Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 1 Feb 2018 18:26:58 +0200 Subject: [PATCH 4/4] Add small UI fixes --- .../src/net/osmand/plus/osmedit/OsmNotesMenu.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java index f18f7b7f72..775bdd40c8 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmNotesMenu.java @@ -53,6 +53,7 @@ public class OsmNotesMenu { showOsmBugsPref.set(isChecked); plugin.updateLayers(mapActivity.getMapView(), mapActivity); mapActivity.refreshMap(); + mapActivity.getDashboard().refreshContent(true); } else if (itemId == showZoomLevelStringId) { int checked = Arrays.asList(zoomIntValues).indexOf(showOsmBugsZoomPref.get()); @@ -81,12 +82,22 @@ public class OsmNotesMenu { } }; + boolean showOsmBugs = showOsmBugsPref.get(); + boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls(); + int toggleIconColorId; + if (showOsmBugs) { + toggleIconColorId = nightMode ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light; + } else { + toggleIconColorId = nightMode ? 0 : R.color.icon_color; + } + adapter.addItem(new ContextMenuItem.ItemBuilder() .setTitleId(osmNotesStringId, mapActivity) .setDescription(mapActivity.getString(R.string.switch_osm_notes_visibility_desc)) .setIcon(R.drawable.ic_action_bug_dark) + .setColor(toggleIconColorId) .setListener(l) - .setSelected(showOsmBugsPref.get()) + .setSelected(showOsmBugs) .createItem()); adapter.addItem(new ContextMenuItem.ItemBuilder() @@ -95,6 +106,7 @@ public class OsmNotesMenu { .setLayout(R.layout.list_item_single_line_descrition_narrow) .setIcon(R.drawable.ic_action_map_magnifier) .setListener(l) + .setClickable(showOsmBugs) .createItem()); adapter.addItem(new ContextMenuItem.ItemBuilder() @@ -102,6 +114,7 @@ public class OsmNotesMenu { .setIcon(R.drawable.ic_action_note_dark) .setListener(l) .setSelected(showClosedOsmBugsPref.get()) + .setClickable(showOsmBugs) .hideDivider(true) .createItem());