@@ -597,8 +597,7 @@ private void initRvNearbyList() {
597
597
return Unit .INSTANCE ;
598
598
},
599
599
(place , isBookmarked ) -> {
600
- updateMarker (isBookmarked , place , null );
601
- binding .map .invalidate ();
600
+ presenter .toggleBookmarkedStatus (place );
602
601
return Unit .INSTANCE ;
603
602
},
604
603
commonPlaceClickActions ,
@@ -1795,21 +1794,6 @@ public LatLng getCameraTarget() {
1795
1794
return binding .map == null ? null : getMapFocus ();
1796
1795
}
1797
1796
1798
- /**
1799
- * Sets marker icon according to marker status. Sets title and distance.
1800
- *
1801
- * @param isBookmarked true if place is bookmarked
1802
- * @param place
1803
- * @param currentLatLng current location
1804
- */
1805
- public void updateMarker (final boolean isBookmarked , final Place place ,
1806
- @ Nullable final LatLng currentLatLng ) {
1807
- if (true ) {
1808
- return ; // TODO move this method to new overlay mangement logic
1809
- }
1810
- addMarkerToMap (place , isBookmarked );
1811
- }
1812
-
1813
1797
/**
1814
1798
* Highlights nearest place when user clicks on home nearby banner
1815
1799
*
@@ -1863,16 +1847,6 @@ private void highlightNearestPlace(final Place nearestPlace) {
1863
1847
);
1864
1848
}
1865
1849
1866
- /**
1867
- * Adds a marker representing a place to the map with optional bookmark icon.
1868
- *
1869
- * @param place The Place object containing information about the location.
1870
- * @param isBookMarked A Boolean flag indicating whether the place is bookmarked or not.
1871
- */
1872
- private void addMarkerToMap (Place place , Boolean isBookMarked ) {
1873
- binding .map .getOverlays ().add (convertToMarker (place , isBookMarked ));
1874
- }
1875
-
1876
1850
public Marker convertToMarker (Place place , Boolean isBookMarked ) {
1877
1851
Drawable icon = ContextCompat .getDrawable (getContext (), getIconFor (place , isBookMarked ));
1878
1852
GeoPoint point = new GeoPoint (place .location .getLatitude (), place .location .getLongitude ());
@@ -2301,21 +2275,14 @@ private void moveCameraToPosition(GeoPoint geoPoint) {
2301
2275
@ Override
2302
2276
public void onBottomSheetItemClick (@ Nullable View view , int position ) {
2303
2277
BottomSheetItem item = dataList .get (position );
2304
- boolean isBookmarked = bookmarkLocationDao .findBookmarkLocation (selectedPlace );
2305
2278
switch (item .getImageResourceId ()) {
2306
2279
case R .drawable .ic_round_star_border_24px :
2307
- bookmarkLocationDao . updateBookmarkLocation (selectedPlace );
2280
+ presenter . toggleBookmarkedStatus (selectedPlace );
2308
2281
updateBookmarkButtonImage (selectedPlace );
2309
- isBookmarked = bookmarkLocationDao .findBookmarkLocation (selectedPlace );
2310
- updateMarker (isBookmarked , selectedPlace , locationManager .getLastLocation ());
2311
- binding .map .invalidate ();
2312
2282
break ;
2313
2283
case R .drawable .ic_round_star_filled_24px :
2314
- bookmarkLocationDao . updateBookmarkLocation (selectedPlace );
2284
+ presenter . toggleBookmarkedStatus (selectedPlace );
2315
2285
updateBookmarkButtonImage (selectedPlace );
2316
- isBookmarked = bookmarkLocationDao .findBookmarkLocation (selectedPlace );
2317
- updateMarker (isBookmarked , selectedPlace , locationManager .getLastLocation ());
2318
- binding .map .invalidate ();
2319
2286
break ;
2320
2287
case R .drawable .ic_directions_black_24dp :
2321
2288
Utils .handleGeoCoordinates (this .getContext (), selectedPlace .getLocation ());
0 commit comments