Added change color icon to pin

This commit is contained in:
Kanahia 2024-06-13 08:22:28 +05:30
parent 27c8443fa2
commit 2fa7eac46d

View file

@ -1221,7 +1221,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
return Environment.MEDIA_MOUNTED.equals(state); return Environment.MEDIA_MOUNTED.equals(state);
} }
private void getPlaceData(String entity, Place place, Marker marker) { private void getPlaceData(String entity, Place place, Marker marker, Boolean isBookMarked) {
final Observable<Place> getPlaceObservable = Observable final Observable<Place> getPlaceObservable = Observable
.fromCallable(() -> nearbyController .fromCallable(() -> nearbyController
.getPlace(entity)); .getPlace(entity));
@ -1238,6 +1238,15 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
? getTextBetweenParentheses( ? getTextBetweenParentheses(
updatedPlace.getLongDescription()) : updatedPlace.getLongDescription()); updatedPlace.getLongDescription()) : updatedPlace.getLongDescription());
marker.showInfoWindow(); marker.showInfoWindow();
for (int i =0; i < updatedPlaceList.size(); i++) {
Place pl = updatedPlaceList.get(i);
if (pl.location == updatedPlace.location){
updatedPlaceList.set(i, updatedPlace);
}
}
Drawable icon = ContextCompat.getDrawable(getContext(), getIconFor(updatedPlace, isBookMarked));
marker.setIcon(icon);
binding.map.invalidate();
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE); binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE);
binding.bottomSheetDetails.icon.setVisibility(View.VISIBLE); binding.bottomSheetDetails.icon.setVisibility(View.VISIBLE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.VISIBLE); binding.bottomSheetDetails.wikiDataLl.setVisibility(View.VISIBLE);
@ -1864,7 +1873,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
binding.bottomSheetDetails.icon.setVisibility(View.GONE); binding.bottomSheetDetails.icon.setVisibility(View.GONE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE); binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE);
if (Objects.equals(place.name, "")) { if (Objects.equals(place.name, "")) {
getPlaceData(place.getWikiDataEntityId(), place, marker1); getPlaceData(place.getWikiDataEntityId(), place, marker1, isBookMarked);
} else { } else {
marker.showInfoWindow(); marker.showInfoWindow();
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE); binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE);
@ -1918,7 +1927,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
binding.bottomSheetDetails.icon.setVisibility(View.GONE); binding.bottomSheetDetails.icon.setVisibility(View.GONE);
binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE); binding.bottomSheetDetails.wikiDataLl.setVisibility(View.GONE);
if (Objects.equals(updatedPlace.name, "")) { if (Objects.equals(updatedPlace.name, "")) {
getPlaceData(updatedPlace.getWikiDataEntityId(), updatedPlace, marker1); getPlaceData(updatedPlace.getWikiDataEntityId(), updatedPlace, marker1, false);
} else { } else {
marker.showInfoWindow(); marker.showInfoWindow();
binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE); binding.bottomSheetDetails.dataCircularProgress.setVisibility(View.GONE);