From ef73204cc00ca5c6db70c419e8db9aae3dc3620b Mon Sep 17 00:00:00 2001 From: spelka Date: Sat, 3 Nov 2018 05:37:57 -0700 Subject: [PATCH] Fix #1921, missing information about internet connectivity on nearby page The reported issue is that in the Nearby activity, the app does not communicate that there is no internet connection. On investigation, it appears that a toast message does briefly display "No internet connection". It looks like other activities have implemented this same message within the snackbar instead. In order to have a consistent style of communication to the user, I removed the toast message and replace it with the snackbar message, as implemented in NotificationActivity.java. --- .../main/java/fr/free/nrw/commons/nearby/NearbyActivity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 2143496f0..b80e6e2a3 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 @@ -13,6 +13,7 @@ import android.os.Bundle; import android.os.Handler; import android.support.annotation.NonNull; import android.support.design.widget.BottomSheetBehavior; +import android.support.design.widget.Snackbar; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AlertDialog; import android.view.Menu; @@ -371,6 +372,7 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp private void addNetworkBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION); + Snackbar snackbar = Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE); broadcastReceiver = new BroadcastReceiver() { @@ -378,8 +380,9 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp public void onReceive(Context context, Intent intent) { if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) { refreshView(LOCATION_SIGNIFICANTLY_CHANGED); + snackbar.dismiss(); } else { - ViewUtil.showLongToast(NearbyActivity.this, getString(R.string.no_internet)); + snackbar.show(); } } };