Prevent loding map each time tab selected

This commit is contained in:
neslihanturan 2019-09-13 18:02:15 +03:00
parent be1ca1a2ae
commit 8c9c37abcb

View file

@ -40,6 +40,7 @@ public class NearbyParentFragmentPresenter
boolean searchingThisArea; boolean searchingThisArea;
boolean nearbyMapViewReady; boolean nearbyMapViewReady;
boolean nearbyOperationsInitialized; boolean nearbyOperationsInitialized;
boolean mapInitialized; // TODO reset this on fragment destroyed
private LocationServiceManager locationServiceManager; private LocationServiceManager locationServiceManager;
@ -71,7 +72,7 @@ public class NearbyParentFragmentPresenter
Log.d("denemeTest","Nearby tab selected"); Log.d("denemeTest","Nearby tab selected");
onTabSelected = true; onTabSelected = true;
// The condition for initialize operations is both having views ready and tab is selected // The condition for initialize operations is both having views ready and tab is selected
if (nearbyViewsAreReady) { if (nearbyViewsAreReady && !mapInitialized) {
initializeNearbyOperations(); initializeNearbyOperations();
} }
} }
@ -128,6 +129,7 @@ public class NearbyParentFragmentPresenter
*/ */
@Override @Override
public void nearbyMapViewReady() { public void nearbyMapViewReady() {
// TODO: remove this
nearbyMapViewReady = true; nearbyMapViewReady = true;
if (nearbyOperationsInitialized) { if (nearbyOperationsInitialized) {
initializeMapOperations(); initializeMapOperations();
@ -155,6 +157,7 @@ public class NearbyParentFragmentPresenter
// TODO: document this prpoblem, if updateMapAndList is not called at checkGPS then this method never called, setup map view never ends // 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.nearbyParentFragmentView.addSearchThisAreaButtonAction();
this.nearbyMapFragmentView.addOnCameraMoveListener(onCameraMove(getMapboxMap())); this.nearbyMapFragmentView.addOnCameraMoveListener(onCameraMove(getMapboxMap()));
mapInitialized = true;
} }
/** /**