Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-10-17 22:44:27 +02:00
commit a75287f3a7
2 changed files with 33 additions and 17 deletions

View file

@ -532,7 +532,11 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
poiAdditionals.put(add.getKeyName().replace('_', ':').replace(' ', ':'), add);
poiAdditionals.put(add.getTranslation().replace(' ', ':').toLowerCase(), add);
}
if (pt instanceof PoiFilter && !(pt instanceof PoiCategory)) {
if (pt instanceof PoiCategory) {
for (PoiFilter pf : ((PoiCategory) pt).getPoiFilters()) {
fillPoiAdditionals(pf);
}
} else if (pt instanceof PoiFilter) {
for (PoiType ps : ((PoiFilter) pt).getPoiTypes()) {
fillPoiAdditionals(ps);
}

View file

@ -432,16 +432,16 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
if (!excludedPoiAdditionalCategories.contains("opening_hours")) {
String keyNameOpen = app.getString(R.string.shared_string_is_open).replace(' ', '_').toLowerCase();
String keyNameOpen24 = app.getString(R.string.shared_string_is_open_24_7).replace(' ', '_').toLowerCase();
index = filterByName.indexOf(keyNameOpen);
if (index != -1) {
selectedPoiAdditionals.add(keyNameOpen);
filterByName = filterByName.replaceAll(keyNameOpen, "");
}
index = filterByName.indexOf(keyNameOpen24);
if (index != -1) {
selectedPoiAdditionals.add(keyNameOpen24);
filterByName = filterByName.replaceAll(keyNameOpen24, "");
}
index = filterByName.indexOf(keyNameOpen);
if (index != -1) {
selectedPoiAdditionals.add(keyNameOpen);
filterByName = filterByName.replaceAll(keyNameOpen, "");
}
}
if (poiAdditionals != null) {
Map<String, List<PoiType>> additionalsMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
@ -472,24 +472,36 @@ public class QuickSearchPoiFilterFragment extends DialogFragment {
MapPoiTypes poiTypes = getMyApplication().getPoiTypes();
Set<String> excludedPoiAdditionalCategories = new LinkedHashSet<>();
for (Entry<PoiCategory, LinkedHashSet<String>> entry : filter.getAcceptedTypes().entrySet()) {
if (entry.getKey().getExcludedPoiAdditionalCategories() != null) {
excludedPoiAdditionalCategories.addAll(entry.getKey().getExcludedPoiAdditionalCategories());
}
boolean needTopLevelExclude = false;
Set<String> excluded = new LinkedHashSet<>();
if (entry.getValue() != null) {
for (String keyName : entry.getValue()) {
PoiType poiType = poiTypes.getPoiTypeByKey(keyName);
if (poiType != null) {
collectExcludedPoiAdditionalCategories(poiType, excludedPoiAdditionalCategories);
PoiFilter poiFilter = poiType.getFilter();
if (poiFilter != null) {
collectExcludedPoiAdditionalCategories(poiFilter, excludedPoiAdditionalCategories);
}
PoiCategory poiCategory = poiType.getCategory();
if (poiCategory != null) {
collectExcludedPoiAdditionalCategories(poiCategory, excludedPoiAdditionalCategories);
collectExcludedPoiAdditionalCategories(poiType, excluded);
if (!poiType.isReference()) {
needTopLevelExclude = true;
PoiFilter poiFilter = poiType.getFilter();
if (poiFilter != null) {
collectExcludedPoiAdditionalCategories(poiFilter, excluded);
}
PoiCategory poiCategory = poiType.getCategory();
if (poiCategory != null) {
collectExcludedPoiAdditionalCategories(poiCategory, excluded);
}
}
}
}
} else {
needTopLevelExclude = true;
}
if (excludedPoiAdditionalCategories.size() == 0) {
excludedPoiAdditionalCategories.addAll(excluded);
} else {
excludedPoiAdditionalCategories.retainAll(excluded);
}
if (needTopLevelExclude && entry.getKey().getExcludedPoiAdditionalCategories() != null) {
excludedPoiAdditionalCategories.addAll(entry.getKey().getExcludedPoiAdditionalCategories());
}
}
return excludedPoiAdditionalCategories;