Add a boolean to enable refresh after orientation changed

This commit is contained in:
neslihanturan 2018-12-06 14:17:27 +03:00
parent 677e0099af
commit c7b7522edd
2 changed files with 10 additions and 2 deletions

View file

@ -428,8 +428,7 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
}
private void updateMapFragment(boolean updateViaButton, boolean isSlightUpdate, @Nullable LatLng customLatLng, @Nullable NearbyController.NearbyPlacesInfo nearbyPlacesInfo) {
if (nearbyMapFragment.searchThisAreaModeOn) {
if (nearbyMapFragment.checkingAround) {
return;
}
/*

View file

@ -130,6 +130,7 @@ public class NearbyMapFragment extends DaggerFragment {
private boolean isMapReady;
public boolean searchThisAreaModeOn = false;
public boolean checkingAround = false;
private Bundle bundleForUpdtes;// Carry information from activity about changed nearby places and current location
private boolean searchedAroundCurrentLocation = true;
@ -556,6 +557,7 @@ public class NearbyMapFragment extends DaggerFragment {
, NearbyController.currentLocation.getLongitude()));
if (distance > NearbyController.searchedRadius*1000*3/4) { //Convert to meter, and compare if our distance is bigger than 3/4 or our searched area
checkingAround = true;
if (!searchThisAreaModeOn) { // If we are changing mode, then change click action
searchThisAreaModeOn = true;
searchThisAreaButton.setOnClickListener(new View.OnClickListener() {
@ -575,6 +577,7 @@ public class NearbyMapFragment extends DaggerFragment {
}
} else {
checkingAround = false;
if (searchThisAreaModeOn) {
searchThisAreaModeOn = false; // This flag will help us to understand should we folor users location or not
searchThisAreaButton.setOnClickListener(new View.OnClickListener() {
@ -1002,6 +1005,12 @@ public class NearbyMapFragment extends DaggerFragment {
if (mapView != null) {
mapView.onResume();
}
if (mapboxMap != null) {
mapboxMap.getUiSettings().setAllGesturesEnabled(true);
}
searchThisAreaModeOn = false;
checkingAround = false;
searchedAroundCurrentLocation = true;
initViews();
setListeners();
transparentView.setClickable(false);