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_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
|
|
|
@ -509,15 +509,29 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
|
||||
public String getTypesName() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (PoiCategory p : acceptedTypes.keySet()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(", ");
|
||||
for (Map.Entry<PoiCategory, LinkedHashSet<String>> entry : acceptedTypes.entrySet()) {
|
||||
LinkedHashSet<String> set = entry.getValue();
|
||||
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();
|
||||
}
|
||||
|
||||
private void appendWithSeparator(StringBuilder sb, String s) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @return null if all subtypes are accepted/ empty list if type is not accepted at all
|
||||
|
|
Loading…
Reference in a new issue