Add ids to the nav drawer, configure map and map controls
This commit is contained in:
parent
5c37af174d
commit
36d3298325
4 changed files with 121 additions and 21 deletions
|
@ -38,6 +38,7 @@ public class ContextMenuItem {
|
|||
private final boolean hideDivider;
|
||||
private final int minHeight;
|
||||
private final int tag;
|
||||
private final String id;
|
||||
|
||||
private ContextMenuItem(@StringRes int titleId,
|
||||
String title,
|
||||
|
@ -59,7 +60,8 @@ public class ContextMenuItem {
|
|||
ContextMenuAdapter.ProgressListener progressListener,
|
||||
boolean hideDivider,
|
||||
int minHeight,
|
||||
int tag) {
|
||||
int tag,
|
||||
String id) {
|
||||
this.titleId = titleId;
|
||||
this.title = title;
|
||||
this.mIcon = icon;
|
||||
|
@ -81,6 +83,7 @@ public class ContextMenuItem {
|
|||
this.hideDivider = hideDivider;
|
||||
this.minHeight = minHeight;
|
||||
this.tag = tag;
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@StringRes
|
||||
|
@ -218,6 +221,10 @@ public class ContextMenuItem {
|
|||
return tag;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static ItemBuilder createBuilder(String title) {
|
||||
return new ItemBuilder().setTitle(title);
|
||||
}
|
||||
|
@ -249,6 +256,7 @@ public class ContextMenuItem {
|
|||
private boolean mHideDivider;
|
||||
private int mMinHeight;
|
||||
private int mTag;
|
||||
private String mId;
|
||||
|
||||
public ItemBuilder setTitleId(@StringRes int titleId, @Nullable Context context) {
|
||||
this.mTitleId = titleId;
|
||||
|
@ -363,11 +371,16 @@ public class ContextMenuItem {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder setId(String id) {
|
||||
this.mId = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ContextMenuItem createItem() {
|
||||
return new ContextMenuItem(mTitleId, mTitle, mIcon, mColorRes, mSecondaryIcon,
|
||||
mSelected, mProgress, mLayout, mLoading, mIsCategory, mIsClickable, mSkipPaintingWithoutColor,
|
||||
mPosition, mOrder, mDescription, mItemClickListener, mIntegerListener, mProgressListener,
|
||||
mHideDivider, mMinHeight, mTag);
|
||||
mHideDivider, mMinHeight, mTag, mId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,6 +105,23 @@ public class MapActivityActions implements DialogProvider {
|
|||
private static final int DIALOG_RELOAD_TITLE = 103;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -654,6 +671,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
ContextMenuAdapter optionsMenuHelper = new ContextMenuAdapter();
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.home, mapActivity)
|
||||
.setId(DRAWER_DASHBOARD_ID)
|
||||
.setIcon(R.drawable.map_dashboard)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -667,6 +685,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.map_markers, mapActivity)
|
||||
.setId(DRAWER_MAP_MARKERS_ID)
|
||||
.setIcon(R.drawable.ic_action_flag_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -679,6 +698,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_my_places, mapActivity)
|
||||
.setId(DRAWER_MY_PLACES_ID)
|
||||
.setIcon(R.drawable.ic_action_fav_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -693,6 +713,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.search_button, mapActivity)
|
||||
.setId(DRAWER_SEARCH_ID)
|
||||
.setIcon(R.drawable.ic_action_search_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -705,6 +726,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.get_directions, mapActivity)
|
||||
.setId(DRAWER_DIRECTIONS_ID)
|
||||
.setIcon(R.drawable.ic_action_gdirections_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -732,6 +754,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
*/
|
||||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.configure_map, mapActivity)
|
||||
.setId(DRAWER_CONFIGURE_MAP_ID)
|
||||
.setIcon(R.drawable.ic_action_layers_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -751,6 +774,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.welmode_download_maps, null)
|
||||
.setId(DRAWER_DOWNLOAD_MAPS_ID)
|
||||
.setTitle(d).setIcon(R.drawable.ic_type_archive)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -766,6 +790,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
|
||||
if (Version.isGooglePlayEnabled(app) || Version.isDeveloperVersion(app)) {
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.osm_live, mapActivity)
|
||||
.setId(DRAWER_OSMAND_LIVE_ID)
|
||||
.setIcon(R.drawable.ic_action_osm_live)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -780,6 +805,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitle(getString(R.string.shared_string_travel_guides) + " (Beta)")
|
||||
.setId(DRAWER_TRAVEL_GUIDES_ID)
|
||||
.setIcon(R.drawable.ic_action_travel)
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
|
@ -799,6 +825,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.measurement_tool, mapActivity)
|
||||
.setId(DRAWER_MEASURE_DISTANCE_ID)
|
||||
.setIcon(R.drawable.ic_action_ruler)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -811,6 +838,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
app.getAidlApi().registerNavDrawerItems(mapActivity, optionsMenuHelper);
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.layer_map_appearance, mapActivity)
|
||||
.setId(DRAWER_CONFIGURE_SCREEN_ID)
|
||||
.setIcon(R.drawable.ic_configure_screen_dark)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -823,6 +851,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.prefs_plugins, mapActivity)
|
||||
.setId(DRAWER_PLUGINS_ID)
|
||||
.setIcon(R.drawable.ic_extension_dark)
|
||||
.setListener(new ItemClickListener() {
|
||||
@Override
|
||||
|
@ -837,6 +866,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}).createItem());
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_settings, mapActivity)
|
||||
.setId(DRAWER_SETTINGS_ID)
|
||||
.setIcon(R.drawable.ic_action_settings)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -864,6 +894,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
*/
|
||||
|
||||
optionsMenuHelper.addItem(new ItemBuilder().setTitleId(R.string.shared_string_help, mapActivity)
|
||||
.setId(DRAWER_HELP_ID)
|
||||
.setIcon(R.drawable.ic_action_help)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -80,6 +80,33 @@ public class ConfigureMapMenu {
|
|||
public static final String CURRENT_TRACK_WIDTH_ATTR = "currentTrackWidth";
|
||||
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;
|
||||
|
@ -93,6 +120,7 @@ public class ConfigureMapMenu {
|
|||
ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||
adapter.setDefaultLayoutId(R.layout.list_item_icon_and_menu);
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(APP_PROFILES_ID)
|
||||
.setTitleId(R.string.app_modes_choose, ma)
|
||||
.setLayout(R.layout.mode_toggles).createItem());
|
||||
adapter.setChangeAppModeListener(new OnClickListener() {
|
||||
|
@ -256,6 +284,7 @@ public class ConfigureMapMenu {
|
|||
// String appMode = " [" + settings.getApplicationMode().toHumanString(view.getApplication()) +"] ";
|
||||
boolean selected = settings.SHOW_FAVORITES.get();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(FAVORITES_ID)
|
||||
.setTitleId(R.string.shared_string_favorites, activity)
|
||||
.setSelected(settings.SHOW_FAVORITES.get())
|
||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||
|
@ -263,6 +292,7 @@ public class ConfigureMapMenu {
|
|||
.setListener(l).createItem());
|
||||
selected = app.getPoiFilters().isShowingAnyPoi();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(POI_OVERLAY_ID)
|
||||
.setTitleId(R.string.layer_poi, activity)
|
||||
.setSelected(selected)
|
||||
.setDescription(app.getPoiFilters().getSelectedPoiFiltersName())
|
||||
|
@ -272,6 +302,7 @@ public class ConfigureMapMenu {
|
|||
.setListener(l).createItem());
|
||||
selected = settings.SHOW_POI_LABEL.get();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(POI_OVERLAY_LABELS_ID)
|
||||
.setTitleId(R.string.layer_amenity_label, activity)
|
||||
.setSelected(settings.SHOW_POI_LABEL.get())
|
||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||
|
@ -308,6 +339,7 @@ public class ConfigureMapMenu {
|
|||
}
|
||||
final boolean transportSelected = selected;
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(TRANSPORT_ID)
|
||||
.setTitleId(R.string.rendering_category_transport, activity)
|
||||
.setIcon(R.drawable.ic_action_bus_dark)
|
||||
.setSecondaryIcon(R.drawable.ic_action_additional_option)
|
||||
|
@ -459,6 +491,7 @@ public class ConfigureMapMenu {
|
|||
}).createItem());
|
||||
selected = app.getSelectedGpxHelper().isShowingAnyGpxFiles();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(GPX_FILES_ID)
|
||||
.setTitleId(R.string.layer_gpx_layer, activity)
|
||||
.setSelected(app.getSelectedGpxHelper().isShowingAnyGpxFiles())
|
||||
.setDescription(app.getSelectedGpxHelper().getGpxDescription())
|
||||
|
@ -469,6 +502,7 @@ public class ConfigureMapMenu {
|
|||
|
||||
selected = settings.SHOW_MAP_MARKERS.get();
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(MAP_MARKERS_ID)
|
||||
.setTitleId(R.string.map_markers, activity)
|
||||
.setSelected(selected)
|
||||
.setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID)
|
||||
|
@ -476,6 +510,7 @@ public class ConfigureMapMenu {
|
|||
.setListener(l).createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(MAP_SOURCE_ID)
|
||||
.setTitleId(R.string.layer_map, activity)
|
||||
.setIcon(R.drawable.ic_world_globe_dark)
|
||||
.setDescription(settings.MAP_ONLINE_DATA.get() ? settings.MAP_TILE_SOURCES.get() : null)
|
||||
|
@ -503,6 +538,7 @@ public class ConfigureMapMenu {
|
|||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_widget_map_rendering, activity)
|
||||
.setCategory(true).setLayout(R.layout.list_group_title_with_switch).createItem());
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_widget_renderer, activity)
|
||||
.setId(MAP_STYLE_ID)
|
||||
.setDescription(getRenderDescr(activity)).setLayout(R.layout.list_item_single_line_descrition_narrow)
|
||||
.setIcon(R.drawable.ic_map).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -515,6 +551,7 @@ public class ConfigureMapMenu {
|
|||
}).createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_mode, activity)
|
||||
.setId(MAP_MODE_ID)
|
||||
.setDescription(getDayNightDescr(activity)).setLayout(R.layout.list_item_single_line_descrition_narrow)
|
||||
.setIcon(getDayNightIcon(activity)).setListener(new ItemClickListener() {
|
||||
@Override
|
||||
|
@ -547,6 +584,7 @@ public class ConfigureMapMenu {
|
|||
}).createItem());
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(MAP_MAGNIFIER_ID)
|
||||
.setTitleId(R.string.map_magnifier, activity)
|
||||
.setDescription(
|
||||
String.format(Locale.UK, "%.0f",
|
||||
|
@ -608,12 +646,13 @@ public class ConfigureMapMenu {
|
|||
}).createItem());
|
||||
|
||||
ContextMenuItem props;
|
||||
props = createRenderingProperty(customRules, adapter, activity, R.drawable.ic_action_intersection, ROAD_STYLE_ATTR);
|
||||
props = createRenderingProperty(customRules, adapter, activity, R.drawable.ic_action_intersection, ROAD_STYLE_ATTR, ROAD_STYLE_ID);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.text_size, activity)
|
||||
.setId(TEXT_SIZE_ID)
|
||||
.setDescription(getScale(activity)).setLayout(R.layout.list_item_single_line_descrition_narrow)
|
||||
.setIcon(R.drawable.ic_action_map_text_size).setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
@Override
|
||||
|
@ -652,6 +691,7 @@ public class ConfigureMapMenu {
|
|||
localeDescr = localeDescr == null || localeDescr.equals("") ? activity.getString(R.string.local_map_names)
|
||||
: localeDescr;
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.map_locale, activity)
|
||||
.setId(MAP_LANGUAGE_ID)
|
||||
.setDescription(localeDescr).setLayout(R.layout.list_item_single_line_descrition_narrow)
|
||||
.setIcon(R.drawable.ic_action_map_language)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
@ -742,17 +782,17 @@ public class ConfigureMapMenu {
|
|||
}).createItem());
|
||||
|
||||
props = createProperties(customRules, null, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark,
|
||||
"transport", null, adapter, activity, true);
|
||||
"transport", null, adapter, activity, true, TRANSPORT_RENDERING_ID);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
props = createProperties(customRules, null, R.string.rendering_category_details, R.drawable.ic_action_layers_dark,
|
||||
"details", null, adapter, activity, true);
|
||||
"details", null, adapter, activity, true, DETAILS_ID);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
props = createProperties(customRules, null, R.string.rendering_category_hide, R.drawable.ic_action_hide,
|
||||
"hide", null, adapter, activity, true);
|
||||
"hide", null, adapter, activity, true, HIDE_ID);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
|
@ -764,7 +804,7 @@ public class ConfigureMapMenu {
|
|||
}
|
||||
}
|
||||
props = createProperties(customRules, customRulesIncluded, R.string.rendering_category_routes, R.drawable.ic_action_map_routes,
|
||||
"routes", null, adapter, activity, true);
|
||||
"routes", null, adapter, activity, true, ROUTES_ID);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
|
@ -826,7 +866,8 @@ public class ConfigureMapMenu {
|
|||
final ListStringPreference defaultSettings,
|
||||
final ContextMenuAdapter adapter,
|
||||
final MapActivity activity,
|
||||
final boolean useDescription) {
|
||||
final boolean useDescription,
|
||||
final String id) {
|
||||
|
||||
final List<RenderingRuleProperty> ps = new ArrayList<>();
|
||||
final List<OsmandSettings.CommonPreference<Boolean>> prefs = new ArrayList<>();
|
||||
|
@ -882,6 +923,7 @@ public class ConfigureMapMenu {
|
|||
|
||||
};
|
||||
ContextMenuItem.ItemBuilder builder = new ContextMenuItem.ItemBuilder().setTitleId(strId, activity)
|
||||
.setId(id)
|
||||
.setIcon(icon).setListener(clickListener);
|
||||
boolean selected = false;
|
||||
for (OsmandSettings.CommonPreference<Boolean> p : prefs) {
|
||||
|
@ -1137,7 +1179,7 @@ public class ConfigureMapMenu {
|
|||
List<RenderingRuleProperty> customRules) {
|
||||
for (final RenderingRuleProperty p : customRules) {
|
||||
if (isPropertyAccepted(p)) {
|
||||
adapter.addItem(createRenderingProperty(adapter, activity, 0, p));
|
||||
adapter.addItem(createRenderingProperty(adapter, activity, 0, p, CUSTOM_RENDERING_ITEMS_ID_SCHEME + p.getName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1154,17 +1196,17 @@ public class ConfigureMapMenu {
|
|||
|
||||
private ContextMenuItem createRenderingProperty(final List<RenderingRuleProperty> customRules,
|
||||
final ContextMenuAdapter adapter, final MapActivity activity,
|
||||
@DrawableRes final int icon, final String attrName) {
|
||||
@DrawableRes final int icon, final String attrName, String id) {
|
||||
for (final RenderingRuleProperty p : customRules) {
|
||||
if (p.getAttrName().equals(attrName)) {
|
||||
return createRenderingProperty(adapter, activity, icon, p);
|
||||
return createRenderingProperty(adapter, activity, icon, p, id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ContextMenuItem createRenderingProperty(final ContextMenuAdapter adapter, final MapActivity activity,
|
||||
@DrawableRes final int icon, final RenderingRuleProperty p) {
|
||||
@DrawableRes final int icon, final RenderingRuleProperty p, final String id) {
|
||||
final OsmandMapTileView view = activity.getMapView();
|
||||
String propertyName = SettingsActivity.getStringPropertyName(view.getContext(), p.getAttrName(),
|
||||
p.getName());
|
||||
|
@ -1175,6 +1217,7 @@ public class ConfigureMapMenu {
|
|||
final OsmandSettings.CommonPreference<Boolean> pref = view.getApplication().getSettings()
|
||||
.getCustomRenderBooleanProperty(p.getAttrName());
|
||||
return ContextMenuItem.createBuilder(propertyName)
|
||||
.setId(id)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
|
@ -1197,6 +1240,7 @@ public class ConfigureMapMenu {
|
|||
p.getDefaultValueDescription());
|
||||
}
|
||||
ContextMenuItem.ItemBuilder builder = ContextMenuItem.createBuilder(propertyName)
|
||||
.setId(id)
|
||||
.setListener(new ContextMenuAdapter.ItemClickListener() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -68,10 +68,21 @@ 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;
|
||||
|
||||
public MapHudButton createHudButton(View iv, int resId) {
|
||||
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;
|
||||
mc.resId = resId;
|
||||
mc.id = id;
|
||||
return mc;
|
||||
}
|
||||
|
||||
|
@ -246,7 +257,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
private void initTopControls() {
|
||||
View configureMap = mapActivity.findViewById(R.id.map_layers_button);
|
||||
layersHud = createHudButton(configureMap, R.drawable.map_world_globe_dark)
|
||||
layersHud = createHudButton(configureMap, R.drawable.map_world_globe_dark, LAYERS_HUD_ID)
|
||||
.setIconColorId(R.color.on_map_icon_color, 0)
|
||||
.setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
|
||||
controls.add(layersHud);
|
||||
|
@ -259,7 +270,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
});
|
||||
|
||||
View compass = mapActivity.findViewById(R.id.map_compass_button);
|
||||
compassHud = createHudButton(compass, R.drawable.map_compass).setIconColorId(0).
|
||||
compassHud = createHudButton(compass, R.drawable.map_compass, COMPASS_HUD_ID).setIconColorId(0).
|
||||
setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
|
||||
compassHud.compass = true;
|
||||
controls.add(compassHud);
|
||||
|
@ -271,7 +282,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
});
|
||||
|
||||
View search = mapActivity.findViewById(R.id.map_search_button);
|
||||
quickSearchHud = createHudButton(search, R.drawable.map_search_dark)
|
||||
quickSearchHud = createHudButton(search, R.drawable.map_search_dark, QUICK_SEARCH_HUD_ID)
|
||||
.setIconsId(R.drawable.map_search_dark, R.drawable.map_search_night)
|
||||
.setIconColorId(0)
|
||||
.setBg(R.drawable.btn_inset_circle_trans, R.drawable.btn_inset_circle_night);
|
||||
|
@ -389,7 +400,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
private void initControls() {
|
||||
View backToLocation = mapActivity.findViewById(R.id.map_my_location_button);
|
||||
backToLocationControl = createHudButton(backToLocation, R.drawable.map_my_location)
|
||||
backToLocationControl = createHudButton(backToLocation, R.drawable.map_my_location, BACK_TO_LOC_HUD_ID)
|
||||
.setBg(R.drawable.btn_circle_blue);
|
||||
controls.add(backToLocationControl);
|
||||
|
||||
|
@ -409,7 +420,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
|
||||
final boolean dash = settings.SHOW_DASHBOARD_ON_MAP_SCREEN.get();
|
||||
menuControl = createHudButton(backToMenuButton,
|
||||
!dash ? R.drawable.map_drawer : R.drawable.map_dashboard).setBg(
|
||||
!dash ? R.drawable.map_drawer : R.drawable.map_dashboard, MENU_HUD_ID).setBg(
|
||||
R.drawable.btn_round, R.drawable.btn_round_night);
|
||||
controls.add(menuControl);
|
||||
backToMenuButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -426,7 +437,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
zoomText = (TextView) mapActivity.findViewById(R.id.map_app_mode_text);
|
||||
|
||||
View routePlanButton = mapActivity.findViewById(R.id.map_route_info_button);
|
||||
routePlanningBtn = createHudButton(routePlanButton, R.drawable.map_directions).setBg(
|
||||
routePlanningBtn = createHudButton(routePlanButton, R.drawable.map_directions, ROUTE_PLANNING_HUD_ID).setBg(
|
||||
R.drawable.btn_round, R.drawable.btn_round_night);
|
||||
controls.add(routePlanningBtn);
|
||||
routePlanButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -634,7 +645,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
private void initZooms() {
|
||||
final OsmandMapTileView view = mapActivity.getMapView();
|
||||
View zoomInButton = mapActivity.findViewById(R.id.map_zoom_in_button);
|
||||
mapZoomIn = createHudButton(zoomInButton, R.drawable.map_zoom_in).
|
||||
mapZoomIn = createHudButton(zoomInButton, R.drawable.map_zoom_in, ZOOM_IN_HUD_ID).
|
||||
setIconsId(R.drawable.map_zoom_in, R.drawable.map_zoom_in_night).setRoundTransparent();
|
||||
controls.add(mapZoomIn);
|
||||
zoomInButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -653,7 +664,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
final View.OnLongClickListener listener = MapControlsLayer.getOnClickMagnifierListener(view);
|
||||
zoomInButton.setOnLongClickListener(listener);
|
||||
View zoomOutButton = mapActivity.findViewById(R.id.map_zoom_out_button);
|
||||
mapZoomOut = createHudButton(zoomOutButton, R.drawable.map_zoom_out).
|
||||
mapZoomOut = createHudButton(zoomOutButton, R.drawable.map_zoom_out, ZOOM_OUT_HUD_ID).
|
||||
setIconsId(R.drawable.map_zoom_out, R.drawable.map_zoom_out_night).setRoundTransparent();
|
||||
controls.add(mapZoomOut);
|
||||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -1035,6 +1046,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
int resDarkId;
|
||||
int resClrLight = R.color.icon_color;
|
||||
int resClrDark = 0;
|
||||
String id;
|
||||
|
||||
boolean nightMode = false;
|
||||
boolean f = true;
|
||||
|
|
Loading…
Reference in a new issue