mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
ExploreMapFragment.java: add helper methods and fields to enable proper Explore map behavior
Before this commit, there was no way to tell if the user had arrived from the Nearby and before the Nearby map center location had been searched for markers. This commit adds a boolean flag to indicate this situation. Access, modification, and initialization methods were added for this boolean value. Additionally, a helper method to retrieve the Nearby map center LatLng was added as a convienience.
This commit is contained in:
parent
f977e16774
commit
f8f9b09e37
1 changed files with 28 additions and 0 deletions
|
|
@ -120,6 +120,7 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
|||
private double prevZoom;
|
||||
private double prevLatitude;
|
||||
private double prevLongitude;
|
||||
private boolean recentlyCameFromNearbyMap;
|
||||
|
||||
private ExploreMapPresenter presenter;
|
||||
|
||||
|
|
@ -371,6 +372,16 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
|||
prevLatitude = getArguments().getDouble("prev_latitude");
|
||||
prevLongitude = getArguments().getDouble("prev_longitude");
|
||||
}
|
||||
|
||||
setRecentlyCameFromNearbyMap(isCameFromNearbyMap());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The LatLng from the previous Fragment's map center or (0,0,0) coordinates
|
||||
* if that information is not available/applicable.
|
||||
*/
|
||||
public LatLng getPreviousLatLng() {
|
||||
return new LatLng(prevLatitude, prevLongitude, (float)prevZoom);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -383,6 +394,23 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
|||
return prevZoom != 0.0 || prevLatitude != 0.0 || prevLongitude != 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value that indicates if the user navigated from "Show in Explore" in Nearby and
|
||||
* that the LatLng from Nearby has yet to be searched for map markers.
|
||||
*/
|
||||
public boolean recentlyCameFromNearbyMap() {
|
||||
return recentlyCameFromNearbyMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value that indicates if the user navigated from "Show in Explore" in Nearby and
|
||||
* that the LatLng from Nearby has yet to be searched for map markers.
|
||||
* @param newValue The value to set.
|
||||
*/
|
||||
public void setRecentlyCameFromNearbyMap(boolean newValue) {
|
||||
recentlyCameFromNearbyMap = newValue;
|
||||
}
|
||||
|
||||
public void loadNearbyMapFromExplore() {
|
||||
((MainActivity) getContext()).loadNearbyMapFromExplore(
|
||||
binding.mapView.getZoomLevelDouble(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue