update:2020.05.23

fix:toast显示问题
add:
This commit is contained in:
2020-05-23 18:29:09 +08:00
parent 3bd4a64371
commit 8976698729
3 changed files with 15 additions and 11 deletions

View File

@@ -28,14 +28,20 @@ public class ToastUtil {
}
private static long time1 = 0L;
private static long time2 = 0L;
public static void show(final String msg) {
mainHandler.post(new Runnable() {
@Override
public void run() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
showToast(mContext, msg, Toast.LENGTH_LONG);
Log.e("fht", "LENGTH_LONG");
time2 = System.currentTimeMillis();
if ((time2 - time1) > 3499) {
showToast(mContext, msg, Toast.LENGTH_LONG);
Log.e("fht", "LENGTH_LONG");
time1 = time2;
}
} else {
if (toast != null) {
toast.setText(msg);