mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Start services in task
This commit is contained in:
parent
e35cbd0f37
commit
8778df07db
6 changed files with 24 additions and 18 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -370,20 +370,26 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
|||
boolean sync = args.getBoolean("sync");
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
if (!sync) {
|
||||
db.account().setAccountWarning(id, null);
|
||||
db.account().setAccountError(id, null);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
if (!sync) {
|
||||
db.account().setAccountWarning(id, null);
|
||||
db.account().setAccountError(id, null);
|
||||
}
|
||||
|
||||
db.account().setAccountSynchronize(id, sync);
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
db.account().setAccountSynchronize(id, sync);
|
||||
|
||||
ServiceSynchronize.eval(context, "account sync=" + sync);
|
||||
|
||||
return sync;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Boolean sync) {
|
||||
ServiceSynchronize.eval(context, "account sync=" + sync);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
|
|
|
@ -325,14 +325,14 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
|
|||
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(context, "rules/manual");
|
||||
|
||||
Snackbar.make(
|
||||
parentFragment.getView(),
|
||||
context.getString(R.string.title_rule_applied, applied), Snackbar.LENGTH_LONG)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue