Fix titles of custom poi filters for search history
This commit is contained in:
parent
26aa25d395
commit
cec2f6fb09
2 changed files with 20 additions and 4 deletions
|
@ -51,6 +51,8 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="2"
|
||||||
android:paddingRight="16dp"
|
android:paddingRight="16dp"
|
||||||
android:textColor="?android:textColorPrimary"
|
android:textColor="?android:textColorPrimary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
|
|
|
@ -509,15 +509,29 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
||||||
|
|
||||||
public String getTypesName() {
|
public String getTypesName() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (PoiCategory p : acceptedTypes.keySet()) {
|
for (Map.Entry<PoiCategory, LinkedHashSet<String>> entry : acceptedTypes.entrySet()) {
|
||||||
if (sb.length() > 0) {
|
LinkedHashSet<String> set = entry.getValue();
|
||||||
sb.append(", ");
|
if (set != null && !set.isEmpty()) {
|
||||||
|
for (String key : set) {
|
||||||
|
PoiType pt = poiTypes.getPoiTypeByKey(key);
|
||||||
|
if (pt != null) {
|
||||||
|
appendWithSeparator(sb, pt.getTranslation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
appendWithSeparator(sb, entry.getKey().getTranslation());
|
||||||
}
|
}
|
||||||
sb.append(p.getTranslation());
|
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void appendWithSeparator(StringBuilder sb, String s) {
|
||||||
|
if (sb.length() > 0) {
|
||||||
|
sb.append(", ");
|
||||||
|
}
|
||||||
|
sb.append(s);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type
|
* @param type
|
||||||
* @return null if all subtypes are accepted/ empty list if type is not accepted at all
|
* @return null if all subtypes are accepted/ empty list if type is not accepted at all
|
||||||
|
|
Loading…
Reference in a new issue