Skip to content

Commit ef73204

Browse files
spelkadomdomegg
authored andcommitted
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.
1 parent e8f4a28 commit ef73204

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import android.os.Handler;
1414
import android.support.annotation.NonNull;
1515
import android.support.design.widget.BottomSheetBehavior;
16+
import android.support.design.widget.Snackbar;
1617
import android.support.v4.app.FragmentTransaction;
1718
import android.support.v7.app.AlertDialog;
1819
import android.view.Menu;
@@ -371,15 +372,17 @@ public void onPause() {
371372

372373
private void addNetworkBroadcastReceiver() {
373374
IntentFilter intentFilter = new IntentFilter(NETWORK_INTENT_ACTION);
375+
Snackbar snackbar = Snackbar.make(transparentView , R.string.no_internet, Snackbar.LENGTH_INDEFINITE);
374376

375377
broadcastReceiver = new BroadcastReceiver() {
376378

377379
@Override
378380
public void onReceive(Context context, Intent intent) {
379381
if (NetworkUtils.isInternetConnectionEstablished(NearbyActivity.this)) {
380382
refreshView(LOCATION_SIGNIFICANTLY_CHANGED);
383+
snackbar.dismiss();
381384
} else {
382-
ViewUtil.showLongToast(NearbyActivity.this, getString(R.string.no_internet));
385+
snackbar.show();
383386
}
384387
}
385388
};

0 commit comments

Comments
 (0)