From aabf6bfdeca8ab39bcdbb5f8884474fc35840137 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Sat, 3 Nov 2018 16:27:37 +0200 Subject: [PATCH] Add ids for plugins --- .../src/net/osmand/plus/OsmAndCustomizationConstants.java | 8 ++++++++ .../net/osmand/plus/audionotes/AudioVideoNotesPlugin.java | 3 +++ .../osmand/plus/development/OsmandDevelopmentPlugin.java | 3 +++ OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java | 2 ++ OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java | 3 +++ .../osmand/plus/parkingpoint/ParkingPositionPlugin.java | 4 ---- .../osmand/plus/rastermaps/OsmandRasterMapsPlugin.java | 5 +++++ OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java | 5 +++++ 8 files changed, 29 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java b/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java index 1b52d90e08..524d293792 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java @@ -19,6 +19,7 @@ public interface OsmAndCustomizationConstants { String DRAWER_PLUGINS_ID = DRAWER_ITEM_ID_SCHEME + "plugins"; String DRAWER_SETTINGS_ID = DRAWER_ITEM_ID_SCHEME + "settings"; String DRAWER_HELP_ID = DRAWER_ITEM_ID_SCHEME + "help"; + String DRAWER_BUILDS_ID = DRAWER_ITEM_ID_SCHEME + "builds"; String DRAWER_DIVIDER_ID = DRAWER_ITEM_ID_SCHEME + "divider"; // Configure Map: @@ -38,6 +39,13 @@ public interface OsmAndCustomizationConstants { String GPX_FILES_ID = SHOW_ITEMS_ID_SCHEME + "gpx_files"; String MAP_MARKERS_ID = SHOW_ITEMS_ID_SCHEME + "map_markers"; String MAP_SOURCE_ID = SHOW_ITEMS_ID_SCHEME + "map_source"; + String RECORDING_LAYER = SHOW_ITEMS_ID_SCHEME + "recording_layer"; + String MAPILLARY = SHOW_ITEMS_ID_SCHEME + "mapillary"; + String OSM_NOTES = SHOW_ITEMS_ID_SCHEME + "osm_notes"; + String OVERLAY_MAP = SHOW_ITEMS_ID_SCHEME + "overlay_map"; + String UNDERLAY_MAP = SHOW_ITEMS_ID_SCHEME + "underlay_map"; + String CONTOUR_LINES = SHOW_ITEMS_ID_SCHEME + "contour_lines"; + String HILLSHADE_LAYER = SHOW_ITEMS_ID_SCHEME + "hillshade_layer"; String MAP_RENDERING_CATEGORY_ID = RENDERING_ITEMS_ID_SCHEME + "category"; String MAP_STYLE_ID = RENDERING_ITEMS_ID_SCHEME + "map_style"; diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index 8f3208daa7..bb0777836e 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -91,6 +91,8 @@ import java.util.Map; import java.util.Timer; import java.util.TimerTask; +import static net.osmand.plus.OsmAndCustomizationConstants.RECORDING_LAYER; + public class AudioVideoNotesPlugin extends OsmandPlugin { @@ -640,6 +642,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { } }; adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_recordings, app) + .setId(RECORDING_LAYER) .setSelected(SHOW_RECORDINGS.get()) .setIcon(R.drawable.ic_action_micro_dark) .setColor(SHOW_RECORDINGS.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) diff --git a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java index 3113e2cf09..aaf2ed7ff6 100644 --- a/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java +++ b/OsmAnd/src/net/osmand/plus/development/OsmandDevelopmentPlugin.java @@ -18,6 +18,8 @@ import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.plus.views.mapwidgets.TextInfoWidget; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_BUILDS_ID; + public class OsmandDevelopmentPlugin extends OsmandPlugin { private static final String ID = "osmand.development"; private OsmandApplication app; @@ -57,6 +59,7 @@ public class OsmandDevelopmentPlugin extends OsmandPlugin { public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) { if (Version.isDeveloperVersion(mapActivity.getMyApplication())) { helper.addItem(new ContextMenuItem.ItemBuilder() + .setId(DRAWER_BUILDS_ID) .setTitleId(R.string.version_settings, mapActivity) .setIcon(R.drawable.ic_action_gabout_dark) .setListener(new ContextMenuAdapter.ItemClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java index c1547333b2..ddc87dd1d0 100644 --- a/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java +++ b/OsmAnd/src/net/osmand/plus/mapillary/MapillaryPlugin.java @@ -39,6 +39,7 @@ import java.text.MessageFormat; import java.util.List; import static android.content.Intent.ACTION_VIEW; +import static net.osmand.plus.OsmAndCustomizationConstants.MAPILLARY; public class MapillaryPlugin extends OsmandPlugin { public static final String ID = "osmand.mapillary"; @@ -179,6 +180,7 @@ public class MapillaryPlugin extends OsmandPlugin { settings.SHOW_MAPILLARY.set(false); } adapter.addItem(new ContextMenuItem.ItemBuilder() + .setId(MAPILLARY) .setTitleId(R.string.mapillary, mapActivity) .setSelected(settings.SHOW_MAPILLARY.get()) .setColor(settings.SHOW_MAPILLARY.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java index cfc08ab1be..3f93a5f774 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditingPlugin.java @@ -47,6 +47,8 @@ import org.apache.commons.logging.Log; import java.util.List; +import static net.osmand.plus.OsmAndCustomizationConstants.OSM_NOTES; + public class OsmEditingPlugin extends OsmandPlugin { private static final Log LOG = PlatformUtil.getLog(OsmEditingPlugin.class); @@ -292,6 +294,7 @@ public class OsmEditingPlugin extends OsmandPlugin { @Override public void registerLayerContextMenuActions(OsmandMapTileView mapView, ContextMenuAdapter adapter, final MapActivity mapActivity) { adapter.addItem(new ContextMenuItem.ItemBuilder() + .setId(OSM_NOTES) .setTitleId(R.string.layer_osm_bugs, mapActivity) .setSelected(settings.SHOW_OSM_BUGS.get()) .setIcon(R.drawable.ic_action_bug_dark) diff --git a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java index 7cc68c2652..afa1d1aea6 100644 --- a/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java +++ b/OsmAnd/src/net/osmand/plus/parkingpoint/ParkingPositionPlugin.java @@ -420,10 +420,6 @@ public class ParkingPositionPlugin extends OsmandPlugin { } clearParkingPosition(); } - - @Override - public void registerOptionsMenuItems(final MapActivity mapActivity, ContextMenuAdapter helper) { - } /** * @return the control to be added on a MapInfoLayer diff --git a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java index 53d04cef51..6bb17ed5b2 100644 --- a/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java +++ b/OsmAnd/src/net/osmand/plus/rastermaps/OsmandRasterMapsPlugin.java @@ -46,6 +46,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import static net.osmand.plus.OsmAndCustomizationConstants.OVERLAY_MAP; +import static net.osmand.plus.OsmAndCustomizationConstants.UNDERLAY_MAP; + public class OsmandRasterMapsPlugin extends OsmandPlugin { public static final String ID = "osmand.rastermaps"; @@ -323,6 +326,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { boolean hasOverlayDescription = overlayMapDescr != null; overlayMapDescr = hasOverlayDescription ? overlayMapDescr : mapActivity.getString(R.string.shared_string_none); adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_overlay, mapActivity) + .setId(OVERLAY_MAP) .setDescription(overlayMapDescr) .setSelected(hasOverlayDescription) .setColor(hasOverlayDescription ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) @@ -335,6 +339,7 @@ public class OsmandRasterMapsPlugin extends OsmandPlugin { boolean hasUnderlayDescription = underlayMapDescr != null; underlayMapDescr = hasUnderlayDescription ? underlayMapDescr : mapActivity.getString(R.string.shared_string_none); adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.layer_underlay, mapActivity) + .setId(UNDERLAY_MAP) .setDescription(underlayMapDescr) .setSelected(hasUnderlayDescription) .setColor(hasUnderlayDescription ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java b/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java index 66ee81ffcd..4e23944e16 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/SRTMPlugin.java @@ -29,6 +29,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static net.osmand.plus.OsmAndCustomizationConstants.CONTOUR_LINES; +import static net.osmand.plus.OsmAndCustomizationConstants.HILLSHADE_LAYER; + public class SRTMPlugin extends OsmandPlugin { public static final String ID = "osmand.srtm"; @@ -217,6 +220,7 @@ public class SRTMPlugin extends OsmandPlugin { } String descr = getPrefDescription(app, contourLinesProp, pref); adapter.addItem(new ContextMenuItem.ItemBuilder() + .setId(CONTOUR_LINES) .setTitleId(R.string.srtm_plugin_name, mapActivity) .setSelected(contourLinesSelected) .setIcon(R.drawable.ic_plugin_srtm) @@ -227,6 +231,7 @@ public class SRTMPlugin extends OsmandPlugin { .setListener(listener).createItem()); } adapter.addItem(new ContextMenuItem.ItemBuilder() + .setId(HILLSHADE_LAYER) .setTitleId(R.string.layer_hillshade, mapActivity) .setSelected(HILLSHADE.get()) .setColor(HILLSHADE.get() ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)