Search in sources :

Example 1 with ROUTES_ID

use of net.osmand.aidlapi.OsmAndCustomizationConstants.ROUTES_ID in project Osmand by osmandapp.

the class ConfigureMapMenu method createRouteAttributeItems.

private void createRouteAttributeItems(List<RenderingRuleProperty> customRules, ContextMenuAdapter adapter, MapActivity activity, boolean nightMode) {
    OsmandApplication app = activity.getMyApplication();
    OsmandSettings settings = app.getSettings();
    adapter.addItem(new ContextMenuItem.ItemBuilder().setTitleId(R.string.rendering_category_routes, activity).setId(ROUTES_ID).setCategory(true).setLayout(R.layout.list_group_title_with_switch).createItem());
    for (String attrName : getRoutesDefaultAttrs().keySet()) {
        RenderingRuleProperty property = getPropertyForAttr(customRules, attrName);
        if (SHOW_CYCLE_ROUTES_ATTR.equals(attrName)) {
            adapter.addItem(createCycleRoutesItem(activity, attrName, property, nightMode));
            customRules.remove(getPropertyForAttr(customRules, CYCLE_NODE_NETWORK_ROUTES_ATTR));
        } else if (HIKING_ROUTES_OSMC_ATTR.equals(attrName)) {
            adapter.addItem(createHikingRoutesItem(activity, attrName, property, nightMode));
        } else {
            String id = ROUTES_ID + attrName;
            int drawableId = getIconIdForAttr(attrName);
            String name = AndroidUtils.getRenderingStringPropertyName(activity, attrName, property != null ? property.getName() : attrName);
            CommonPreference<Boolean> pref = settings.getCustomRenderBooleanProperty(attrName);
            ContextMenuItem item = createBooleanRenderingProperty(activity, attrName, name, id, property, drawableId, nightMode, result -> {
                if (property == null) {
                    showRendererSnackbarForAttr(activity, attrName, nightMode, pref);
                }
                return false;
            });
            if (item != null) {
                adapter.addItem(item);
            }
        }
        customRules.remove(property);
    }
    ResourceManager manager = app.getResourceManager();
    if (OsmandPlugin.isDevelopment() && (!Algorithms.isEmpty(manager.getTravelMapRepositories()) || !Algorithms.isEmpty(manager.getTravelRepositories()))) {
        adapter.addItem(createTravelRoutesItem(activity, nightMode));
    }
}
Also used : PoiUIFilter(net.osmand.plus.poi.PoiUIFilter) Arrays(java.util.Arrays) A_ENGINE_V1(net.osmand.render.RenderingRuleStorageProperties.A_ENGINE_V1) NonNull(androidx.annotation.NonNull) HIDE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.HIDE_ID) ItemClickListener(net.osmand.plus.ContextMenuAdapter.ItemClickListener) APP_PROFILES_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.APP_PROFILES_ID) R(net.osmand.plus.R) FAVORITES_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.FAVORITES_ID) INVALID_ID(net.osmand.plus.ContextMenuItem.INVALID_ID) DrawableRes(androidx.annotation.DrawableRes) RenderingRulesStorage(net.osmand.render.RenderingRulesStorage) MAP_RENDERING_CATEGORY_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_RENDERING_CATEGORY_ID) CUSTOM_RENDERING_ITEMS_ID_SCHEME(net.osmand.aidlapi.OsmAndCustomizationConstants.CUSTOM_RENDERING_ITEMS_ID_SCHEME) POI_OVERLAY_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.POI_OVERLAY_ID) ColorInt(androidx.annotation.ColorInt) ContextMenuAdapter.makeDeleteAction(net.osmand.plus.ContextMenuAdapter.makeDeleteAction) UiUtilities(net.osmand.plus.utils.UiUtilities) CallbackWithObject(net.osmand.CallbackWithObject) IndexConstants(net.osmand.IndexConstants) Locale(java.util.Locale) Map(java.util.Map) MAP_LANGUAGE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_LANGUAGE_ID) View(android.view.View) TRANSPORT_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.TRANSPORT_ID) RENDERING_CATEGORY_OSM_ASSISTANT(net.osmand.plus.plugins.osmedit.OsmEditingPlugin.RENDERING_CATEGORY_OSM_ASSISTANT) DateFormat(java.text.DateFormat) TEXT_SIZE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.TEXT_SIZE_ID) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) OnRowItemClick(net.osmand.plus.ContextMenuAdapter.OnRowItemClick) OsmandApplication(net.osmand.plus.OsmandApplication) StyleRes(androidx.annotation.StyleRes) OsmandPlugin(net.osmand.plus.plugins.OsmandPlugin) DETAILS_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.DETAILS_ID) MAP_SOURCE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_SOURCE_ID) StringRes(androidx.annotation.StringRes) List(java.util.List) Nullable(androidx.annotation.Nullable) A_APP_MODE(net.osmand.render.RenderingRuleStorageProperties.A_APP_MODE) DashboardType(net.osmand.plus.dashboard.DashboardOnMap.DashboardType) GPX_FILES_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.GPX_FILES_ID) CONTOUR_DENSITY_ATTR(net.osmand.plus.plugins.srtm.SRTMPlugin.CONTOUR_DENSITY_ATTR) ContextMenuAdapter(net.osmand.plus.ContextMenuAdapter) RENDERING_CATEGORY_TRANSPORT(net.osmand.plus.transport.TransportLinesMenu.RENDERING_CATEGORY_TRANSPORT) Snackbar(com.google.android.material.snackbar.Snackbar) ResourceManager(net.osmand.plus.resources.ResourceManager) MAP_MAGNIFIER_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_MAGNIFIER_ID) SunriseSunset(net.osmand.util.SunriseSunset) RendererRegistry(net.osmand.plus.render.RendererRegistry) SHOW_CATEGORY_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.SHOW_CATEGORY_ID) CommonPreference(net.osmand.plus.settings.backend.preferences.CommonPreference) ROAD_STYLE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.ROAD_STYLE_ID) POI_OVERLAY_LABELS_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.POI_OVERLAY_LABELS_ID) ArrayList(java.util.ArrayList) MAP_MARKERS_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_MARKERS_ID) RenderingRuleProperty(net.osmand.render.RenderingRuleProperty) LinkedHashMap(java.util.LinkedHashMap) CONTOUR_WIDTH_ATTR(net.osmand.plus.plugins.srtm.SRTMPlugin.CONTOUR_WIDTH_ATTR) A_BASE_APP_MODE(net.osmand.render.RenderingRuleStorageProperties.A_BASE_APP_MODE) PlatformUtil(net.osmand.PlatformUtil) Algorithms(net.osmand.util.Algorithms) TransportLinesMenu(net.osmand.plus.transport.TransportLinesMenu) UI_CATEGORY_HIDE(net.osmand.render.RenderingRuleStorageProperties.UI_CATEGORY_HIDE) UI_CATEGORY_ROUTES(net.osmand.render.RenderingRuleStorageProperties.UI_CATEGORY_ROUTES) AndroidUtils(net.osmand.plus.utils.AndroidUtils) Iterator(java.util.Iterator) MAP_MODE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_MODE_ID) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder) DayNightMode(net.osmand.plus.settings.enums.DayNightMode) CONTOUR_LINES_SCHEME_ATTR(net.osmand.plus.plugins.srtm.SRTMPlugin.CONTOUR_LINES_SCHEME_ATTR) MAP_STYLE_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_STYLE_ID) ROUTES_ID(net.osmand.aidlapi.OsmAndCustomizationConstants.ROUTES_ID) UI_CATEGORY_HIDDEN(net.osmand.render.RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN) ArrayAdapter(android.widget.ArrayAdapter) ContextMenuItem(net.osmand.plus.ContextMenuItem) UI_CATEGORY_DETAILS(net.osmand.render.RenderingRuleStorageProperties.UI_CATEGORY_DETAILS) Log(org.apache.commons.logging.Log) CONTOUR_LINES_ATTR(net.osmand.plus.plugins.srtm.SRTMPlugin.CONTOUR_LINES_ATTR) MapActivity(net.osmand.plus.activities.MapActivity) ItemBuilder(net.osmand.plus.ContextMenuItem.ItemBuilder) OsmandApplication(net.osmand.plus.OsmandApplication) CommonPreference(net.osmand.plus.settings.backend.preferences.CommonPreference) ContextMenuItem(net.osmand.plus.ContextMenuItem) RenderingRuleProperty(net.osmand.render.RenderingRuleProperty) ResourceManager(net.osmand.plus.resources.ResourceManager) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings)

Aggregations

View (android.view.View)1 ArrayAdapter (android.widget.ArrayAdapter)1 ColorInt (androidx.annotation.ColorInt)1 DrawableRes (androidx.annotation.DrawableRes)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 StringRes (androidx.annotation.StringRes)1 StyleRes (androidx.annotation.StyleRes)1 Snackbar (com.google.android.material.snackbar.Snackbar)1 DateFormat (java.text.DateFormat)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Iterator (java.util.Iterator)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1 Locale (java.util.Locale)1 Map (java.util.Map)1 CallbackWithObject (net.osmand.CallbackWithObject)1 IndexConstants (net.osmand.IndexConstants)1 PlatformUtil (net.osmand.PlatformUtil)1