Extract constants to the OsmAndCustomizationConstants

This commit is contained in:
Alex Sytnyk 2018-11-01 12:19:42 +02:00
parent 36d3298325
commit f24d6aadac
4 changed files with 104 additions and 52 deletions

View file

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

View file

@ -79,6 +79,20 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; 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; import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
public class MapActivityActions implements DialogProvider { 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 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 // make static
private static Bundle dialogBundle = new Bundle(); private static Bundle dialogBundle = new Bundle();

View file

@ -68,6 +68,25 @@ import java.util.Map;
import gnu.trove.list.array.TIntArrayList; 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_DENSITY_ATTR;
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_ATTR; import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_ATTR;
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_LINES_SCHEME_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 COLOR_ATTR = "color";
public static final String ROAD_STYLE_ATTR = "roadStyle"; 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 hikingRouteOSMCValue;
private int selectedLanguageIndex; private int selectedLanguageIndex;
private boolean transliterateNames; private boolean transliterateNames;

View file

@ -61,6 +61,15 @@ import java.util.List;
import gnu.trove.list.array.TIntArrayList; 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 { public class MapControlsLayer extends OsmandMapLayer {
private static final int TIMEOUT_TO_SHOW_BUTTONS = 7000; 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_NAVIGATION_FAB_PERMISSION = 201;
private static final int REQUEST_LOCATION_FOR_ADD_DESTINATION_PERMISSION = 202; 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) { public MapHudButton createHudButton(View iv, int resId, String id) {
MapHudButton mc = new MapHudButton(); MapHudButton mc = new MapHudButton();
mc.iv = iv; mc.iv = iv;