Merge pull request #5428 from osmandapp/ContextMenuImprovements

Add icons for context menu
This commit is contained in:
Alexey 2018-05-18 14:57:27 +03:00 committed by GitHub
commit 96ed8b3c83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -386,6 +386,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
poiTypeKeyName = pType.getKeyName(); poiTypeKeyName = pType.getKeyName();
} }
if (vl.startsWith("http://") || vl.startsWith("https://") || vl.startsWith("HTTP://") || vl.startsWith("HTTPS://")) {
isUrl = true;
}
if (pType != null && !pType.isText()) { if (pType != null && !pType.isText()) {
String categoryName = pType.getPoiAdditionalCategory(); String categoryName = pType.getPoiAdditionalCategory();
if (!Algorithms.isEmpty(categoryName)) { if (!Algorithms.isEmpty(categoryName)) {
@ -461,6 +465,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
} else { } else {
if (key.contains(Amenity.DESCRIPTION)) { if (key.contains(Amenity.DESCRIPTION)) {
iconId = R.drawable.ic_action_note_dark; iconId = R.drawable.ic_action_note_dark;
} else if (isUrl && vl.contains(WIKI_LINK)) {
iconId = R.drawable.ic_plugin_wikipedia;
} else if (key.equals("addr:housename") || key.equals("whitewater:rapid_name")) {
iconId = R.drawable.ic_action_poi_name;
} else { } else {
iconId = R.drawable.ic_action_info_dark; iconId = R.drawable.ic_action_info_dark;
} }
@ -493,10 +501,6 @@ public class AmenityMenuBuilder extends MenuBuilder {
} }
} }
if (vl.startsWith("http://") || vl.startsWith("https://") || vl.startsWith("HTTP://") || vl.startsWith("HTTPS://")) {
isUrl = true;
}
boolean matchWidthDivider = !isDescription && isWiki; boolean matchWidthDivider = !isDescription && isWiki;
AmenityInfoRow row; AmenityInfoRow row;
if (isDescription) { if (isDescription) {
@ -619,7 +623,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
} else { } else {
link = "https://www.openstreetmap.org/way/"; link = "https://www.openstreetmap.org/way/";
} }
buildRow(view, R.drawable.ic_action_info_dark, null, link + (amenity.getId() >> 1), buildRow(view, R.drawable.ic_action_openstreetmap_logo, null, link + (amenity.getId() >> 1),
0, false, null, true, 0, true, null, false); 0, false, null, true, 0, true, null, false);
} }
buildRow(view, R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(app, buildRow(view, R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(app,