From 8778df07dbea6323ced02d8834d2f43d259cd4ad Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 27 Mar 2021 16:03:58 +0100 Subject: [PATCH] Start services in task --- .../java/eu/faircode/email/ActivityEML.java | 2 +- .../java/eu/faircode/email/ActivitySetup.java | 2 +- .../eu/faircode/email/AdapterAccount.java | 24 ++++++++++++------- .../java/eu/faircode/email/AdapterRule.java | 6 ++--- .../email/FragmentOptionsNotifications.java | 2 +- .../java/eu/faircode/email/FragmentRule.java | 6 ++--- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityEML.java b/app/src/main/java/eu/faircode/email/ActivityEML.java index e2c58fbac2..3fa5f95104 100644 --- a/app/src/main/java/eu/faircode/email/ActivityEML.java +++ b/app/src/main/java/eu/faircode/email/ActivityEML.java @@ -432,13 +432,13 @@ public class ActivityEML extends ActivityBase { } EntityOperation.sync(context, inbox.id, true); + ServiceSynchronize.eval(context, "EML"); return account.name + "/" + inbox.name; } @Override protected void onExecuted(Bundle args, String name) { - ServiceSynchronize.eval(ActivityEML.this, "EML"); ToastEx.makeText(ActivityEML.this, name, Toast.LENGTH_LONG).show(); } diff --git a/app/src/main/java/eu/faircode/email/ActivitySetup.java b/app/src/main/java/eu/faircode/email/ActivitySetup.java index 2e51b0b1c5..4755a61e85 100644 --- a/app/src/main/java/eu/faircode/email/ActivitySetup.java +++ b/app/src/main/java/eu/faircode/email/ActivitySetup.java @@ -1086,6 +1086,7 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac db.endTransaction(); } + ServiceSynchronize.eval(context, "import"); Log.i("Imported data"); return null; @@ -1093,7 +1094,6 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac @Override protected void onExecuted(Bundle args, Void data) { - ServiceSynchronize.eval(ActivitySetup.this, "import"); ToastEx.makeText(ActivitySetup.this, R.string.title_setup_imported, Toast.LENGTH_LONG).show(); } diff --git a/app/src/main/java/eu/faircode/email/AdapterAccount.java b/app/src/main/java/eu/faircode/email/AdapterAccount.java index a30d805dde..3fc9895ca0 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAccount.java +++ b/app/src/main/java/eu/faircode/email/AdapterAccount.java @@ -370,20 +370,26 @@ public class AdapterAccount extends RecyclerView.Adapter 0) - ServiceSynchronize.eval(context, "rules/manual"); - Snackbar.make( parentFragment.getView(), context.getString(R.string.title_rule_applied, applied), Snackbar.LENGTH_LONG) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java index a48d3d2648..3cf391919a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsNotifications.java @@ -229,7 +229,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { prefs.edit().putBoolean("background_service", checked).apply(); - ServiceSynchronize.eval(getContext(), "background=" + checked); + ServiceSynchronize.eval(compoundButton.getContext(), "background=" + checked); } }); diff --git a/app/src/main/java/eu/faircode/email/FragmentRule.java b/app/src/main/java/eu/faircode/email/FragmentRule.java index fad17e14da..de19d69018 100644 --- a/app/src/main/java/eu/faircode/email/FragmentRule.java +++ b/app/src/main/java/eu/faircode/email/FragmentRule.java @@ -1447,14 +1447,14 @@ public class FragmentRule extends FragmentBase { db.endTransaction(); } + if (applied > 0) + ServiceSynchronize.eval(context, "rules/manual"); + return applied; } @Override protected void onExecuted(Bundle args, Integer applied) { - if (applied > 0) - ServiceSynchronize.eval(getContext(), "rules/manual"); - dismiss(); ToastEx.makeText(getContext(), getString(R.string.title_rule_applied, applied), Toast.LENGTH_LONG).show(); }