diff --git a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java index ec7837a6a7..d1f974bc5f 100644 --- a/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java +++ b/OsmAnd-java/src/net/osmand/osm/MapPoiTypes.java @@ -39,7 +39,8 @@ public class MapPoiTypes { private boolean init; Map poiTypesByTag = new LinkedHashMap(); Map deprecatedTags = new LinkedHashMap(); - + Map poiAdditionalCategoryIcons = new LinkedHashMap(); + public MapPoiTypes(String fileName) { this.resourceName = fileName; @@ -88,6 +89,10 @@ public class MapPoiTypes { return otherMapCategory; } + public String getPoiAdditionalCategoryIcon(String category) { + return poiAdditionalCategoryIcons.get(category); + } + public List getTopVisibleFilters() { List lf = new ArrayList(); for (PoiCategory pc : categories) { @@ -315,6 +320,10 @@ public class MapPoiTypes { } else if (name.equals("poi_additional_category")) { if (lastPoiAdditionalCategory == null) { lastPoiAdditionalCategory = parser.getAttributeValue("", "name"); + String icon = parser.getAttributeValue("", "icon"); + if (!Algorithms.isEmpty(icon)) { + poiAdditionalCategoryIcons.put(lastPoiAdditionalCategory, icon); + } } } else if (name.equals("poi_type")) { diff --git a/OsmAnd/res/layout/search_dialog_fragment.xml b/OsmAnd/res/layout/search_dialog_fragment.xml index b3d5393f49..7dca8801ae 100644 --- a/OsmAnd/res/layout/search_dialog_fragment.xml +++ b/OsmAnd/res/layout/search_dialog_fragment.xml @@ -186,7 +186,7 @@ android:layout_height="match_parent" android:contentDescription="@string/poi_filter_custom_filter" android:visibility="gone" - android:src="@drawable/ic_action_filter_dark"/> + android:src="@drawable/ic_action_filter"/> diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index e8b44bc372..12291f6c79 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -212,7 +212,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC buttonToolbarImage = (ImageView) view.findViewById(R.id.buttonToolbarImage); buttonToolbarImage.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_marker_dark)); buttonToolbarFilter = (ImageButton) view.findViewById(R.id.filterButton); - buttonToolbarFilter.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_filter_dark)); + buttonToolbarFilter.setImageDrawable(app.getIconsCache().getThemedIcon(R.drawable.ic_action_filter)); buttonToolbarFilter.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java index ae5c427d33..99c861af6e 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchPoiFilterFragment.java @@ -29,6 +29,7 @@ import android.widget.TextView; import android.widget.Toast; import net.osmand.AndroidUtils; +import net.osmand.osm.MapPoiTypes; import net.osmand.osm.PoiType; import net.osmand.plus.IconsCache; import net.osmand.plus.OsmandApplication; @@ -405,6 +406,7 @@ public class QuickSearchPoiFilterFragment extends DialogFragment { private List getListItems() { OsmandApplication app = getMyApplication(); + MapPoiTypes poiTypes = app.getPoiTypes(); int groupId = 0; List items = new ArrayList<>(); items.add(new PoiFilterListItem(PoiFilterListItemType.DIVIDER, 0, null, -1, false, false, false, null, null)); @@ -418,7 +420,7 @@ public class QuickSearchPoiFilterFragment extends DialogFragment { selectedPoiAdditionals.contains(keyNameOpen24), null, keyNameOpen24)); Map poiAdditionals = filter.getPoiAdditionals(); - List otherAdditionalCategories = app.getPoiTypes().getOtherMapCategory().getPoiAdditionalsCategorized(); + List otherAdditionalCategories = poiTypes.getOtherMapCategory().getPoiAdditionalsCategorized(); if (poiAdditionals != null) { Map> additionalsMap = new TreeMap<>(); extractPoiAdditionals(poiAdditionals.values(), additionalsMap, false); @@ -427,11 +429,22 @@ public class QuickSearchPoiFilterFragment extends DialogFragment { if (additionalsMap.size() > 0) { for (Entry> entry : additionalsMap.entrySet()) { String category = entry.getKey(); + String categoryLocalizedName = poiTypes.getPoiTranslation(category); boolean expanded = !collapsedCategories.contains(category); boolean showAll = showAllCategories.contains(category); items.add(new PoiFilterListItem(PoiFilterListItemType.DIVIDER, 0, null, -1, false, false, false, null, null)); + + String categoryIconStr = poiTypes.getPoiAdditionalCategoryIcon(category); + int categoryIconId = 0; + if (!Algorithms.isEmpty(categoryIconStr)) { + categoryIconId = getResources().getIdentifier(categoryIconStr, "drawable", app.getPackageName()); + } + if (categoryIconId == 0) { + categoryIconId = R.drawable.ic_action_folder_stroke; + } + items.add(new PoiFilterListItem(PoiFilterListItemType.GROUP_HEADER, - R.drawable.ic_action_folder_stroke, category, ++groupId, true, expanded, false, category, null)); + categoryIconId, categoryLocalizedName, ++groupId, true, expanded, false, category, null)); List poiTypeNames = new ArrayList<>(entry.getValue()); Collections.sort(poiTypeNames); for (String poiTypeName : poiTypeNames) { @@ -451,7 +464,7 @@ public class QuickSearchPoiFilterFragment extends DialogFragment { private void extractPoiAdditionals(Collection poiAdditionals, Map> additionalsMap, boolean extractAll) { for (PoiType poiType : poiAdditionals) { - String category = poiType.getPoiAdditionalCategoryTranslation(); + String category = poiType.getPoiAdditionalCategory(); if (category == null) { category = ""; }