Skip to content

Commit c7b7522

Browse files
committed
Add a boolean to enable refresh after orientation changed
1 parent 677e009 commit c7b7522

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/src/main/java/fr/free/nrw/commons/nearby/NearbyFragment.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ private void lockNearbyView(boolean lock) {
428428
}
429429

430430
private void updateMapFragment(boolean updateViaButton, boolean isSlightUpdate, @Nullable LatLng customLatLng, @Nullable NearbyController.NearbyPlacesInfo nearbyPlacesInfo) {
431-
432-
if (nearbyMapFragment.searchThisAreaModeOn) {
431+
if (nearbyMapFragment.checkingAround) {
433432
return;
434433
}
435434
/*

app/src/main/java/fr/free/nrw/commons/nearby/NearbyMapFragment.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ public class NearbyMapFragment extends DaggerFragment {
130130

131131
private boolean isMapReady;
132132
public boolean searchThisAreaModeOn = false;
133+
public boolean checkingAround = false;
133134

134135
private Bundle bundleForUpdtes;// Carry information from activity about changed nearby places and current location
135136
private boolean searchedAroundCurrentLocation = true;
@@ -556,6 +557,7 @@ public void onCameraMove() {
556557
, NearbyController.currentLocation.getLongitude()));
557558

558559
if (distance > NearbyController.searchedRadius*1000*3/4) { //Convert to meter, and compare if our distance is bigger than 3/4 or our searched area
560+
checkingAround = true;
559561
if (!searchThisAreaModeOn) { // If we are changing mode, then change click action
560562
searchThisAreaModeOn = true;
561563
searchThisAreaButton.setOnClickListener(new View.OnClickListener() {
@@ -575,6 +577,7 @@ public void onClick(View view) {
575577
}
576578

577579
} else {
580+
checkingAround = false;
578581
if (searchThisAreaModeOn) {
579582
searchThisAreaModeOn = false; // This flag will help us to understand should we folor users location or not
580583
searchThisAreaButton.setOnClickListener(new View.OnClickListener() {
@@ -1002,6 +1005,12 @@ public void onResume() {
10021005
if (mapView != null) {
10031006
mapView.onResume();
10041007
}
1008+
if (mapboxMap != null) {
1009+
mapboxMap.getUiSettings().setAllGesturesEnabled(true);
1010+
}
1011+
searchThisAreaModeOn = false;
1012+
checkingAround = false;
1013+
searchedAroundCurrentLocation = true;
10051014
initViews();
10061015
setListeners();
10071016
transparentView.setClickable(false);

0 commit comments

Comments
 (0)