From fde13733d27fcc96efa1326bb73ae353335d10d4 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 20 Dec 2018 19:42:38 +0100 Subject: [PATCH] Use context looper --- app/src/main/java/eu/faircode/email/FragmentCompose.java | 4 ++-- app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 47b26bb480..ac4125f9af 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1629,7 +1629,7 @@ public class FragmentCompose extends FragmentEx { EntityOperation.queue(db, draft, EntityOperation.DELETE); if (!empty) { - Handler handler = new Handler(Looper.getMainLooper()); + Handler handler = new Handler(context.getMainLooper()); handler.post(new Runnable() { public void run() { Toast.makeText(context, R.string.title_draft_deleted, Toast.LENGTH_LONG).show(); @@ -1639,7 +1639,7 @@ public class FragmentCompose extends FragmentEx { } else if (action == R.id.action_save || action == R.id.menu_encrypt) { EntityOperation.queue(db, draft, EntityOperation.ADD); - Handler handler = new Handler(Looper.getMainLooper()); + Handler handler = new Handler(context.getMainLooper()); handler.post(new Runnable() { public void run() { Toast.makeText(context, R.string.title_draft_saved, Toast.LENGTH_LONG).show(); diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 8cc8b8e057..e3c2926880 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -2564,7 +2564,7 @@ public class ServiceSynchronize extends LifecycleService { if (outbox != null) { db.folder().setFolderError(outbox.id, null); - handler = new Handler(Looper.getMainLooper()) { + handler = new Handler(getMainLooper()) { private LiveData> liveOperations; @Override