Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-04-29 12:13:40 +02:00
commit 68b438f0d5
2 changed files with 15 additions and 11 deletions

View file

@ -2336,7 +2336,7 @@ public class OsmandSettings {
public Set<String> getSelectedPoiFilters() {
Set<String> result = new LinkedHashSet<>();
String filtersId = SELECTED_POI_FILTER_FOR_MAP.get();
if (filtersId != null && !filtersId.isEmpty()) {
if (filtersId != null && !filtersId.trim().isEmpty()) {
Collections.addAll(result, filtersId.split(","));
}
return result;

View file

@ -113,6 +113,13 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
updatePoiAdditionals();
}
public PoiUIFilter(Set<PoiUIFilter> filtersToMerge, OsmandApplication app) {
this(app);
combineWithPoiFilters(filtersToMerge);
filterId = PoiUIFilter.STD_PREFIX + "combined";
name = app.getPoiFilters().getFiltersName(filtersToMerge);
}
public String getFilterByName() {
return filterByName;
}
@ -494,6 +501,12 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
poiAdditionals.putAll(f.poiAdditionals);
}
public void combineWithPoiFilters(Set<PoiUIFilter> filters) {
for (PoiUIFilter f : filters) {
combineWithPoiFilter(f);
}
}
public static void combineStandardPoiFilters(Set<PoiUIFilter> filters, OsmandApplication app) {
Set<PoiUIFilter> standardFilters = new TreeSet<>();
for (PoiUIFilter filter : filters) {
@ -503,16 +516,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
}
}
if (!standardFilters.isEmpty()) {
PoiUIFilter standardFiltersCombined = null;
for (PoiUIFilter f : standardFilters) {
if (standardFiltersCombined == null) {
standardFiltersCombined = f;
f.filterId = PoiUIFilter.STD_PREFIX + "combined";
f.name = app.getPoiFilters().getFiltersName(standardFilters);
} else {
standardFiltersCombined.combineWithPoiFilter(f);
}
}
PoiUIFilter standardFiltersCombined = new PoiUIFilter(standardFilters, app);
filters.removeAll(standardFilters);
filters.add(standardFiltersCombined);
}