removed Search This Area button if network connection is lost (#2774)

* removed Search This Area button if no connection is lost
This commit is contained in:
Shubham Pinjwani 2019-04-26 13:38:43 +05:30 committed by neslihanturan
parent 13ea61c7a7
commit 40e8182c9b
2 changed files with 5 additions and 1 deletions

View file

@ -729,6 +729,9 @@ public class NearbyFragment extends CommonsDaggerSupportFragment
} else {
if (snackbar == null) {
snackbar = Snackbar.make(view, R.string.no_internet, Snackbar.LENGTH_INDEFINITE);
if (nearbyMapFragment != null && nearbyMapFragment.searchThisAreaButton != null) {
nearbyMapFragment.searchThisAreaButton.setVisibility(View.GONE);
}
}
isNetworkErrorOccured = true;

View file

@ -64,6 +64,7 @@ import fr.free.nrw.commons.bookmarks.locations.BookmarkLocationsDao;
import fr.free.nrw.commons.contributions.ContributionController;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.utils.LocationUtils;
import fr.free.nrw.commons.utils.NetworkUtils;
import fr.free.nrw.commons.utils.UiUtils;
import fr.free.nrw.commons.utils.ViewUtil;
import timber.log.Timber;
@ -571,7 +572,7 @@ public class NearbyMapFragment extends DaggerFragment {
if (NearbyController.currentLocation != null) { // If our nearby markers are calculated at least once
if (searchThisAreaButton.getVisibility() == View.GONE) {
if (searchThisAreaButton.getVisibility() == View.GONE && NetworkUtils.isInternetConnectionEstablished(getContext())) {
searchThisAreaButton.setVisibility(View.VISIBLE);
}
double distance = mapboxMap.getCameraPosition().target