Add ids for plugins

This commit is contained in:
Alex Sytnyk 2018-11-03 16:27:37 +02:00
parent a468877245
commit aabf6bfdec
8 changed files with 29 additions and 4 deletions

View file

@ -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";

View file

@ -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)

View file

@ -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() {

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)

View file

@ -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)