mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Style green markers at nearby controller
This commit is contained in:
parent
2ac38a1919
commit
3e08f39f8e
1 changed files with 16 additions and 4 deletions
|
|
@ -158,6 +158,7 @@ public class NearbyController {
|
||||||
placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));
|
placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));
|
||||||
|
|
||||||
VectorDrawableCompat vectorDrawable = null;
|
VectorDrawableCompat vectorDrawable = null;
|
||||||
|
VectorDrawableCompat vectorDrawableGreen = null;
|
||||||
try {
|
try {
|
||||||
vectorDrawable = VectorDrawableCompat.create(
|
vectorDrawable = VectorDrawableCompat.create(
|
||||||
context.getResources(), R.drawable.ic_custom_bookmark_marker, context.getTheme()
|
context.getResources(), R.drawable.ic_custom_bookmark_marker, context.getTheme()
|
||||||
|
|
@ -191,13 +192,15 @@ public class NearbyController {
|
||||||
vectorDrawable = null;
|
vectorDrawable = null;
|
||||||
try {
|
try {
|
||||||
vectorDrawable = VectorDrawableCompat.create(
|
vectorDrawable = VectorDrawableCompat.create(
|
||||||
context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme()
|
context.getResources(), R.drawable.ic_custom_map_marker, context.getTheme());
|
||||||
);
|
vectorDrawableGreen = VectorDrawableCompat.create(
|
||||||
|
context.getResources(), R.drawable.ic_custom_map_marker_green, context.getTheme());
|
||||||
} catch (Resources.NotFoundException e) {
|
} catch (Resources.NotFoundException e) {
|
||||||
// ignore when running tests.
|
// ignore when running tests.
|
||||||
}
|
}
|
||||||
if (vectorDrawable != null) {
|
if (vectorDrawable != null) {
|
||||||
Bitmap icon = UiUtils.getBitmap(vectorDrawable);
|
Bitmap icon = UiUtils.getBitmap(vectorDrawable);
|
||||||
|
Bitmap iconGreen = UiUtils.getBitmap(vectorDrawableGreen);
|
||||||
|
|
||||||
for (Place place : placeList) {
|
for (Place place : placeList) {
|
||||||
String distance = formatDistanceBetween(curLatLng, place.location);
|
String distance = formatDistanceBetween(curLatLng, place.location);
|
||||||
|
|
@ -210,8 +213,17 @@ public class NearbyController {
|
||||||
place.location.getLatitude(),
|
place.location.getLatitude(),
|
||||||
place.location.getLongitude()));
|
place.location.getLongitude()));
|
||||||
nearbyBaseMarker.place(place);
|
nearbyBaseMarker.place(place);
|
||||||
nearbyBaseMarker.icon(IconFactory.getInstance(context)
|
// Check if string is only spaces or empty, if so place doesn't have any picture
|
||||||
.fromBitmap(icon));
|
if (!place.pic.trim().isEmpty()) {
|
||||||
|
|
||||||
|
if (iconGreen != null) {
|
||||||
|
nearbyBaseMarker.icon(IconFactory.getInstance(context)
|
||||||
|
.fromBitmap(iconGreen));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
nearbyBaseMarker.icon(IconFactory.getInstance(context)
|
||||||
|
.fromBitmap(icon));
|
||||||
|
}
|
||||||
|
|
||||||
baseMarkerOptions.add(nearbyBaseMarker);
|
baseMarkerOptions.add(nearbyBaseMarker);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue