Merge branch 'r3.7'

This commit is contained in:
max-klaus 2020-06-06 13:34:07 +03:00
commit ee46905d4f
6 changed files with 2161 additions and 31 deletions

View file

@ -843,6 +843,7 @@ public class CommonWords {
addCommon("van");
addCommon("road");
addCommon("street");
addCommon("sector");
addCommon("drive");
addCommon("avenue");
addCommon("rue");

View file

@ -226,7 +226,7 @@ public class SearchCoreFactory {
sr.objectType = ObjectType.REGION;
sr.location = bmir.getRegionCenter();
sr.preferredZoom = 6;
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
resultMatcher.publish(sr);
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
resultMatcher.publish(sr);
@ -648,6 +648,7 @@ public class SearchCoreFactory {
public void clearCustomFilters() {
this.customPoiFilters.clear();
this.activePoiFilters.clear();
}
public void addCustomFilter(CustomSearchPoiFilter poiFilter, int priority) {
@ -731,6 +732,7 @@ public class SearchCoreFactory {
if (translatedNames.isEmpty()) {
translatedNames = types.getAllTranslatedNames(false);
topVisibleFilters = types.getTopVisibleFilters();
topVisibleFilters.remove(types.getOsmwiki());
categories = types.getCategories(false);
}
}

File diff suppressed because it is too large Load diff

View file

@ -54,7 +54,6 @@ public class PoiFiltersHelper {
private PoiUIFilter searchByNamePOIFilter;
private PoiUIFilter customPOIFilter;
private PoiUIFilter showAllPOIFilter;
private PoiUIFilter localWikiPoiFilter;
private PoiUIFilter topWikiPoiFilter;
private List<PoiUIFilter> cacheTopStandardFilters;
private Set<PoiUIFilter> selectedPoiFilters = new TreeSet<>();
@ -120,20 +119,6 @@ public class PoiFiltersHelper {
return customPOIFilter;
}
public PoiUIFilter getLocalWikiPOIFilter() {
if (localWikiPoiFilter == null) {
PoiType place = application.getPoiTypes().getPoiTypeByKey(WIKI_PLACE);
if (place != null && !Algorithms.isEmpty(application.getLanguage())) {
PoiUIFilter filter = new PoiUIFilter(place, application, " " +
application.getLangTranslation(application.getLanguage()));
filter.setSavedFilterByName("wiki:lang:" + application.getLanguage());
filter.setStandardFilter(true);
localWikiPoiFilter = filter;
}
}
return localWikiPoiFilter;
}
public void prepareTopWikiFilter(@NonNull PoiUIFilter wiki) {
boolean prepareByDefault = true;
Bundle wikiSettings = WikipediaPoiMenu.getWikiPoiSettings(application);
@ -217,8 +202,7 @@ public class PoiFiltersHelper {
}
}
PoiUIFilter ff = getFilterById(filterId, getCustomPOIFilter(), getSearchByNamePOIFilter(),
getTopWikiPoiFilter(), getLocalWikiPOIFilter(), getShowAllPOIFilter(),
getNominatimPOIFilter(), getNominatimAddressFilter());
getTopWikiPoiFilter(), getShowAllPOIFilter(), getNominatimPOIFilter(), getNominatimAddressFilter());
if (ff != null) {
return ff;
}
@ -284,9 +268,6 @@ public class PoiFiltersHelper {
top = new ArrayList<>();
// user defined
top.addAll(getUserDefinedPoiFilters(true));
if (getLocalWikiPOIFilter() != null) {
top.add(getLocalWikiPOIFilter());
}
// default
MapPoiTypes poiTypes = application.getPoiTypes();
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {

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

@ -111,15 +111,18 @@ public class QuickSearchHelper implements ResourceListener {
for (CustomSearchPoiFilter udf : poiFilters.getUserDefinedPoiFilters(false)) {
core.addCustomSearchPoiFilter(udf, 0);
}
PoiUIFilter localWikiPoiFilter = poiFilters.getLocalWikiPOIFilter();
if (localWikiPoiFilter != null) {
core.addCustomSearchPoiFilter(localWikiPoiFilter, 1);
PoiUIFilter topWikiPoiFilter = poiFilters.getTopWikiPoiFilter();
if (topWikiPoiFilter != null && topWikiPoiFilter.isActive()) {
core.addCustomSearchPoiFilter(topWikiPoiFilter, 1);
}
PoiUIFilter showAllPOIFilter = poiFilters.getShowAllPOIFilter();
if (showAllPOIFilter != null && showAllPOIFilter.isActive()) {
core.addCustomSearchPoiFilter(showAllPOIFilter, 1);
}
core.addCustomSearchPoiFilter(poiFilters.getShowAllPOIFilter(), 1);
refreshFilterOrders();
}
public void refreshFilterOrders() {
private void refreshFilterOrders() {
PoiFiltersHelper filtersHelper = app.getPoiFilters();
core.setActivePoiFiltersByOrder(filtersHelper.getPoiFilterOrders(true));
}
@ -201,7 +204,7 @@ public class QuickSearchHelper implements ResourceListener {
//sr.localeRelatedObjectName = app.getRegions().getCountryName(sr.location);
sr.relatedObject = selectedGpx.getGpxFile();
sr.preferredZoom = 17;
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
resultMatcher.publish(sr);
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
resultMatcher.publish(sr);
@ -313,7 +316,7 @@ public class QuickSearchHelper implements ResourceListener {
continue;
}
}
if (phrase.getFirstUnknownSearchWord().length() <= 1
if (phrase.getFullSearchPhrase().length() <= 1
&& (phrase.isNoSelectedType() || phrase.isLastWord(ObjectType.FAVORITE_GROUP))) {
resultMatcher.publish(sr);
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
@ -457,7 +460,7 @@ public class QuickSearchHelper implements ResourceListener {
}
if (publish) {
sr.priority = SEARCH_HISTORY_OBJECT_PRIORITY + (p++);
if (phrase.getFirstUnknownSearchWord().length() <= 1 && phrase.isNoSelectedType()) {
if (phrase.getFullSearchPhrase().length() <= 1 && phrase.isNoSelectedType()) {
resultMatcher.publish(sr);
} else if (phrase.getFirstUnknownNameStringMatcher().matches(sr.localeName)) {
resultMatcher.publish(sr);