diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java index a45f129d06..547efecd88 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java @@ -263,23 +263,25 @@ public class QuickSearchListAdapter extends ArrayAdapter { String name = listItem.getName(); title.setText(name); + String desc = listItem.getTypeName(); + boolean hasDesc = false; + if (!Algorithms.isEmpty(desc) && !desc.equals(name)) { + subtitle.setText(desc); + subtitle.setVisibility(View.VISIBLE); + hasDesc = true; + } else { + subtitle.setVisibility(View.GONE); + } + Drawable typeIcon = listItem.getTypeIcon(); ImageView group = (ImageView) view.findViewById(R.id.type_name_icon); - if (typeIcon != null) { + if (typeIcon != null && hasDesc) { group.setImageDrawable(typeIcon); group.setVisibility(View.VISIBLE); } else { group.setVisibility(View.GONE); } - String desc = listItem.getTypeName(); - if (!Algorithms.isEmpty(desc) && !desc.equals(name)) { - subtitle.setText(desc); - subtitle.setVisibility(View.VISIBLE); - } else { - subtitle.setVisibility(View.GONE); - } - TextView timeText = (TextView) view.findViewById(R.id.time); ImageView timeIcon = (ImageView) view.findViewById(R.id.time_icon); if (listItem.getSearchResult().object instanceof Amenity diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java index 1ad767fc3c..10f5923dd2 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListFragment.java @@ -158,6 +158,7 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { String lang = searchResult.requiredSearchPhrase.getSettings().getLang(); PointDescription pointDescription = null; Object object = searchResult.object; + String typeName = null; switch (searchResult.objectType) { case POI: String poiSimpleFormat = OsmAndFormatter.getPoiStringWithoutType((Amenity) object, lang); @@ -191,25 +192,30 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment { pointDescription = fav.getPointDescription(); break; case HOUSE: - String nm = searchResult.localeName; + String name = searchResult.localeName; if (searchResult.relatedObject instanceof City) { - nm = ((City) searchResult.relatedObject).getName(searchResult.requiredSearchPhrase.getSettings().getLang(), true) + " " + nm; + typeName = ((City) searchResult.relatedObject).getName(searchResult.requiredSearchPhrase.getSettings().getLang(), true); } else if (searchResult.relatedObject instanceof Street) { String s = ((Street) searchResult.relatedObject).getName(searchResult.requiredSearchPhrase.getSettings().getLang(), true); String c = ((Street) searchResult.relatedObject).getCity().getName(searchResult.requiredSearchPhrase.getSettings().getLang(), true); - nm = s + " " + nm + ", " + c; + name = s + " " + name; + typeName = c; } else if (searchResult.localeRelatedObjectName != null) { - nm = searchResult.localeRelatedObjectName + " " + nm; + typeName = searchResult.localeRelatedObjectName; } - pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, nm); + pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, typeName, name); break; case LOCATION: LatLon latLon = (LatLon) object; pointDescription = new PointDescription(latLon.getLatitude(), latLon.getLongitude()); break; case STREET_INTERSECTION: + typeName = QuickSearchListItem.getTypeName(app, searchResult); + if (Algorithms.isEmpty(typeName)) { + typeName = null; + } pointDescription = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, - QuickSearchListItem.getName(app, searchResult)); + typeName, QuickSearchListItem.getName(app, searchResult)); break; case WPT: GPXUtilities.WptPt wpt = (GPXUtilities.WptPt) object; diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java index 0637e02867..2fd4fa1436 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListItem.java @@ -208,7 +208,7 @@ public class QuickSearchListItem { if (hasTypeInDescription) { return entry.getName().getTypeName(); } else { - return app.getString(R.string.shared_string_history); + return ""; } case WPT: StringBuilder sb = new StringBuilder();