mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Fix view util methods to always execute on UI thread (#1728)
This commit is contained in:
parent
7b5b9169db
commit
5cfe709281
1 changed files with 10 additions and 3 deletions
|
|
@ -15,12 +15,19 @@ public class ViewUtil {
|
|||
public static final String SHOWCASE_VIEW_ID_3 = "SHOWCASE_VIEW_ID_3";
|
||||
|
||||
public static void showSnackbar(View view, int messageResourceId) {
|
||||
Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show();
|
||||
if(view.getContext() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ExecutorUtils.uiExecutor().execute(() -> Snackbar.make(view, messageResourceId, Snackbar.LENGTH_SHORT).show());
|
||||
}
|
||||
|
||||
public static void showLongToast(Context context, String text) {
|
||||
Toast.makeText(context, text,
|
||||
Toast.LENGTH_LONG).show();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ExecutorUtils.uiExecutor().execute(() -> Toast.makeText(context, text, Toast.LENGTH_LONG).show());
|
||||
}
|
||||
|
||||
public static boolean isPortrait(Context context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue