Style green markers at nearby controller

This commit is contained in:
neslihanturan 2019-10-08 18:09:32 +03:00
parent 2ac38a1919
commit 3e08f39f8e

View file

@ -158,6 +158,7 @@ public class NearbyController {
placeList = placeList.subList(0, Math.min(placeList.size(), MAX_RESULTS));
VectorDrawableCompat vectorDrawable = null;
VectorDrawableCompat vectorDrawableGreen = null;
try {
vectorDrawable = VectorDrawableCompat.create(
context.getResources(), R.drawable.ic_custom_bookmark_marker, context.getTheme()
@ -191,13 +192,15 @@ public class NearbyController {
vectorDrawable = null;
try {
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) {
// ignore when running tests.
}
if (vectorDrawable != null) {
Bitmap icon = UiUtils.getBitmap(vectorDrawable);
Bitmap iconGreen = UiUtils.getBitmap(vectorDrawableGreen);
for (Place place : placeList) {
String distance = formatDistanceBetween(curLatLng, place.location);
@ -210,8 +213,17 @@ public class NearbyController {
place.location.getLatitude(),
place.location.getLongitude()));
nearbyBaseMarker.place(place);
nearbyBaseMarker.icon(IconFactory.getInstance(context)
.fromBitmap(icon));
// Check if string is only spaces or empty, if so place doesn't have any picture
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);
}