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();
}
if (vl.startsWith("http://") || vl.startsWith("https://") || vl.startsWith("HTTP://") || vl.startsWith("HTTPS://")) {
isUrl = true;
}
if (pType != null && !pType.isText()) {
String categoryName = pType.getPoiAdditionalCategory();
if (!Algorithms.isEmpty(categoryName)) {
@ -461,6 +465,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
} else {
if (key.contains(Amenity.DESCRIPTION)) {
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 {
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;
AmenityInfoRow row;
if (isDescription) {
@ -619,7 +623,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
} else {
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);
}
buildRow(view, R.drawable.ic_action_get_my_location, null, PointDescription.getLocationName(app,