From 658a484e4f4db20a1022b229bc6c9a5d93f5fe87 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 18 Nov 2023 09:58:29 +0100 Subject: [PATCH] Refactoring --- .../main/java/eu/faircode/email/FragmentCompose.java | 12 ++++++------ ...aderComposeAction.java => TaskComposeAction.java} | 8 ++++---- ...LoaderComposeDraft.java => TaskComposeDraft.java} | 6 +++--- .../{LoaderComposePgp.java => TaskComposePgp.java} | 4 ++-- ...LoaderComposeSMime.java => TaskComposeSMime.java} | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) rename app/src/main/java/eu/faircode/email/{LoaderComposeAction.java => TaskComposeAction.java} (99%) rename app/src/main/java/eu/faircode/email/{LoaderComposeDraft.java => TaskComposeDraft.java} (99%) rename app/src/main/java/eu/faircode/email/{LoaderComposePgp.java => TaskComposePgp.java} (99%) rename app/src/main/java/eu/faircode/email/{LoaderComposeSMime.java => TaskComposeSMime.java} (99%) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 68a7b140e9..ada9e449dc 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -3733,7 +3733,7 @@ public class FragmentCompose extends FragmentBase { pgpLoader.serial().execute(this, args, "compose:pgp"); } - private final SimpleTask pgpLoader = new LoaderComposePgp() { + private final SimpleTask pgpLoader = new TaskComposePgp() { @Override protected void onPreExecute(Bundle args) { setBusy(true); @@ -3804,7 +3804,7 @@ public class FragmentCompose extends FragmentBase { sMimeLoader.serial().execute(this, args, "compose:s/mime"); } - private final SimpleTask sMimeLoader = new LoaderComposeSMime() { + private final SimpleTask sMimeLoader = new TaskComposeSMime() { @Override protected void onPreExecute(Bundle args) { setBusy(true); @@ -4259,10 +4259,10 @@ public class FragmentCompose extends FragmentBase { args.putBundle("extras", extras); Log.i("Run execute id=" + working + " reason=" + reason); - actionLoader.execute(this, args, "compose:action:" + LoaderComposeAction.getActionName(action)); + actionLoader.execute(this, args, "compose:action:" + TaskComposeAction.getActionName(action)); } - private final SimpleTask draftLoader = new LoaderComposeDraft() { + private final SimpleTask draftLoader = new TaskComposeDraft() { @Override protected void onExecuted(Bundle args, final ComposeHelper.DraftData data) { final String action = getArguments().getString("action"); @@ -4614,7 +4614,7 @@ public class FragmentCompose extends FragmentBase { } }.serial(); - private final SimpleTask actionLoader = new LoaderComposeAction() { + private final SimpleTask actionLoader = new TaskComposeAction() { @Override protected void onPreExecute(Bundle args) { if (args.getBundle("extras").getBoolean("silent")) @@ -4653,7 +4653,7 @@ public class FragmentCompose extends FragmentBase { boolean needsEncryption = args.getBoolean("needsEncryption"); int action = args.getInt("action"); Log.i("Loaded action id=" + draft.id + - " action=" + LoaderComposeAction.getActionName(action) + " encryption=" + needsEncryption); + " action=" + TaskComposeAction.getActionName(action) + " encryption=" + needsEncryption); int toPos = etTo.getSelectionStart(); int ccPos = etCc.getSelectionStart(); diff --git a/app/src/main/java/eu/faircode/email/LoaderComposeAction.java b/app/src/main/java/eu/faircode/email/TaskComposeAction.java similarity index 99% rename from app/src/main/java/eu/faircode/email/LoaderComposeAction.java rename to app/src/main/java/eu/faircode/email/TaskComposeAction.java index 8c0e785286..3b29564cbf 100644 --- a/app/src/main/java/eu/faircode/email/LoaderComposeAction.java +++ b/app/src/main/java/eu/faircode/email/TaskComposeAction.java @@ -62,7 +62,7 @@ import javax.mail.Session; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; -public abstract class LoaderComposeAction extends SimpleTask { +public abstract class TaskComposeAction extends SimpleTask { private static final int MAX_REASONABLE_SIZE = 5 * 1024 * 1024; @Override @@ -754,15 +754,15 @@ public abstract class LoaderComposeAction extends SimpleTask { } protected Pair> get() { - throw new NotImplementedException("LoaderAction"); + throw new NotImplementedException(this.getClass().getName()); } protected void set(Integer plain_only, List attachments) { - throw new NotImplementedException("LoaderAction"); + throw new NotImplementedException(this.getClass().getName()); } protected void toast(String feedback) { - throw new NotImplementedException("LoaderAction"); + throw new NotImplementedException(this.getClass().getName()); } private void checkAddress(InternetAddress[] addresses, Context context) throws AddressException { diff --git a/app/src/main/java/eu/faircode/email/LoaderComposeDraft.java b/app/src/main/java/eu/faircode/email/TaskComposeDraft.java similarity index 99% rename from app/src/main/java/eu/faircode/email/LoaderComposeDraft.java rename to app/src/main/java/eu/faircode/email/TaskComposeDraft.java index d784cbc329..15e39c23f9 100644 --- a/app/src/main/java/eu/faircode/email/LoaderComposeDraft.java +++ b/app/src/main/java/eu/faircode/email/TaskComposeDraft.java @@ -55,7 +55,7 @@ import biweekly.ICalendar; import biweekly.component.VEvent; import biweekly.property.Organizer; -public abstract class LoaderComposeDraft extends SimpleTask { +public abstract class TaskComposeDraft extends SimpleTask { private static final int MAX_QUOTE_LEVEL = 5; @Override @@ -974,10 +974,10 @@ public abstract class LoaderComposeDraft extends SimpleTask attachments) { - throw new NotImplementedException("LoaderDraft"); + throw new NotImplementedException(this.getClass().getName()); } } diff --git a/app/src/main/java/eu/faircode/email/LoaderComposePgp.java b/app/src/main/java/eu/faircode/email/TaskComposePgp.java similarity index 99% rename from app/src/main/java/eu/faircode/email/LoaderComposePgp.java rename to app/src/main/java/eu/faircode/email/TaskComposePgp.java index 2d10e6eab8..272483ef36 100644 --- a/app/src/main/java/eu/faircode/email/LoaderComposePgp.java +++ b/app/src/main/java/eu/faircode/email/TaskComposePgp.java @@ -56,7 +56,7 @@ import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeUtility; -public class LoaderComposePgp extends SimpleTask { +public class TaskComposePgp extends SimpleTask { private String[] pgpUserIds; private long[] pgpKeyIds; private long pgpSignKeyId; @@ -380,6 +380,6 @@ public class LoaderComposePgp extends SimpleTask { @Override protected void onException(Bundle args, Throwable ex) { - throw new NotImplementedException("LoaderDraft"); + throw new NotImplementedException(this.getClass().getName()); } } diff --git a/app/src/main/java/eu/faircode/email/LoaderComposeSMime.java b/app/src/main/java/eu/faircode/email/TaskComposeSMime.java similarity index 99% rename from app/src/main/java/eu/faircode/email/LoaderComposeSMime.java rename to app/src/main/java/eu/faircode/email/TaskComposeSMime.java index f1cbc40da5..d6038cf945 100644 --- a/app/src/main/java/eu/faircode/email/LoaderComposeSMime.java +++ b/app/src/main/java/eu/faircode/email/TaskComposeSMime.java @@ -79,7 +79,7 @@ import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.util.ByteArrayDataSource; -public class LoaderComposeSMime extends SimpleTask { +public class TaskComposeSMime extends SimpleTask { @Override protected Void onExecute(Context context, Bundle args) throws Throwable { long id = args.getLong("id");