diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java
index 60f56241a..0310fb287 100644
--- a/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java
+++ b/app/src/main/java/fr/free/nrw/commons/nearby/NearbyActivity.java
@@ -70,7 +70,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
private NearbyMapFragment nearbyMapFragment;
private static final String TAG_RETAINED_FRAGMENT = "RetainedFragment";
- @BindView(R.id.swipe_container) SwipeRefreshLayout swipeLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -81,13 +80,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
initBottomSheetBehaviour();
initDrawer();
- swipeLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
- @Override
- public void onRefresh() {
- lockNearbyView(false);
- refreshView(true);
- }
- });
}
private void resumeFragment() {
@@ -142,10 +134,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
- case R.id.action_refresh:
- lockNearbyView(false);
- refreshView(true);
- return true;
case R.id.action_display_list:
bottomSheetBehaviorForDetails.setState(BottomSheetBehavior.STATE_HIDDEN);
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
@@ -166,7 +154,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
switch (requestCode) {
case LOCATION_REQUEST: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
- refreshView(false);
+ refreshView();
} else {
//If permission not granted, go to page that says Nearby Places cannot be displayed
hideProgressBar();
@@ -221,7 +209,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
private void checkLocationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (locationManager.isLocationPermissionGranted()) {
- refreshView(false);
+ refreshView();
} else {
// Should we show an explanation?
if (locationManager.isPermissionExplanationRequired(this)) {
@@ -247,7 +235,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
}
}
} else {
- refreshView(false);
+ refreshView();
}
}
@@ -256,7 +244,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1) {
Timber.d("User is back from Settings page");
- refreshView(false);
+ refreshView();
}
}
@@ -306,18 +294,15 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
/**
* This method should be the single point to load/refresh nearby places
*
- * @param isHardRefresh Should display a toast if the location hasn't changed
*/
- private void refreshView(boolean isHardRefresh) {
+ private void refreshView() {
if (lockNearbyView) {
return;
}
locationManager.registerLocationManager();
LatLng lastLocation = locationManager.getLastLocation();
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
- if (isHardRefresh) {
- ViewUtil.showLongToast(this, R.string.nearby_location_has_not_changed);
- }
+
return;
}
curLatLang = lastLocation;
@@ -357,7 +342,6 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
setListFragment();
hideProgressBar();
- swipeLayout.setRefreshing(false);
}
private void lockNearbyView(boolean lock) {
@@ -403,7 +387,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
@Override
public void onLocationChanged(LatLng latLng) {
- refreshView(false);
+ refreshView();
}
public void prepareViewsForSheetPosition(int bottomSheetState) {
diff --git a/app/src/main/res/layout/activity_nearby.xml b/app/src/main/res/layout/activity_nearby.xml
index acad6f19e..a963636c0 100644
--- a/app/src/main/res/layout/activity_nearby.xml
+++ b/app/src/main/res/layout/activity_nearby.xml
@@ -26,19 +26,16 @@
android:layout_below="@id/toolbar"
android:gravity="center_vertical"
android:orientation="horizontal">
-
-
-
-
+
+
+
+
-
-
\ No newline at end of file