mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Explore: On 'Show in Nearby' click, navigate to Nearby fragment, passing map data as fragment args
This commit is contained in:
parent
9a6f68374c
commit
9d590fdee4
3 changed files with 16 additions and 1 deletions
|
|
@ -233,6 +233,9 @@ public class ExploreFragment extends CommonsDaggerSupportFragment {
|
|||
case R.id.action_search:
|
||||
ActivityUtils.startActivityWithFlags(getActivity(), SearchActivity.class);
|
||||
return true;
|
||||
case R.id.list_item_show_in_nearby:
|
||||
mapRootFragment.loadNearbyMapFromExplore();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,6 +226,10 @@ public class ExploreMapRootFragment extends CommonsDaggerSupportFragment impleme
|
|||
return false;
|
||||
}
|
||||
|
||||
public void loadNearbyMapFromExplore() {
|
||||
mapFragment.loadNearbyMapFromExplore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import fr.free.nrw.commons.Media;
|
|||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.Utils;
|
||||
import fr.free.nrw.commons.bookmarks.locations.BookmarkLocationsDao;
|
||||
import fr.free.nrw.commons.contributions.MainActivity;
|
||||
import fr.free.nrw.commons.databinding.FragmentExploreMapBinding;
|
||||
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment;
|
||||
import fr.free.nrw.commons.explore.ExploreMapRootFragment;
|
||||
|
|
@ -62,7 +63,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.osmdroid.api.IGeoPoint;
|
||||
import org.osmdroid.events.MapEventsReceiver;
|
||||
import org.osmdroid.events.MapListener;
|
||||
import org.osmdroid.events.ScrollEvent;
|
||||
|
|
@ -375,6 +375,14 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
|||
return prevZoom != 0.0 || prevLatitude != 0.0 || prevLongitude != 0.0;
|
||||
}
|
||||
|
||||
public void loadNearbyMapFromExplore() {
|
||||
((MainActivity) getContext()).loadNearbyMapFromExplore(
|
||||
binding.mapView.getZoomLevelDouble(),
|
||||
binding.mapView.getMapCenter().getLatitude(),
|
||||
binding.mapView.getMapCenter().getLongitude()
|
||||
);
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
Timber.d("init views called");
|
||||
initBottomSheets();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue