From dbd49ba70617031dfa68e951320a82e136dc81b5 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Fri, 5 Jun 2020 21:06:41 +0300 Subject: [PATCH] Fix search filters show/hide --- .../java/net/osmand/search/core/SearchCoreFactory.java | 1 + .../osmand/plus/search/QuickSearchDialogFragment.java | 4 ++-- OsmAnd/src/net/osmand/plus/search/QuickSearchHelper.java | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java index 11585e0d5f..373f96f8d6 100644 --- a/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java +++ b/OsmAnd-java/src/main/java/net/osmand/search/core/SearchCoreFactory.java @@ -648,6 +648,7 @@ public class SearchCoreFactory { public void clearCustomFilters() { this.customPoiFilters.clear(); + this.activePoiFilters.clear(); } public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) { diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 7a0a95a783..673af0c9e1 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -1248,7 +1248,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC @Override public void onApplyPoiFiltersState(final ApplicationMode appMode, boolean stateChanged) { if (stateChanged) { - searchHelper.refreshFilterOrders(); + searchHelper.refreshCustomPoiFilters(); reloadCategoriesInternal(); } View containerView = getView(); @@ -1268,7 +1268,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC settings.POI_FILTERS_ORDER.setModeValue(mode, orders); settings.INACTIVE_POI_FILTERS.setModeValue(mode, inactive); } - searchHelper.refreshFilterOrders(); + searchHelper.refreshCustomPoiFilters(); reloadCategoriesInternal(); } }); diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchHelper.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchHelper.java index 81d257205a..95c8a32a79 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchHelper.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchHelper.java @@ -112,14 +112,17 @@ public class QuickSearchHelper implements ResourceListener { core.addCustomSearchPoiFilter(udf, 0); } PoiUIFilter topWikiPoiFilter = poiFilters.getTopWikiPoiFilter(); - if (topWikiPoiFilter != null) { + if (topWikiPoiFilter != null && topWikiPoiFilter.isActive()) { core.addCustomSearchPoiFilter(topWikiPoiFilter, 1); } - core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1); + PoiUIFilter showAllPOIFilter = poiFilters.getShowAllPOIFilter(); + if (showAllPOIFilter != null && showAllPOIFilter.isActive()) { + core.addCustomSearchPoiFilter(showAllPOIFilter, 1); + } refreshFilterOrders(); } - public void refreshFilterOrders() { + private void refreshFilterOrders() { PoiFiltersHelper filtersHelper = app.getPoiFilters(); core.setActivePoiFiltersByOrder(filtersHelper.getPoiFilterOrders(true)); }