mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Added showSnackbar in ViewUtil and shown in NearbyActivity
This commit is contained in:
parent
2516445d68
commit
9f621539c7
2 changed files with 16 additions and 3 deletions
|
|
@ -274,7 +274,8 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
LatLng lastLocation = locationManager.getLastLocation();
|
LatLng lastLocation = locationManager.getLastLocation();
|
||||||
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
|
if (curLatLang != null && curLatLang.equals(lastLocation)) { //refresh view only if location has changed
|
||||||
if (isHardRefresh) {
|
if (isHardRefresh) {
|
||||||
ViewUtil.showLongToast(this, R.string.nearby_location_has_not_changed);
|
// ViewUtil.showLongToast(this, R.string.nearby_location_has_not_changed);
|
||||||
|
ViewUtil.showSnackbar(findViewById(R.id.container), R.string.nearby_location_has_not_changed);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -302,8 +303,9 @@ public class NearbyActivity extends NavigationBaseActivity implements LocationUp
|
||||||
|
|
||||||
if (placeList.size() == 0) {
|
if (placeList.size() == 0) {
|
||||||
int duration = Toast.LENGTH_SHORT;
|
int duration = Toast.LENGTH_SHORT;
|
||||||
Toast toast = Toast.makeText(this, R.string.no_nearby, duration);
|
ViewUtil.showSnackbar(findViewById(R.id.container), R.string.no_nearby);
|
||||||
toast.show();
|
// Toast toast = Toast.makeText(this, R.string.no_nearby, duration);
|
||||||
|
// toast.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
bundle.clear();
|
bundle.clear();
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package fr.free.nrw.commons.utils;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.StringRes;
|
import android.support.annotation.StringRes;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.view.View;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class ViewUtil {
|
public class ViewUtil {
|
||||||
|
|
@ -9,4 +11,13 @@ public class ViewUtil {
|
||||||
public static void showLongToast(final Context context, @StringRes final int stringResId) {
|
public static void showLongToast(final Context context, @StringRes final int stringResId) {
|
||||||
ExecutorUtils.uiExecutor().execute(() -> Toast.makeText(context, context.getString(stringResId), Toast.LENGTH_LONG).show());
|
ExecutorUtils.uiExecutor().execute(() -> Toast.makeText(context, context.getString(stringResId), Toast.LENGTH_LONG).show());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void showLongSnackbar(View view, String message) {
|
||||||
|
Snackbar.make(view, message, Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showSnackbar(View view, int messageResourceId) {
|
||||||
|
Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue