diff --git a/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java b/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java new file mode 100644 index 0000000000..720e4e4c16 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/OsmAndCustomizationConstants.java @@ -0,0 +1,62 @@ +package net.osmand.plus; + +public interface OsmAndCustomizationConstants { + + // Navigation Drawer: + + String DRAWER_ITEM_ID_SCHEME = "drawer.action."; + String DRAWER_DASHBOARD_ID = DRAWER_ITEM_ID_SCHEME + "dashboard"; + String DRAWER_MAP_MARKERS_ID = DRAWER_ITEM_ID_SCHEME + "map_markers"; + String DRAWER_MY_PLACES_ID = DRAWER_ITEM_ID_SCHEME + "my_places"; + String DRAWER_SEARCH_ID = DRAWER_ITEM_ID_SCHEME + "search"; + String DRAWER_DIRECTIONS_ID = DRAWER_ITEM_ID_SCHEME + "directions"; + String DRAWER_CONFIGURE_MAP_ID = DRAWER_ITEM_ID_SCHEME + "configure_map"; + String DRAWER_DOWNLOAD_MAPS_ID = DRAWER_ITEM_ID_SCHEME + "download_maps"; + String DRAWER_OSMAND_LIVE_ID = DRAWER_ITEM_ID_SCHEME + "osmand_live"; + String DRAWER_TRAVEL_GUIDES_ID = DRAWER_ITEM_ID_SCHEME + "travel_guides"; + String DRAWER_MEASURE_DISTANCE_ID = DRAWER_ITEM_ID_SCHEME + "measure_distance"; + String DRAWER_CONFIGURE_SCREEN_ID = DRAWER_ITEM_ID_SCHEME + "configure_screen"; + 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"; + + // Configure Map: + + String ITEM_ID_SCHEME = "map.configure."; + String SHOW_ITEMS_ID_SCHEME = ITEM_ID_SCHEME + "show."; + String RENDERING_ITEMS_ID_SCHEME = ITEM_ID_SCHEME + "rendering."; + String CUSTOM_RENDERING_ITEMS_ID_SCHEME = RENDERING_ITEMS_ID_SCHEME + "custom."; + + String APP_PROFILES_ID = ITEM_ID_SCHEME + "app_profiles"; + + String FAVORITES_ID = SHOW_ITEMS_ID_SCHEME + "favorites"; + String POI_OVERLAY_ID = SHOW_ITEMS_ID_SCHEME + "poi_overlay"; + String POI_OVERLAY_LABELS_ID = SHOW_ITEMS_ID_SCHEME + "poi_overlay_labels"; + String TRANSPORT_ID = SHOW_ITEMS_ID_SCHEME + "transport"; + 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 MAP_STYLE_ID = RENDERING_ITEMS_ID_SCHEME + "map_style"; + String MAP_MODE_ID = RENDERING_ITEMS_ID_SCHEME + "map_mode"; + String MAP_MAGNIFIER_ID = RENDERING_ITEMS_ID_SCHEME + "map_marnifier"; + String ROAD_STYLE_ID = RENDERING_ITEMS_ID_SCHEME + "road_style"; + String TEXT_SIZE_ID = RENDERING_ITEMS_ID_SCHEME + "text_size"; + String MAP_LANGUAGE_ID = RENDERING_ITEMS_ID_SCHEME + "map_language"; + String TRANSPORT_RENDERING_ID = RENDERING_ITEMS_ID_SCHEME + "transport"; + String DETAILS_ID = RENDERING_ITEMS_ID_SCHEME + "details"; + String HIDE_ID = RENDERING_ITEMS_ID_SCHEME + "hide"; + String ROUTES_ID = RENDERING_ITEMS_ID_SCHEME + "routes"; + + // Map Controls: + + String HUD_BTN_ID_SCHEME = "map.view."; + String LAYERS_HUD_ID = HUD_BTN_ID_SCHEME + "layers"; + String COMPASS_HUD_ID = HUD_BTN_ID_SCHEME + "compass"; + String QUICK_SEARCH_HUD_ID = HUD_BTN_ID_SCHEME + "quick_search"; + String BACK_TO_LOC_HUD_ID = HUD_BTN_ID_SCHEME + "back_to_loc"; + String MENU_HUD_ID = HUD_BTN_ID_SCHEME + "menu"; + String ROUTE_PLANNING_HUD_ID = HUD_BTN_ID_SCHEME + "route_planning"; + String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id"; + String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out"; +} diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 798172b8c2..fb253f6d11 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -79,6 +79,20 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DIRECTIONS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_DOWNLOAD_MAPS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_HELP_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_MAP_MARKERS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_MEASURE_DISTANCE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_MY_PLACES_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_OSMAND_LIVE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_PLUGINS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SEARCH_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.DRAWER_TRAVEL_GUIDES_ID; import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX; public class MapActivityActions implements DialogProvider { @@ -106,22 +120,6 @@ public class MapActivityActions implements DialogProvider { private static final int DIALOG_SAVE_DIRECTIONS = 106; - private static final String DRAWER_ITEM_ID_SCHEME = "drawer.action."; - private static final String DRAWER_DASHBOARD_ID = DRAWER_ITEM_ID_SCHEME + "dashboard"; - private static final String DRAWER_MAP_MARKERS_ID = DRAWER_ITEM_ID_SCHEME + "map_markers"; - private static final String DRAWER_MY_PLACES_ID = DRAWER_ITEM_ID_SCHEME + "my_places"; - private static final String DRAWER_SEARCH_ID = DRAWER_ITEM_ID_SCHEME + "search"; - private static final String DRAWER_DIRECTIONS_ID = DRAWER_ITEM_ID_SCHEME + "directions"; - private static final String DRAWER_CONFIGURE_MAP_ID = DRAWER_ITEM_ID_SCHEME + "configure_map"; - private static final String DRAWER_DOWNLOAD_MAPS_ID = DRAWER_ITEM_ID_SCHEME + "download_maps"; - private static final String DRAWER_OSMAND_LIVE_ID = DRAWER_ITEM_ID_SCHEME + "osmand_live"; - private static final String DRAWER_TRAVEL_GUIDES_ID = DRAWER_ITEM_ID_SCHEME + "travel_guides"; - private static final String DRAWER_MEASURE_DISTANCE_ID = DRAWER_ITEM_ID_SCHEME + "measure_distance"; - private static final String DRAWER_CONFIGURE_SCREEN_ID = DRAWER_ITEM_ID_SCHEME + "configure_screen"; - private static final String DRAWER_PLUGINS_ID = DRAWER_ITEM_ID_SCHEME + "plugins"; - private static final String DRAWER_SETTINGS_ID = DRAWER_ITEM_ID_SCHEME + "settings"; - private static final String DRAWER_HELP_ID = DRAWER_ITEM_ID_SCHEME + "help"; - // make static private static Bundle dialogBundle = new Bundle(); diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 8a6aaf7d09..d5dd460e68 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -68,6 +68,25 @@ import java.util.Map; import gnu.trove.list.array.TIntArrayList; +import static net.osmand.plus.OsmAndCustomizationConstants.APP_PROFILES_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.CUSTOM_RENDERING_ITEMS_ID_SCHEME; +import static net.osmand.plus.OsmAndCustomizationConstants.DETAILS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.FAVORITES_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.GPX_FILES_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.HIDE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_LANGUAGE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_MAGNIFIER_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_MARKERS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_MODE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_SOURCE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MAP_STYLE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.POI_OVERLAY_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.POI_OVERLAY_LABELS_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.ROAD_STYLE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.ROUTES_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.TEXT_SIZE_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.TRANSPORT_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.TRANSPORT_RENDERING_ID; import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_DENSITY_ATTR; import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_ATTR; import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_SCHEME_ATTR; @@ -81,32 +100,6 @@ public class ConfigureMapMenu { public static final String COLOR_ATTR = "color"; public static final String ROAD_STYLE_ATTR = "roadStyle"; - private static final String ITEM_ID_SCHEME = "map.configure."; - private static final String SHOW_ITEMS_ID_SCHEME = ITEM_ID_SCHEME + "show."; - private static final String RENDERING_ITEMS_ID_SCHEME = ITEM_ID_SCHEME + "rendering."; - private static final String CUSTOM_RENDERING_ITEMS_ID_SCHEME = RENDERING_ITEMS_ID_SCHEME + "custom."; - - private static final String APP_PROFILES_ID = ITEM_ID_SCHEME + "app_profiles"; - - private static final String FAVORITES_ID = SHOW_ITEMS_ID_SCHEME + "favorites"; - private static final String POI_OVERLAY_ID = SHOW_ITEMS_ID_SCHEME + "poi_overlay"; - private static final String POI_OVERLAY_LABELS_ID = SHOW_ITEMS_ID_SCHEME + "poi_overlay_labels"; - private static final String TRANSPORT_ID = SHOW_ITEMS_ID_SCHEME + "transport"; - private static final String GPX_FILES_ID = SHOW_ITEMS_ID_SCHEME + "gpx_files"; - private static final String MAP_MARKERS_ID = SHOW_ITEMS_ID_SCHEME + "map_markers"; - private static final String MAP_SOURCE_ID = SHOW_ITEMS_ID_SCHEME + "map_source"; - - private static final String MAP_STYLE_ID = RENDERING_ITEMS_ID_SCHEME + "map_style"; - private static final String MAP_MODE_ID = RENDERING_ITEMS_ID_SCHEME + "map_mode"; - private static final String MAP_MAGNIFIER_ID = RENDERING_ITEMS_ID_SCHEME + "map_marnifier"; - private static final String ROAD_STYLE_ID = RENDERING_ITEMS_ID_SCHEME + "road_style"; - private static final String TEXT_SIZE_ID = RENDERING_ITEMS_ID_SCHEME + "text_size"; - private static final String MAP_LANGUAGE_ID = RENDERING_ITEMS_ID_SCHEME + "map_language"; - private static final String TRANSPORT_RENDERING_ID = RENDERING_ITEMS_ID_SCHEME + "transport"; - private static final String DETAILS_ID = RENDERING_ITEMS_ID_SCHEME + "details"; - private static final String HIDE_ID = RENDERING_ITEMS_ID_SCHEME + "hide"; - private static final String ROUTES_ID = RENDERING_ITEMS_ID_SCHEME + "routes"; - private int hikingRouteOSMCValue; private int selectedLanguageIndex; private boolean transliterateNames; diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index ef7cf22e4f..dd12390aeb 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -61,6 +61,15 @@ import java.util.List; import gnu.trove.list.array.TIntArrayList; +import static net.osmand.plus.OsmAndCustomizationConstants.BACK_TO_LOC_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.COMPASS_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.LAYERS_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.MENU_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.QUICK_SEARCH_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.ROUTE_PLANNING_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.ZOOM_IN_HUD_ID; +import static net.osmand.plus.OsmAndCustomizationConstants.ZOOM_OUT_HUD_ID; + public class MapControlsLayer extends OsmandMapLayer { private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000; @@ -68,16 +77,6 @@ public class MapControlsLayer extends OsmandMapLayer { private static final int REQUEST_LOCATION_FOR_NAVIGATION_FAB_PERMISSION = 201; private static final int REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION = 202; - private static final String HUD_BTN_ID_SCHEME = "map.view."; - private static final String LAYERS_HUD_ID = HUD_BTN_ID_SCHEME + "layers"; - private static final String COMPASS_HUD_ID = HUD_BTN_ID_SCHEME + "compass"; - private static final String QUICK_SEARCH_HUD_ID = HUD_BTN_ID_SCHEME + "quick_search"; - private static final String BACK_TO_LOC_HUD_ID = HUD_BTN_ID_SCHEME + "back_to_loc"; - private static final String MENU_HUD_ID = HUD_BTN_ID_SCHEME + "menu"; - private static final String ROUTE_PLANNING_HUD_ID = HUD_BTN_ID_SCHEME + "route_planning"; - private static final String ZOOM_IN_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_id"; - private static final String ZOOM_OUT_HUD_ID = HUD_BTN_ID_SCHEME + "zoom_out"; - public MapHudButton createHudButton(View iv, int resId, String id) { MapHudButton mc = new MapHudButton(); mc.iv = iv;