Fix search filters show/hide

This commit is contained in:
max-klaus 2020-06-05 21:06:41 +03:00
parent 0f1b90c1b8
commit dbd49ba706
3 changed files with 9 additions and 5 deletions

View file

@ -648,6 +648,7 @@ public class SearchCoreFactory {
public void clearCustomFilters() {
this.customPoiFilters.clear();
this.activePoiFilters.clear();
}
public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) {

View file

@ -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();
}
});

View file

@ -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));
}