diff --git a/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapFragment.java b/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapFragment.java
index 613c6d5f5..ddfc91b9e 100644
--- a/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapFragment.java
+++ b/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapFragment.java
@@ -447,13 +447,16 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
.observeOn(AndroidSchedulers.mainThread())
.subscribe(explorePlacesInfo -> {
mediaList = explorePlacesInfo.mediaList;
+ if(mediaList == null) {
+ showResponseMessage(getString(R.string.no_pictures_in_this_area));
+ }
updateMapMarkers(explorePlacesInfo);
lastMapFocus = new GeoPoint(curLatLng.getLatitude(), curLatLng.getLongitude());
},
throwable -> {
Timber.d(throwable);
showErrorMessage(getString(R.string.error_fetching_nearby_places)
- + throwable.getLocalizedMessage());
+ + throwable.getLocalizedMessage());
setProgressBarVisibility(false);
presenter.lockUnlockNearby(false);
}));
@@ -475,6 +478,10 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
ViewUtil.showLongToast(getActivity(), message);
}
+ private void showResponseMessage(final String message) {
+ ViewUtil.showLongSnackbar(getView(), message);
+ }
+
@Override
public void checkPermissionsAndPerformAction() {
Timber.d("Checking permission and perfoming action");
diff --git a/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapPresenter.java b/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapPresenter.java
index 03ce30c7e..7bf0a8f41 100644
--- a/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapPresenter.java
+++ b/app/src/main/java/fr/free/nrw/commons/explore/map/ExploreMapPresenter.java
@@ -167,7 +167,6 @@ public class ExploreMapPresenter
if (explorePlacesInfo.mediaList != null) {
prepareNearbyBaseMarkers(explorePlacesInfo, selectedMarker);
} else {
- //TODO: SHOW SNACKBAR
lockUnlockNearby(false); // So that new location updates wont come
exploreMapFragmentView.setProgressBarVisibility(false);
}
diff --git a/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java b/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java
index ef78e5c57..1e0117da5 100644
--- a/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java
+++ b/app/src/main/java/fr/free/nrw/commons/utils/ViewUtil.java
@@ -1,16 +1,22 @@
package fr.free.nrw.commons.utils;
+import static java.security.AccessController.getContext;
+
import android.app.Activity;
import android.content.Context;
+import android.graphics.Color;
import android.view.Display;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
+import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.StringRes;
+import androidx.core.content.ContextCompat;
import com.google.android.material.snackbar.Snackbar;
+import fr.free.nrw.commons.R;
import timber.log.Timber;
public class ViewUtil {
@@ -32,6 +38,37 @@ public class ViewUtil {
}
});
}
+ public static void showLongSnackbar(View view, String text) {
+ if(view.getContext() == null) {
+ return;
+ }
+
+ ExecutorUtils.uiExecutor().execute(()-> {
+ try {
+ Snackbar snackbar = Snackbar.make(view, text, Snackbar.LENGTH_SHORT);
+
+ View snack_view = snackbar.getView();
+ TextView snack_text = snack_view.findViewById(R.id.snackbar_text);
+
+ snack_view.setBackgroundColor(Color.LTGRAY);
+ snack_text.setTextColor(ContextCompat.getColor(view.getContext(), R.color.primaryColor));
+ snackbar.setActionTextColor(Color.RED);
+
+ snackbar.setAction("Dismiss", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // Handle the action click
+ snackbar.dismiss();
+ }
+ });
+
+ snackbar.show();
+
+ }catch (IllegalStateException e) {
+ Timber.e(e.getMessage());
+ }
+ });
+ }
public static void showLongToast(Context context, String text) {
if (context == null) {
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 6c6a2ab74..2d0ab4e42 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -355,6 +355,7 @@
Rotate
Error fetching nearby places.
+ No pictures in this area
No nearby places around
Error fetching nearby monuments.
No recent searches