diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapPoiReaderAdapter.java b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapPoiReaderAdapter.java index 82a730ed77..857eb4f4d3 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapPoiReaderAdapter.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/BinaryMapPoiReaderAdapter.java @@ -772,7 +772,7 @@ public class BinaryMapPoiReaderAdapter { } } subtype = poiTypes.replaceDeprecatedSubtype(type, subtype); - boolean isForbidden = poiTypes.isKeyNameForbidden(subtype); + boolean isForbidden = poiTypes.isTypeForbidden(subtype); if (!isForbidden && (req.poiTypeFilter == null || req.poiTypeFilter.accept(type, subtype))) { if (amenityType == null) { amenityType = type; diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java index be3644ab90..f535af8610 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/MapPoiTypes.java @@ -35,13 +35,14 @@ public class MapPoiTypes { private static final Log log = PlatformUtil.getLog(MapRenderingTypes.class); private String resourceName; private List categories = new ArrayList(); - private Set forbiddenKeyNames = new HashSet<>(); + private Set forbiddenTypes = new HashSet<>(); private PoiCategory otherCategory; private PoiCategory otherMapCategory; public static final String WIKI_LANG = "wiki_lang"; public static final String WIKI_PLACE = "wiki_place"; public static final String OSM_WIKI_CATEGORY = "osmwiki"; + public static final String SPEED_CAMERA = "speed_camera"; private PoiTranslator poiTranslator = null; private boolean init; @@ -948,11 +949,11 @@ public class MapPoiTypes { } } - public void setForbiddenKeyNames(Set forbiddenKeyNames) { - this.forbiddenKeyNames = forbiddenKeyNames; + public void setForbiddenTypes(Set forbiddenTypes) { + this.forbiddenTypes = forbiddenTypes; } - public boolean isKeyNameForbidden(String key) { - return forbiddenKeyNames.contains(key); + public boolean isTypeForbidden(String typeName) { + return forbiddenTypes.contains(typeName); } } diff --git a/OsmAnd-java/src/main/java/net/osmand/osm/PoiFilter.java b/OsmAnd-java/src/main/java/net/osmand/osm/PoiFilter.java index 12bbaa13f0..a3f6f4eedf 100644 --- a/OsmAnd-java/src/main/java/net/osmand/osm/PoiFilter.java +++ b/OsmAnd-java/src/main/java/net/osmand/osm/PoiFilter.java @@ -31,7 +31,7 @@ public class PoiFilter extends AbstractPoiType { Map nmap = null; for (PoiType poiType : poiTypesToAdd.values()) { String keyName = poiType.getKeyName(); - if (!map.containsKey(keyName) && !registry.isKeyNameForbidden(keyName)) { + if (!map.containsKey(keyName) && !registry.isTypeForbidden(keyName)) { if (npoiTypes == null) { npoiTypes = new ArrayList(this.poiTypes); nmap = new LinkedHashMap<>(map); @@ -47,7 +47,7 @@ public class PoiFilter extends AbstractPoiType { } public void addPoiType(PoiType type) { - if (registry.isKeyNameForbidden(type.keyName)) { + if (registry.isTypeForbidden(type.keyName)) { return; } if (!map.containsKey(type.getKeyName())) { diff --git a/OsmAnd/src/net/osmand/plus/AppInitializer.java b/OsmAnd/src/net/osmand/plus/AppInitializer.java index 9e06a56d20..7bccdd599f 100644 --- a/OsmAnd/src/net/osmand/plus/AppInitializer.java +++ b/OsmAnd/src/net/osmand/plus/AppInitializer.java @@ -302,7 +302,7 @@ public class AppInitializer implements IProgress { } private void initPoiTypes() { - app.poiTypes.setForbiddenKeyNames(app.osmandSettings.getForbiddenPoiKeyNames()); + app.poiTypes.setForbiddenTypes(app.osmandSettings.getForbiddenTypes()); if (app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").exists()) { app.poiTypes.init(app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").getAbsolutePath()); } else { diff --git a/OsmAnd/src/net/osmand/plus/dialogs/SpeedCamerasBottomSheet.java b/OsmAnd/src/net/osmand/plus/dialogs/SpeedCamerasBottomSheet.java index fac4230c77..e620c4884f 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/SpeedCamerasBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/SpeedCamerasBottomSheet.java @@ -17,14 +17,11 @@ import net.osmand.plus.UiUtilities; import net.osmand.plus.base.MenuBottomSheetDialogFragment; import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem; import net.osmand.plus.helpers.FontCache; -import net.osmand.plus.settings.backend.OsmandSettings; public class SpeedCamerasBottomSheet extends MenuBottomSheetDialogFragment { public static final String TAG = SpeedCamerasBottomSheet.class.getName(); - public static final String SPEED_CAMERA_KEY_NAME = "speed_camera"; private OsmandApplication app; - private OsmandSettings settings; public static void showInstance(@NonNull FragmentManager fm, @Nullable Fragment targetFragment) { if (!fm.isStateSaved()) { @@ -38,7 +35,6 @@ public class SpeedCamerasBottomSheet extends MenuBottomSheetDialogFragment { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = requiredMyApplication(); - settings = app.getSettings(); } @Override diff --git a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java index 828d79dbf0..af16333cb2 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/SearchHistoryHelper.java @@ -428,7 +428,7 @@ public class SearchHistoryHelper { do { String name = query.getString(0); PointDescription p = PointDescription.deserializeFromString(name, new LatLon(query.getDouble(1), query.getDouble(2))); - if (context.getPoiTypes().isKeyNameForbidden(p.getName())){ + if (context.getPoiTypes().isTypeForbidden(p.getName())){ query.moveToNext(); } HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2), diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 9bc2bf0c88..07a4ebbfed 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -34,9 +34,8 @@ import net.osmand.data.PointDescription; import net.osmand.map.ITileSource; import net.osmand.map.TileSourceManager; import net.osmand.map.TileSourceManager.TileSourceTemplate; +import net.osmand.osm.MapPoiTypes; import net.osmand.osm.io.NetworkUtils; -import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; -import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBuilder; import net.osmand.plus.FavouritesDbHelper; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -56,6 +55,8 @@ import net.osmand.plus.profiles.NavigationIcon; import net.osmand.plus.profiles.ProfileIconColors; import net.osmand.plus.render.RendererRegistry; import net.osmand.plus.routing.RouteProvider.RouteService; +import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; +import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBuilder; import net.osmand.plus.voice.CommandPlayer; import net.osmand.render.RenderingRulesStorage; import net.osmand.util.Algorithms; @@ -88,7 +89,6 @@ import java.util.StringTokenizer; import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONFIGURE_MAP_ITEM_ID_SCHEME; import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_ITEM_ID_SCHEME; import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS; -import static net.osmand.plus.dialogs.SpeedCamerasBottomSheet.SPEED_CAMERA_KEY_NAME; public class OsmandSettings { @@ -2113,12 +2113,12 @@ public class OsmandSettings { public final OsmandPreference SPEED_CAMERAS_UNINSTALLED = new BooleanPreference("speed_cameras_uninstalled", false).makeGlobal(); public final OsmandPreference SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference("speed_cameras_alert_showed", false).makeGlobal(); - public Set getForbiddenPoiKeyNames() { - Set keyNames = new HashSet<>(); + public Set getForbiddenTypes() { + Set typeNames = new HashSet<>(); if (SPEED_CAMERAS_UNINSTALLED.get()) { - keyNames.add(SPEED_CAMERA_KEY_NAME); + typeNames.add(MapPoiTypes.SPEED_CAMERA); } - return keyNames; + return typeNames; } public final OsmandPreference ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {