Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-08-02 17:24:51 +02:00
commit 88df264864
3 changed files with 24 additions and 16 deletions

View file

@ -263,23 +263,25 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
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

View file

@ -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;

View file

@ -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();