From 2092bd7b5caa456eba3bae991116a6d77cb921be Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 13 Nov 2020 18:31:10 +0100 Subject: [PATCH] Set busy on encrypt --- .../eu/faircode/email/FragmentCompose.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index f046bb8732..c285df06ab 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2317,6 +2317,16 @@ public class FragmentCompose extends FragmentBase { args.putParcelable("data", data); new SimpleTask() { + @Override + protected void onPreExecute(Bundle args) { + setBusy(true); + } + + @Override + protected void onPostExecute(Bundle args) { + setBusy(false); + } + @Override protected Object onExecute(Context context, Bundle args) throws Throwable { // Get arguments @@ -2620,6 +2630,16 @@ public class FragmentCompose extends FragmentBase { private void onSmime(Bundle args, final int action, final Bundle extras) { new SimpleTask() { + @Override + protected void onPreExecute(Bundle args) { + setBusy(true); + } + + @Override + protected void onPostExecute(Bundle args) { + setBusy(false); + } + @Override protected Void onExecute(Context context, Bundle args) throws Throwable { long id = args.getLong("id"); @@ -4909,12 +4929,6 @@ public class FragmentCompose extends FragmentBase { } } - private void setBusy(boolean busy) { - state = (busy ? State.LOADING : State.LOADED); - Helper.setViewsEnabled(view, !busy); - getActivity().invalidateOptionsMenu(); - } - private void checkAddress(InternetAddress[] addresses, Context context) throws AddressException { if (addresses == null) return; @@ -4944,6 +4958,12 @@ public class FragmentCompose extends FragmentBase { } }; + private void setBusy(boolean busy) { + state = (busy ? State.LOADING : State.LOADED); + Helper.setViewsEnabled(view, !busy); + getActivity().invalidateOptionsMenu(); + } + private static String unprefix(String subject, String prefix) { subject = subject.trim(); prefix = prefix.trim().toLowerCase();