mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Add required methods to be called after map view is ready
This commit is contained in:
parent
e808b0a19e
commit
f6c1d27382
2 changed files with 36 additions and 15 deletions
|
|
@ -192,6 +192,7 @@ public class NearbyMapFragment extends CommonsDaggerSupportFragment implements N
|
|||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(mapboxMap -> {
|
||||
Log.d("deneme2","nearby map is ready");
|
||||
viewsAreReadyCallback.nearbyMapViewReady();
|
||||
/*LocalizationPlugin localizationPlugin = new LocalizationPlugin(mapView, mapboxMap);
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ public class NearbyParentFragmentPresenter
|
|||
boolean nearbyViewsAreReady;
|
||||
boolean onTabSelected;
|
||||
boolean searchingThisArea;
|
||||
boolean nearbyMapViewReady;
|
||||
boolean nearbyOperationsInitialized;
|
||||
|
||||
|
||||
private LocationServiceManager locationServiceManager;
|
||||
|
||||
|
|
@ -85,21 +88,6 @@ public class NearbyParentFragmentPresenter
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Will be called when map view is created and ready to be used.
|
||||
*/
|
||||
@Override
|
||||
public void nearbyMapViewReady() {
|
||||
Log.d("deneme2","Nearby view ready method is called");
|
||||
Timber.d("Nearby map view is created and ready");
|
||||
updateMapAndList(LOCATION_SIGNIFICANTLY_CHANGED, null);
|
||||
// TODO: document this prpoblem, if updateMapAndList is not called at checkGPS then this method never called, setup map view never ends
|
||||
this.nearbyParentFragmentView.addSearchThisAreaButtonAction();
|
||||
this.nearbyMapFragmentView.addOnCameraMoveListener(onCameraMove(getMapboxMap()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initializes nearby operations by following these steps:
|
||||
* - Add this location listener to location manager
|
||||
|
|
@ -120,8 +108,40 @@ public class NearbyParentFragmentPresenter
|
|||
// We will know when we went offline and online again
|
||||
nearbyParentFragmentView.addNetworkBroadcastReceiver();
|
||||
//nearbyMapFragmentView.setupMapView(null);
|
||||
nearbyOperationsInitialized();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Will be called when map view is created and ready to be used.
|
||||
*/
|
||||
@Override
|
||||
public void nearbyMapViewReady() {
|
||||
Log.d("deneme2","nearbyMapViewReady");
|
||||
nearbyMapViewReady = true;
|
||||
if (nearbyOperationsInitialized) {
|
||||
initializeMapOperations();
|
||||
}
|
||||
}
|
||||
|
||||
public void nearbyOperationsInitialized() {
|
||||
Log.d("deneme2","nearbyOperationsInitialized");
|
||||
nearbyOperationsInitialized = true;
|
||||
if (nearbyMapViewReady) {
|
||||
initializeMapOperations();
|
||||
}
|
||||
}
|
||||
|
||||
public void initializeMapOperations() {
|
||||
Log.d("deneme2","initializeMapOperations");
|
||||
Timber.d("Nearby map view is created and ready");
|
||||
updateMapAndList(LOCATION_SIGNIFICANTLY_CHANGED, null);
|
||||
// TODO: document this prpoblem, if updateMapAndList is not called at checkGPS then this method never called, setup map view never ends
|
||||
this.nearbyParentFragmentView.addSearchThisAreaButtonAction();
|
||||
this.nearbyMapFragmentView.addOnCameraMoveListener(onCameraMove(getMapboxMap()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Nearby updates takes time, since they are network operations. During update time, we don't
|
||||
* want to get any other calls from user. So locking nearby.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue