Merge pull request #8909 from osmandapp/FixTransportAction
Do not include public transport to rendering rules list
This commit is contained in:
commit
9e94a1deaa
4 changed files with 21 additions and 27 deletions
|
@ -54,7 +54,6 @@ public interface OsmAndCustomizationConstants {
|
|||
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";
|
||||
|
|
|
@ -3795,9 +3795,6 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Boolean> SHOW_TRAVEL_UPDATE_CARD = new BooleanPreference("show_travel_update_card", true).makeGlobal();
|
||||
public final OsmandPreference<Boolean> SHOW_TRAVEL_NEEDED_MAPS_CARD = new BooleanPreference("show_travel_needed_maps_card", true).makeGlobal();
|
||||
|
||||
public final ListStringPreference TRANSPORT_DEFAULT_SETTINGS =
|
||||
(ListStringPreference) new ListStringPreference("transport_default_settings", "transportStops", ",").makeProfile();
|
||||
|
||||
public final ListStringPreference DISPLAYED_TRANSPORT_SETTINGS = (ListStringPreference)
|
||||
new ListStringPreference("displayed_transport_settings", null, ",").makeProfile();
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import net.osmand.plus.GpxSelectionHelper;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.OsmandSettings.ListStringPreference;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -100,7 +99,6 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.ROUTES_ID;
|
|||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.SHOW_CATEGORY_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TEXT_SIZE_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TRANSPORT_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.TRANSPORT_RENDERING_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.WIKIPEDIA_ID;
|
||||
import static net.osmand.plus.ContextMenuAdapter.makeDeleteAction;
|
||||
import static net.osmand.plus.poi.PoiFiltersHelper.PoiTemplateList;
|
||||
|
@ -108,6 +106,7 @@ 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;
|
||||
import static net.osmand.plus.srtmplugin.SRTMPlugin.CONTOUR_WIDTH_ATTR;
|
||||
import static net.osmand.plus.transport.TransportLinesMenu.RENDERING_CATEGORY_TRANSPORT;
|
||||
|
||||
public class ConfigureMapMenu {
|
||||
private static final Log LOG = PlatformUtil.getLog(ConfigureMapMenu.class);
|
||||
|
@ -141,7 +140,8 @@ public class ConfigureMapMenu {
|
|||
ma.getDashboard().updateListAdapter(createListAdapter(ma));
|
||||
}
|
||||
});
|
||||
List<RenderingRuleProperty> customRules = getCustomRules(app);
|
||||
List<RenderingRuleProperty> customRules = getCustomRules(app,
|
||||
RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN, RENDERING_CATEGORY_TRANSPORT);
|
||||
adapter.setProfileDependent(true);
|
||||
adapter.setNightMode(nightMode);
|
||||
createLayersItems(customRules, adapter, ma, themeRes, nightMode);
|
||||
|
@ -149,16 +149,27 @@ public class ConfigureMapMenu {
|
|||
return adapter;
|
||||
}
|
||||
|
||||
public static List<RenderingRuleProperty> getCustomRules(OsmandApplication app) {
|
||||
public static List<RenderingRuleProperty> getCustomRules(OsmandApplication app, String... skipCategories) {
|
||||
RenderingRulesStorage renderer = app.getRendererRegistry().getCurrentSelectedRenderer();
|
||||
if (renderer == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<RenderingRuleProperty> customRules = new ArrayList<>();
|
||||
boolean useDepthContours = app.getResourceManager().hasDepthContours()
|
||||
&& (InAppPurchaseHelper.isSubscribedToLiveUpdates(app)
|
||||
|| InAppPurchaseHelper.isDepthContoursPurchased(app));
|
||||
if (renderer != null) {
|
||||
for (RenderingRuleProperty p : renderer.PROPS.getCustomRules()) {
|
||||
if (!RenderingRuleStorageProperties.UI_CATEGORY_HIDDEN.equals(p.getCategory())
|
||||
&& (useDepthContours || !p.getAttrName().equals("depthContours"))) {
|
||||
if (useDepthContours || !"depthContours".equals(p.getAttrName())) {
|
||||
boolean skip = false;
|
||||
if (skipCategories != null) {
|
||||
for (String category : skipCategories) {
|
||||
if (category.equals(p.getCategory())) {
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!skip) {
|
||||
customRules.add(p);
|
||||
}
|
||||
}
|
||||
|
@ -396,14 +407,6 @@ public class ConfigureMapMenu {
|
|||
.setItemDeleteAction(makeDeleteAction(settings.SHOW_POI_LABEL))
|
||||
.setListener(l).createItem());
|
||||
|
||||
/*
|
||||
ContextMenuItem item = createProperties(customRules, null, R.string.rendering_category_transport, R.drawable.ic_action_bus_dark,
|
||||
"transport", settings.TRANSPORT_DEFAULT_SETTINGS, adapter, activity, false);
|
||||
if (item != null) {
|
||||
adapter.addItem(item);
|
||||
}
|
||||
*/
|
||||
|
||||
selected = TransportLinesMenu.isShowLines(app);
|
||||
adapter.addItem(new ContextMenuItem.ItemBuilder()
|
||||
.setId(TRANSPORT_ID)
|
||||
|
@ -768,11 +771,6 @@ public class ConfigureMapMenu {
|
|||
.setItemDeleteAction(makeDeleteAction(settings.MAP_PREFERRED_LOCALE))
|
||||
.createItem());
|
||||
|
||||
props = createProperties(customRules, null, R.string.rendering_category_transport, R.drawable.ic_action_transport_bus,
|
||||
"transport", null, adapter, activity, true, TRANSPORT_RENDERING_ID, themeRes, nightMode, selectedProfileColor);
|
||||
if (props != null) {
|
||||
adapter.addItem(props);
|
||||
}
|
||||
props = createProperties(customRules, null, R.string.rendering_category_details, R.drawable.ic_action_layers,
|
||||
"details", null, adapter, activity, true, DETAILS_ID, themeRes, nightMode, selectedProfileColor);
|
||||
if (props != null) {
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Map;
|
|||
|
||||
public class TransportLinesMenu {
|
||||
|
||||
public static final String TRANSPORT_RENDERING_CATEGORY = "transport";
|
||||
public static final String RENDERING_CATEGORY_TRANSPORT = "transport";
|
||||
|
||||
public static final String PT_TRANSPORT_STOPS = "transportStops";
|
||||
public static final String PT_PUBLIC_TRANSPORT_MODE = "publicTransportMode";
|
||||
|
@ -199,7 +199,7 @@ public class TransportLinesMenu {
|
|||
public static List<RenderingRuleProperty> getTransportRules(OsmandApplication app) {
|
||||
List<RenderingRuleProperty> transportRules = new ArrayList<>();
|
||||
for (RenderingRuleProperty property : ConfigureMapMenu.getCustomRules(app)) {
|
||||
if (TRANSPORT_RENDERING_CATEGORY.equals(property.getCategory()) && property.isBoolean()) {
|
||||
if (RENDERING_CATEGORY_TRANSPORT.equals(property.getCategory()) && property.isBoolean()) {
|
||||
transportRules.add(property);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue