From defa97b882ace9521b6a1ee4b81a1d264f2aace0 Mon Sep 17 00:00:00 2001 From: cpfeiffer Date: Wed, 24 Feb 2016 23:53:30 +0100 Subject: [PATCH] Log the toast message immediately, not delayed in the main thread (this helps understanding logs) --- .../java/nodomain/freeyourgadget/gadgetbridge/util/GB.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java index 7571badc..c6f87cff 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/util/GB.java @@ -202,18 +202,17 @@ public class GB { * @param ex optional exception to be logged */ public static void toast(final Context context, final String message, final int displayTime, final int severity, final Throwable ex) { + log(message, severity, ex); // log immediately, not delayed if (env().isLocalTest()) { return; } Looper mainLooper = Looper.getMainLooper(); if (Thread.currentThread() == mainLooper.getThread()) { - log(message, severity, ex); Toast.makeText(context, message, displayTime).show(); } else { Runnable runnable = new Runnable() { @Override public void run() { - log(message, severity, ex); Toast.makeText(context, message, displayTime).show(); } };