refactor speed cameras hiding
This commit is contained in:
parent
18074b0dfc
commit
c20e096cda
13 changed files with 108 additions and 62 deletions
|
@ -692,10 +692,11 @@ public class BinaryMapPoiReaderAdapter {
|
||||||
StringBuilder retValue = new StringBuilder();
|
StringBuilder retValue = new StringBuilder();
|
||||||
PoiCategory amenityType = null;
|
PoiCategory amenityType = null;
|
||||||
LinkedList<String> textTags = null;
|
LinkedList<String> textTags = null;
|
||||||
|
boolean isForbidden = false;
|
||||||
while (true) {
|
while (true) {
|
||||||
int t = codedIS.readTag();
|
int t = codedIS.readTag();
|
||||||
int tag = WireFormat.getTagFieldNumber(t);
|
int tag = WireFormat.getTagFieldNumber(t);
|
||||||
if (amenityType == null && (tag > OsmandOdb.OsmAndPoiBoxDataAtom.CATEGORIES_FIELD_NUMBER || tag == 0)) {
|
if (amenityType == null && (tag > OsmandOdb.OsmAndPoiBoxDataAtom.CATEGORIES_FIELD_NUMBER || tag == 0) || isForbidden) {
|
||||||
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
codedIS.skipRawBytes(codedIS.getBytesUntilLimit());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -770,10 +771,7 @@ public class BinaryMapPoiReaderAdapter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subtype = poiTypes.replaceDeprecatedSubtype(type, subtype);
|
subtype = poiTypes.replaceDeprecatedSubtype(type, subtype);
|
||||||
PoiType poiType = poiTypes.getPoiTypeByKeyInCategory(type, subtype);
|
isForbidden = poiTypes.isKeyNameForbidden(subtype);
|
||||||
if (poiType != null && poiType.isForbidden()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (req.poiTypeFilter == null || req.poiTypeFilter.accept(type, subtype)) {
|
if (req.poiTypeFilter == null || req.poiTypeFilter.accept(type, subtype)) {
|
||||||
if (amenityType == null) {
|
if (amenityType == null) {
|
||||||
amenityType = type;
|
amenityType = type;
|
||||||
|
|
|
@ -21,7 +21,6 @@ public abstract class AbstractPoiType {
|
||||||
private String synonyms;
|
private String synonyms;
|
||||||
private String enTranslation;
|
private String enTranslation;
|
||||||
private String translation;
|
private String translation;
|
||||||
private boolean isForbidden;
|
|
||||||
|
|
||||||
public AbstractPoiType(String keyName, MapPoiTypes registry) {
|
public AbstractPoiType(String keyName, MapPoiTypes registry) {
|
||||||
this.keyName = keyName;
|
this.keyName = keyName;
|
||||||
|
@ -68,14 +67,6 @@ public abstract class AbstractPoiType {
|
||||||
return this instanceof PoiType && this.isAdditional();
|
return this instanceof PoiType && this.isAdditional();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForbidden(boolean forbidden) {
|
|
||||||
isForbidden = forbidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isForbidden() {
|
|
||||||
return isForbidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTranslation() {
|
public String getTranslation() {
|
||||||
if(translation == null) {
|
if(translation == null) {
|
||||||
translation = registry.getTranslation(this);
|
translation = registry.getTranslation(this);
|
||||||
|
|
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -34,6 +35,7 @@ public class MapPoiTypes {
|
||||||
private static final Log log = PlatformUtil.getLog(MapRenderingTypes.class);
|
private static final Log log = PlatformUtil.getLog(MapRenderingTypes.class);
|
||||||
private String resourceName;
|
private String resourceName;
|
||||||
private List<PoiCategory> categories = new ArrayList<PoiCategory>();
|
private List<PoiCategory> categories = new ArrayList<PoiCategory>();
|
||||||
|
private Set<String> forbiddenKeyNames = new HashSet<>();
|
||||||
private PoiCategory otherCategory;
|
private PoiCategory otherCategory;
|
||||||
private PoiCategory otherMapCategory;
|
private PoiCategory otherMapCategory;
|
||||||
|
|
||||||
|
@ -946,13 +948,11 @@ public class MapPoiTypes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void forbidPoiType(String keyName) {
|
public void setForbiddenKeyNames(Set<String> forbiddenKeyNames) {
|
||||||
for (PoiCategory category : categories) {
|
this.forbiddenKeyNames = forbiddenKeyNames;
|
||||||
for (PoiType poiType : category.getPoiTypes()) {
|
}
|
||||||
if (keyName.equals(poiType.getKeyName())) {
|
|
||||||
poiType.setForbidden(true);
|
public boolean isKeyNameForbidden(String key) {
|
||||||
}
|
return forbiddenKeyNames.contains(key);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,13 +30,14 @@ public class PoiFilter extends AbstractPoiType {
|
||||||
List<PoiType> npoiTypes = null;
|
List<PoiType> npoiTypes = null;
|
||||||
Map<String, PoiType> nmap = null;
|
Map<String, PoiType> nmap = null;
|
||||||
for (PoiType poiType : poiTypesToAdd.values()) {
|
for (PoiType poiType : poiTypesToAdd.values()) {
|
||||||
if (!map.containsKey(poiType.getKeyName())) {
|
String keyName = poiType.getKeyName();
|
||||||
|
if (!map.containsKey(keyName) && !registry.isKeyNameForbidden(keyName)) {
|
||||||
if (npoiTypes == null) {
|
if (npoiTypes == null) {
|
||||||
npoiTypes = new ArrayList<PoiType>(this.poiTypes);
|
npoiTypes = new ArrayList<PoiType>(this.poiTypes);
|
||||||
nmap = new LinkedHashMap<>(map);
|
nmap = new LinkedHashMap<>(map);
|
||||||
}
|
}
|
||||||
npoiTypes.add(poiType);
|
npoiTypes.add(poiType);
|
||||||
nmap.put(poiType.getKeyName(), poiType);
|
nmap.put(keyName, poiType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (npoiTypes != null) {
|
if (npoiTypes != null) {
|
||||||
|
@ -46,6 +47,9 @@ public class PoiFilter extends AbstractPoiType {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPoiType(PoiType type) {
|
public void addPoiType(PoiType type) {
|
||||||
|
if (registry.isKeyNameForbidden(type.keyName)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!map.containsKey(type.getKeyName())) {
|
if (!map.containsKey(type.getKeyName())) {
|
||||||
poiTypes.add(type);
|
poiTypes.add(type);
|
||||||
map.put(type.getKeyName(), type);
|
map.put(type.getKeyName(), type);
|
||||||
|
|
|
@ -11,7 +11,6 @@ import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.PoiType;
|
|
||||||
import net.osmand.search.core.CustomSearchPoiFilter;
|
import net.osmand.search.core.CustomSearchPoiFilter;
|
||||||
import net.osmand.search.core.ObjectType;
|
import net.osmand.search.core.ObjectType;
|
||||||
import net.osmand.search.core.SearchCoreAPI;
|
import net.osmand.search.core.SearchCoreAPI;
|
||||||
|
@ -734,9 +733,6 @@ public class SearchUICore {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean publish(SearchResult object) {
|
public boolean publish(SearchResult object) {
|
||||||
if (isPoiTypeForbidden(object.object)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (phrase != null && object.otherNames != null && !phrase.getFirstUnknownNameStringMatcher().matches(object.localeName)) {
|
if (phrase != null && object.otherNames != null && !phrase.getFirstUnknownNameStringMatcher().matches(object.localeName)) {
|
||||||
for (String s : object.otherNames) {
|
for (String s : object.otherNames) {
|
||||||
if (phrase.getFirstUnknownNameStringMatcher().matches(s)) {
|
if (phrase.getFirstUnknownNameStringMatcher().matches(s)) {
|
||||||
|
@ -890,13 +886,6 @@ public class SearchUICore {
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPoiTypeForbidden(Object object) {
|
|
||||||
if (object instanceof PoiType) {
|
|
||||||
return ((PoiType) object).isForbidden();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum ResultCompareStep {
|
private enum ResultCompareStep {
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="shared_string_uninstall_and_restart">Uninstall and Restart</string>
|
||||||
|
<string name="speed_cameras_restart_descr">Restart is needed to completely delete speed camera data.</string>
|
||||||
<string name="quick_action_showhide_mapillary_descr">A toggle to show or hide the Mapillary layer on the map.</string>
|
<string name="quick_action_showhide_mapillary_descr">A toggle to show or hide the Mapillary layer on the map.</string>
|
||||||
<string name="quick_action_mapillary_show">Show Mapillary</string>
|
<string name="quick_action_mapillary_show">Show Mapillary</string>
|
||||||
<string name="quick_action_mapillary_hide">Hide Mapillary</string>
|
<string name="quick_action_mapillary_hide">Hide Mapillary</string>
|
||||||
|
|
|
@ -86,7 +86,6 @@ import java.util.Random;
|
||||||
import btools.routingapp.BRouterServiceConnection;
|
import btools.routingapp.BRouterServiceConnection;
|
||||||
|
|
||||||
import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION;
|
import static net.osmand.plus.AppVersionUpgradeOnInit.LAST_APP_VERSION;
|
||||||
import static net.osmand.plus.dialogs.SpeedCamerasBottomSheet.SPEED_CAMERA_KEY_NAME;
|
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.getPendingIntent;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLastCheck;
|
||||||
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
|
import static net.osmand.plus.liveupdates.LiveUpdatesHelper.preferenceLiveUpdatesOn;
|
||||||
|
@ -303,6 +302,7 @@ public class AppInitializer implements IProgress {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initPoiTypes() {
|
private void initPoiTypes() {
|
||||||
|
app.poiTypes.setForbiddenKeyNames(app.osmandSettings.getForbiddenPoiKeyNames());
|
||||||
if (app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").exists()) {
|
if (app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").exists()) {
|
||||||
app.poiTypes.init(app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").getAbsolutePath());
|
app.poiTypes.init(app.getAppPath(IndexConstants.SETTINGS_DIR + "poi_types.xml").getAbsolutePath());
|
||||||
} else {
|
} else {
|
||||||
|
@ -407,9 +407,6 @@ public class AppInitializer implements IProgress {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (app.getSettings().SPEED_CAMERAS_UNINSTALLED.get()) {
|
|
||||||
app.getPoiTypes().forbidPoiType(SPEED_CAMERA_KEY_NAME);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCreateApplication() {
|
public void onCreateApplication() {
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
package net.osmand.plus;
|
package net.osmand.plus;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
import android.graphics.drawable.RippleDrawable;
|
import android.graphics.drawable.RippleDrawable;
|
||||||
import android.hardware.Sensor;
|
import android.hardware.Sensor;
|
||||||
|
@ -15,8 +13,6 @@ import android.hardware.SensorManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.text.SpannableString;
|
import android.text.SpannableString;
|
||||||
import android.text.Spanned;
|
import android.text.Spanned;
|
||||||
import android.text.method.LinkMovementMethod;
|
|
||||||
import android.text.style.ClickableSpan;
|
|
||||||
import android.text.style.StyleSpan;
|
import android.text.style.StyleSpan;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -38,7 +34,6 @@ import androidx.annotation.StringRes;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.appcompat.view.ContextThemeWrapper;
|
import androidx.appcompat.view.ContextThemeWrapper;
|
||||||
import androidx.appcompat.widget.ListPopupWindow;
|
import androidx.appcompat.widget.ListPopupWindow;
|
||||||
import androidx.appcompat.widget.AppCompatButton;
|
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
|
@ -55,7 +50,6 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
import net.osmand.plus.widgets.TextViewEx;
|
import net.osmand.plus.widgets.TextViewEx;
|
||||||
|
@ -66,7 +60,6 @@ import org.apache.commons.logging.Log;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
|
||||||
|
|
||||||
import gnu.trove.map.hash.TLongObjectHashMap;
|
import gnu.trove.map.hash.TLongObjectHashMap;
|
||||||
|
|
||||||
|
@ -87,6 +80,7 @@ public class UiUtilities {
|
||||||
public enum DialogButtonType {
|
public enum DialogButtonType {
|
||||||
PRIMARY,
|
PRIMARY,
|
||||||
SECONDARY,
|
SECONDARY,
|
||||||
|
SECONDARY_HARMFUL,
|
||||||
STROKED
|
STROKED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -633,6 +627,13 @@ public class UiUtilities {
|
||||||
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_secondary_light, R.drawable.dlg_btn_secondary_dark);
|
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_secondary_light, R.drawable.dlg_btn_secondary_dark);
|
||||||
textAndIconColorResId = nightMode ? R.color.dlg_btn_secondary_text_dark : R.color.dlg_btn_secondary_text_light;
|
textAndIconColorResId = nightMode ? R.color.dlg_btn_secondary_text_dark : R.color.dlg_btn_secondary_text_light;
|
||||||
break;
|
break;
|
||||||
|
case SECONDARY_HARMFUL:
|
||||||
|
if (v21) {
|
||||||
|
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_solid_light, R.drawable.ripple_solid_dark);
|
||||||
|
}
|
||||||
|
AndroidUtils.setBackground(ctx, buttonView, nightMode, R.drawable.dlg_btn_secondary_light, R.drawable.dlg_btn_secondary_dark);
|
||||||
|
textAndIconColorResId = R.color.color_osm_edit_delete;
|
||||||
|
break;
|
||||||
case STROKED:
|
case STROKED:
|
||||||
if (v21) {
|
if (v21) {
|
||||||
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
AndroidUtils.setBackground(ctx, buttonContainer, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
|
|
@ -18,8 +18,6 @@ import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
import net.osmand.plus.helpers.FontCache;
|
import net.osmand.plus.helpers.FontCache;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
import net.osmand.plus.settings.backend.OsmandSettings.OsmandPreference;
|
|
||||||
import net.osmand.plus.settings.fragments.OnPreferenceChanged;
|
|
||||||
|
|
||||||
public class SpeedCamerasBottomSheet extends MenuBottomSheetDialogFragment {
|
public class SpeedCamerasBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
@ -59,14 +57,9 @@ public class SpeedCamerasBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDismissButtonClickAction() {
|
protected void onDismissButtonClickAction() {
|
||||||
OsmandPreference<Boolean> speedCamUninstalled = settings.SPEED_CAMERAS_UNINSTALLED;
|
FragmentManager fm = getFragmentManager();
|
||||||
speedCamUninstalled.set(true);
|
if (fm != null) {
|
||||||
settings.SPEAK_SPEED_CAMERA.set(false);
|
SpeedCamerasUninstallRestartBottomSheet.showInstance(fm);
|
||||||
settings.SHOW_CAMERAS.set(false);
|
|
||||||
app.getPoiTypes().forbidPoiType(SPEED_CAMERA_KEY_NAME);
|
|
||||||
Fragment targetFragment = getTargetFragment();
|
|
||||||
if (targetFragment instanceof OnPreferenceChanged) {
|
|
||||||
((OnPreferenceChanged) targetFragment).onPreferenceChanged(speedCamUninstalled.getId());
|
|
||||||
}
|
}
|
||||||
setDialogShowed();
|
setDialogShowed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package net.osmand.plus.dialogs;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities.DialogButtonType;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.LongDescriptionItem;
|
||||||
|
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||||
|
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||||
|
|
||||||
|
public class SpeedCamerasUninstallRestartBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
|
public static final String TAG = SpeedCamerasUninstallRestartBottomSheet.class.getSimpleName();
|
||||||
|
|
||||||
|
public static void showInstance(@NonNull FragmentManager fm) {
|
||||||
|
if (!fm.isStateSaved()) {
|
||||||
|
SpeedCamerasUninstallRestartBottomSheet bottomSheet = new SpeedCamerasUninstallRestartBottomSheet();
|
||||||
|
bottomSheet.show(fm, TAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
items.add(new TitleItem(getString(R.string.uninstall_speed_cameras)));
|
||||||
|
items.add(new LongDescriptionItem(getString(R.string.speed_cameras_restart_descr)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getDismissButtonTextId() {
|
||||||
|
return R.string.shared_string_cancel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected int getRightBottomButtonTextId() {
|
||||||
|
return R.string.shared_string_uninstall_and_restart;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected DialogButtonType getRightBottomButtonType() {
|
||||||
|
return DialogButtonType.SECONDARY_HARMFUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRightBottomButtonClick() {
|
||||||
|
OsmandApplication app = requiredMyApplication();
|
||||||
|
OsmandSettings settings = app.getSettings();
|
||||||
|
settings.SPEED_CAMERAS_UNINSTALLED.set(true);
|
||||||
|
settings.SPEAK_SPEED_CAMERA.set(false);
|
||||||
|
settings.SHOW_CAMERAS.set(false);
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity instanceof MapActivity) {
|
||||||
|
MapActivity.doRestart(activity);
|
||||||
|
} else {
|
||||||
|
android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -428,6 +428,9 @@ public class SearchHistoryHelper {
|
||||||
do {
|
do {
|
||||||
String name = query.getString(0);
|
String name = query.getString(0);
|
||||||
PointDescription p = PointDescription.deserializeFromString(name, new LatLon(query.getDouble(1), query.getDouble(2)));
|
PointDescription p = PointDescription.deserializeFromString(name, new LatLon(query.getDouble(1), query.getDouble(2)));
|
||||||
|
if (context.getPoiTypes().isKeyNameForbidden(p.getName())){
|
||||||
|
query.moveToNext();
|
||||||
|
}
|
||||||
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
|
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
|
||||||
p);
|
p);
|
||||||
long time = query.getLong(3);
|
long time = query.getLong(3);
|
||||||
|
|
|
@ -87,12 +87,6 @@ public class QuickSearchSubCategoriesFragment extends BaseOsmAndDialogFragment {
|
||||||
acceptedCategories = new HashSet<>(savedInstanceState.getStringArrayList(ACCEPTED_CATEGORIES_KEY));
|
acceptedCategories = new HashSet<>(savedInstanceState.getStringArrayList(ACCEPTED_CATEGORIES_KEY));
|
||||||
}
|
}
|
||||||
poiTypeList = new ArrayList<>(poiCategory.getPoiTypes());
|
poiTypeList = new ArrayList<>(poiCategory.getPoiTypes());
|
||||||
Iterator<PoiType> iter = poiTypeList.iterator();
|
|
||||||
while (iter.hasNext()) {
|
|
||||||
if (iter.next().isForbidden()) {
|
|
||||||
iter.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Collections.sort(poiTypeList, new Comparator<PoiType>() {
|
Collections.sort(poiTypeList, new Comparator<PoiType>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PoiType poiType, PoiType t1) {
|
public int compare(PoiType poiType, PoiType t1) {
|
||||||
|
|
|
@ -74,6 +74,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -87,6 +88,7 @@ import java.util.StringTokenizer;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.CONFIGURE_MAP_ITEM_ID_SCHEME;
|
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.DRAWER_ITEM_ID_SCHEME;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ACTIONS;
|
||||||
|
import static net.osmand.plus.dialogs.SpeedCamerasBottomSheet.SPEED_CAMERA_KEY_NAME;
|
||||||
|
|
||||||
public class OsmandSettings {
|
public class OsmandSettings {
|
||||||
|
|
||||||
|
@ -2111,6 +2113,14 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference("speed_cameras_uninstalled", false).makeGlobal();
|
public final OsmandPreference<Boolean> SPEED_CAMERAS_UNINSTALLED = new BooleanPreference("speed_cameras_uninstalled", false).makeGlobal();
|
||||||
public final OsmandPreference<Boolean> SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference("speed_cameras_alert_showed", false).makeGlobal();
|
public final OsmandPreference<Boolean> SPEED_CAMERAS_ALERT_SHOWED = new BooleanPreference("speed_cameras_alert_showed", false).makeGlobal();
|
||||||
|
|
||||||
|
public Set<String> getForbiddenPoiKeyNames() {
|
||||||
|
Set<String> keyNames = new HashSet<>();
|
||||||
|
if (SPEED_CAMERAS_UNINSTALLED.get()) {
|
||||||
|
keyNames.add(SPEED_CAMERA_KEY_NAME);
|
||||||
|
}
|
||||||
|
return keyNames;
|
||||||
|
}
|
||||||
|
|
||||||
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {
|
public final OsmandPreference<Boolean> ANNOUNCE_WPT = new BooleanPreference("announce_wpt", true) {
|
||||||
@Override
|
@Override
|
||||||
protected boolean setValue(Object prefs, Boolean val) {
|
protected boolean setValue(Object prefs, Boolean val) {
|
||||||
|
|
Loading…
Reference in a new issue