Skip to content

Commit 7251f4d

Browse files
committed
Fix map marker colors
1 parent ab90e6d commit 7251f4d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,27 +2085,33 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(),
20852085
private fun getIconFor(place: Place, isBookmarked: Boolean): Int {
20862086
if (nearestPlace != null && place.name == nearestPlace!!.name) {
20872087
// Highlight nearest place only when user clicks on the home nearby banner
2088-
// highlightNearestPlace(place);
2089-
return (if (isBookmarked) R.drawable.ic_custom_map_marker_purple_bookmarked else R.drawable.ic_custom_map_marker_purple
2090-
)
2088+
// highlightNearestPlace(place);
2089+
return if (isBookmarked) R.drawable.ic_custom_map_marker_purple_bookmarked else R.drawable.ic_custom_map_marker_purple
20912090
}
20922091

20932092
if (place.isMonument) {
20942093
return R.drawable.ic_custom_map_marker_monuments
20952094
}
2096-
if (!place.pic!!.trim { it <= ' ' }.isEmpty()) {
2097-
return (if (isBookmarked) R.drawable.ic_custom_map_marker_green_bookmarked else R.drawable.ic_custom_map_marker_green
2098-
)
2095+
2096+
place.pic?.let {
2097+
if (!it.trim { it <= ' ' }.isEmpty()) {
2098+
return if (isBookmarked) R.drawable.ic_custom_map_marker_green_bookmarked else R.drawable.ic_custom_map_marker_green
2099+
}
20992100
}
2100-
if (!place.exists!!) { // Means that the topic of the Wikidata item does not exist in the real world anymore, for instance it is a past event, or a place that was destroyed
2101+
2102+
// Means that the topic of the Wikidata item does not exist in the real world anymore,
2103+
// for instance it is a past event, or a place that was destroyed
2104+
if (place.exists == false) {
21012105
return (R.drawable.ic_clear_black_24dp)
21022106
}
2103-
if (!place.name.isNullOrEmpty()) {
2104-
return (if (isBookmarked) R.drawable.ic_custom_map_marker_grey_bookmarked else R.drawable.ic_custom_map_marker_grey
2105-
)
2107+
2108+
place.name?.let {
2109+
if (it.isEmpty()) {
2110+
return if (isBookmarked) R.drawable.ic_custom_map_marker_grey_bookmarked else R.drawable.ic_custom_map_marker_grey
2111+
}
21062112
}
2107-
return (if (isBookmarked) R.drawable.ic_custom_map_marker_red_bookmarked else R.drawable.ic_custom_map_marker_red
2108-
)
2113+
2114+
return if (isBookmarked) R.drawable.ic_custom_map_marker_red_bookmarked else R.drawable.ic_custom_map_marker_red
21092115
}
21102116

21112117
/**

0 commit comments

Comments
 (0)