Skip to content

Commit

Permalink
Call Toast.makeText on UI thread
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumBadger committed Sep 23, 2020
1 parent 899a7ba commit 6ffd40b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/org/quantumbadger/redreader/common/General.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package org.quantumbadger.redreader.common;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
Expand Down Expand Up @@ -152,18 +151,17 @@ public static void quickToast(final Context context, final int textRes) {
quickToast(context, context.getString(textRes));
}

@SuppressLint("ShowToast")
public static void quickToast(final Context context, final String text) {
AndroidCommon.UI_THREAD_HANDLER.post(
Toast.makeText(context, text, Toast.LENGTH_LONG)::show);
() -> Toast.makeText(context, text, Toast.LENGTH_LONG).show());
}

@SuppressLint("ShowToast")
public static void quickToast(
final Context context,
final String text,
final int duration) {
AndroidCommon.UI_THREAD_HANDLER.post(Toast.makeText(context, text, duration)::show);
AndroidCommon.UI_THREAD_HANDLER.post(
() -> Toast.makeText(context, text, duration).show());
}

public static boolean isTablet(
Expand Down

0 comments on commit 6ffd40b

Please sign in to comment.