mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add bookmark from list fragment
This commit is contained in:
parent
9f8becc581
commit
4304e3d018
3 changed files with 12 additions and 7 deletions
|
|
@ -33,9 +33,11 @@ import fr.free.nrw.commons.bookmarks.locations.BookmarkLocationsDao;
|
|||
import fr.free.nrw.commons.contributions.ContributionController;
|
||||
import fr.free.nrw.commons.di.ApplicationlessInjection;
|
||||
import fr.free.nrw.commons.kvstore.JsonKvStore;
|
||||
import fr.free.nrw.commons.nearby.mvp.fragments.NearbyMapFragment;
|
||||
import fr.free.nrw.commons.nearby.mvp.fragments.NearbyParentFragment;
|
||||
import timber.log.Timber;
|
||||
|
||||
import static fr.free.nrw.commons.nearby.mvp.fragments.NearbyParentFragment.TAG_RETAINED_MAP_FRAGMENT;
|
||||
import static fr.free.nrw.commons.theme.NavigationBaseActivity.startActivityWithFlags;
|
||||
import static fr.free.nrw.commons.wikidata.WikidataConstants.PLACE_OBJECT;
|
||||
|
||||
|
|
@ -191,8 +193,9 @@ public class PlaceRenderer extends Renderer<Place> {
|
|||
onBookmarkClick.onClick();
|
||||
}
|
||||
else {
|
||||
// TODO nesli
|
||||
//((NearbyMapFragment)((NearbyFragment)((NearbyListFragment)fragment).getParentFragment()).getChildFragmentManager().findFragmentByTag(NearbyMapFragment.class.getSimpleName())).updateMarker(isBookmarked, place);
|
||||
((NearbyMapFragment)(fragment.getParentFragment()).getChildFragmentManager().
|
||||
findFragmentByTag(TAG_RETAINED_MAP_FRAGMENT)).
|
||||
updateMarker(isBookmarked, place, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment
|
|||
});
|
||||
}
|
||||
|
||||
public void updateMarker(boolean isBookmarked, Place place, LatLng curLatLng) {
|
||||
public void updateMarker(boolean isBookmarked, Place place, @Nullable LatLng curLatLng) {
|
||||
|
||||
VectorDrawableCompat vectorDrawable;
|
||||
if (isBookmarked) {
|
||||
|
|
@ -421,8 +421,10 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment
|
|||
if (marker.getTitle() != null && marker.getTitle().equals(place.getName())) {
|
||||
|
||||
Bitmap icon = UiUtils.getBitmap(vectorDrawable);
|
||||
String distance = formatDistanceBetween(curLatLng, place.location);
|
||||
place.setDistance(distance);
|
||||
if (curLatLng != null) {
|
||||
String distance = formatDistanceBetween(curLatLng, place.location);
|
||||
place.setDistance(distance);
|
||||
}
|
||||
|
||||
NearbyBaseMarker nearbyBaseMarker = new NearbyBaseMarker();
|
||||
nearbyBaseMarker.title(place.name);
|
||||
|
|
|
|||
|
|
@ -206,8 +206,8 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
|||
NearbyMapFragment nearbyMapFragment;
|
||||
|
||||
private fr.free.nrw.commons.nearby.NearbyListFragment nearbyListFragment;
|
||||
private static final String TAG_RETAINED_MAP_FRAGMENT = com.mapbox.mapboxsdk.maps.SupportMapFragment.class.getSimpleName();
|
||||
private static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
||||
public static final String TAG_RETAINED_MAP_FRAGMENT = NearbyMapFragment.class.getSimpleName();
|
||||
public static final String TAG_RETAINED_LIST_FRAGMENT = NearbyListFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue