mirror of https://github.com/M66B/FairEmail.git
Revert "Run start service on foreground"
This reverts commit f7a85deeec
.
This commit is contained in:
parent
a5e0d8f086
commit
e35cbd0f37
|
@ -309,12 +309,9 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "attachment");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -663,11 +663,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
args.putBoolean("childs", childs);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected void onPostExecute(Bundle args) {
|
||||
ServiceSynchronize.eval(context, "refresh/folder");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long fid = args.getLong("folder");
|
||||
|
@ -709,6 +704,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "refresh/folder");
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
||||
|
@ -839,15 +836,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
boolean subscribed = args.getBoolean("subscribed");
|
||||
|
||||
EntityOperation.subscribe(context, id, subscribed);
|
||||
ServiceSynchronize.eval(context, "subscribed=" + subscribed);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "subscribed");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
|
||||
|
|
|
@ -134,12 +134,9 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "attachment");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3197,12 +3197,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "doubletap");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3397,12 +3394,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "flag");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3703,12 +3697,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "attachment");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4472,13 +4463,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "seen");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void ignored) {
|
||||
ServiceSynchronize.eval(context, "seen");
|
||||
|
||||
long id = args.getLong("id");
|
||||
TupleMessageEx amessage = getMessage();
|
||||
if (amessage == null || !amessage.id.equals(id))
|
||||
|
@ -4632,12 +4623,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "resync");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "resync");
|
||||
ToastEx.makeText(context, R.string.title_fetching_again, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
@ -4940,12 +4932,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "headers");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5017,12 +5006,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "raw");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "raw");
|
||||
ToastEx.makeText(context, R.string.title_download_message, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
|
@ -6905,12 +6895,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
ServiceSynchronize.eval(context, "keyword=" + keyword);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1242,6 +1242,8 @@ public class FragmentAccount extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "save account");
|
||||
|
||||
if (!synchronize) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel("receive:" + account.id, 1);
|
||||
|
@ -1263,10 +1265,8 @@ public class FragmentAccount extends FragmentBase {
|
|||
fragment.show(getParentFragmentManager(), "account:save");
|
||||
} else {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
ServiceSynchronize.eval(context, "save account");
|
||||
if (context != null)
|
||||
WidgetUnified.updateData(context); // Update color stripe
|
||||
}
|
||||
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
||||
getParentFragmentManager().popBackStack();
|
||||
|
@ -1636,15 +1636,13 @@ public class FragmentAccount extends FragmentBase {
|
|||
DB db = DB.getInstance(context);
|
||||
db.account().setAccountTbd(id);
|
||||
|
||||
ServiceSynchronize.eval(context, "delete account");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "delete account");
|
||||
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getParentFragmentManager().popBackStack();
|
||||
}
|
||||
|
|
|
@ -342,20 +342,6 @@ public class FragmentAccounts extends FragmentBase {
|
|||
@Override
|
||||
protected void onPostExecute(Bundle args) {
|
||||
swipeRefresh.setRefreshing(false);
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
boolean force = args.getBoolean("force");
|
||||
boolean outbox = args.getBoolean("outbox");
|
||||
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (outbox)
|
||||
ServiceSend.start(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -397,8 +383,13 @@ public class FragmentAccounts extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
args.putBoolean("force", force);
|
||||
args.putBoolean("outbox", outbox);
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (outbox)
|
||||
ServiceSend.start(context);
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
|
|
@ -4195,6 +4195,8 @@ public class FragmentCompose extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "compose/draft");
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -4203,10 +4205,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
final String action = getArguments().getString("action");
|
||||
Log.i("Loaded draft id=" + data.draft.id + " action=" + action);
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "compose/draft");
|
||||
|
||||
working = data.draft.id;
|
||||
encrypt = data.draft.ui_encrypt;
|
||||
getActivity().invalidateOptionsMenu();
|
||||
|
@ -5010,12 +5008,16 @@ public class FragmentCompose extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
args.putBoolean("dirty", dirty);
|
||||
if (dirty)
|
||||
ServiceSynchronize.eval(context, "compose/action");
|
||||
|
||||
if (action == R.id.action_send && draft.ui_snoozed != null) {
|
||||
Log.i("Delayed send id=" + draft.id + " at " + new Date(draft.ui_snoozed));
|
||||
EntityMessage.snooze(context, draft.id, draft.ui_snoozed);
|
||||
}
|
||||
if (action == R.id.action_send)
|
||||
if (draft.ui_snoozed == null)
|
||||
ServiceSend.start(context);
|
||||
else {
|
||||
Log.i("Delayed send id=" + draft.id + " at " + new Date(draft.ui_snoozed));
|
||||
EntityMessage.snooze(context, draft.id, draft.ui_snoozed);
|
||||
}
|
||||
|
||||
return draft;
|
||||
}
|
||||
|
@ -5025,21 +5027,10 @@ public class FragmentCompose extends FragmentBase {
|
|||
if (draft == null)
|
||||
return;
|
||||
|
||||
int action = args.getInt("action");
|
||||
boolean dirty = args.getBoolean("dirty");
|
||||
boolean needsEncryption = args.getBoolean("needsEncryption");
|
||||
int action = args.getInt("action");
|
||||
Log.i("Loaded action id=" + draft.id +
|
||||
" action=" + getActionName(action) +
|
||||
" dirty=" + dirty +
|
||||
" encryption=" + needsEncryption);
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
if (dirty)
|
||||
ServiceSynchronize.eval(context, "compose/action");
|
||||
if (action == R.id.action_send && draft.ui_snoozed == null)
|
||||
ServiceSend.start(context);
|
||||
}
|
||||
" action=" + getActionName(action) + " encryption=" + needsEncryption);
|
||||
|
||||
etTo.setText(MessageHelper.formatAddressesCompose(draft.to));
|
||||
etCc.setText(MessageHelper.formatAddressesCompose(draft.cc));
|
||||
|
|
|
@ -116,14 +116,9 @@ public class FragmentDialogSync extends FragmentDialogBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "folder:months");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "folder:months");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -631,23 +631,16 @@ public class FragmentFolder extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
args.putBoolean("reload", reload);
|
||||
if (reload)
|
||||
ServiceSynchronize.reload(context, aid, false, "save folder");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "save folder");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Boolean dirty) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
long aid = args.getLong("account");
|
||||
boolean reload = args.getBoolean("reload");
|
||||
if (reload)
|
||||
ServiceSynchronize.reload(context, aid, false, "save folder");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "save folder");
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
Bundle aargs = new Bundle();
|
||||
aargs.putString("question", getString(R.string.title_ask_save));
|
||||
|
|
|
@ -321,20 +321,6 @@ public class FragmentFolders extends FragmentBase {
|
|||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected void onPostExecute(Bundle args) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
boolean force = args.getBoolean("force");
|
||||
boolean outbox = args.getBoolean("outbox");
|
||||
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (outbox)
|
||||
ServiceSend.start(context);
|
||||
}
|
||||
|
||||
swipeRefresh.setRefreshing(false);
|
||||
}
|
||||
|
||||
|
@ -389,8 +375,13 @@ public class FragmentFolders extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
args.putBoolean("force", force);
|
||||
args.putBoolean("outbox", outbox);
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (outbox)
|
||||
ServiceSend.start(context);
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
@ -700,14 +691,9 @@ public class FragmentFolders extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "purge");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "purge");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -497,19 +497,16 @@ public class FragmentGmail extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "Gmail");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "Gmail");
|
||||
|
||||
if (args.getLong("account") < 0) {
|
||||
finish();
|
||||
if (context != null)
|
||||
ToastEx.makeText(context, R.string.title_setup_oauth_updated, Toast.LENGTH_LONG).show();
|
||||
ToastEx.makeText(getContext(), R.string.title_setup_oauth_updated, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
FragmentReview fragment = new FragmentReview();
|
||||
fragment.setArguments(args);
|
||||
|
|
|
@ -1452,19 +1452,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
args.putString("type", type);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Bundle args) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
boolean force = args.getBoolean("force");
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long fid = args.getLong("folder");
|
||||
|
@ -1516,7 +1503,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
args.putBoolean("force", force);
|
||||
if (force)
|
||||
ServiceSynchronize.reload(context, null, true, "refresh");
|
||||
else
|
||||
ServiceSynchronize.eval(context, "refresh");
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
@ -2986,14 +2976,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "seen");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "seen");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3130,14 +3115,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "flag");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "flag");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3708,6 +3688,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "outbox/drafts");
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel("send:" + id, 1);
|
||||
|
||||
|
@ -3716,13 +3698,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EntityMessage draft) {
|
||||
if (draft != null) {
|
||||
ServiceSynchronize.eval(context, "outbox/drafts");
|
||||
if (draft != null)
|
||||
context.startActivity(
|
||||
new Intent(context, ActivityCompose.class)
|
||||
.putExtra("action", "edit")
|
||||
.putExtra("id", draft.id));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5230,14 +5210,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "expand");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "expand");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5434,15 +5409,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "move");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "move");
|
||||
|
||||
if (viewType == AdapterMessage.ViewType.THREAD) {
|
||||
PagedList<TupleMessageEx> messages = adapter.getCurrentList();
|
||||
if (messages != null && result.size() > 0) {
|
||||
|
@ -5533,14 +5506,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "move");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "move");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7212,6 +7180,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "delete");
|
||||
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel("send:" + id, 1);
|
||||
|
||||
|
@ -7220,10 +7190,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "delete");
|
||||
|
||||
if (viewType == AdapterMessage.ViewType.THREAD) {
|
||||
PagedList<TupleMessageEx> messages = adapter.getCurrentList();
|
||||
if (messages != null) {
|
||||
|
@ -7266,15 +7232,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "delete");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "delete");
|
||||
|
||||
if (viewType == AdapterMessage.ViewType.THREAD) {
|
||||
long[] ids = args.getLongArray("ids");
|
||||
PagedList<TupleMessageEx> messages = adapter.getCurrentList();
|
||||
|
@ -7336,14 +7300,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "junk");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "junk");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7412,14 +7371,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "flag");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "flag");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7602,19 +7556,18 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (copy)
|
||||
ServiceSynchronize.eval(context, "copy");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, ArrayList<MessageTarget> result) {
|
||||
boolean copy = args.getBoolean("copy");
|
||||
if (copy) {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
ServiceSynchronize.eval(context, "copy");
|
||||
ToastEx.makeText(context, R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
} else
|
||||
if (copy)
|
||||
ToastEx.makeText(getContext(), R.string.title_completed, Toast.LENGTH_LONG).show();
|
||||
else
|
||||
moveAsk(result, false, !autoclose && onclose == null);
|
||||
}
|
||||
|
||||
|
@ -7927,14 +7880,9 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "purge");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "purge");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -608,6 +608,8 @@ public class FragmentOAuth extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "OAuth");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -615,14 +617,9 @@ public class FragmentOAuth extends FragmentBase {
|
|||
protected void onExecuted(Bundle args, Void data) {
|
||||
pbOAuth.setVisibility(View.GONE);
|
||||
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "OAuth");
|
||||
|
||||
if (args.getLong("account") < 0) {
|
||||
finish();
|
||||
if (context != null)
|
||||
ToastEx.makeText(context, R.string.title_setup_oauth_updated, Toast.LENGTH_LONG).show();
|
||||
ToastEx.makeText(getContext(), R.string.title_setup_oauth_updated, Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
FragmentReview fragment = new FragmentReview();
|
||||
fragment.setArguments(args);
|
||||
|
|
|
@ -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(compoundButton.getContext(), "background=" + checked);
|
||||
ServiceSynchronize.eval(getContext(), "background=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -506,14 +506,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
DB db = DB.getInstance(context);
|
||||
db.account().setAccountPollExempted(id, exempted);
|
||||
|
||||
return null;
|
||||
}
|
||||
ServiceSynchronize.eval(context, "exempted");
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "exempted");
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -611,6 +611,8 @@ public class FragmentPop extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "POP3");
|
||||
|
||||
if (!synchronize) {
|
||||
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
nm.cancel("receive:" + account.id, 1);
|
||||
|
@ -632,10 +634,8 @@ public class FragmentPop extends FragmentBase {
|
|||
fragment.show(getParentFragmentManager(), "account:save");
|
||||
} else {
|
||||
Context context = getContext();
|
||||
if (context != null) {
|
||||
ServiceSynchronize.eval(context, "POP3");
|
||||
if (context != null)
|
||||
WidgetUnified.updateData(context); // Update color stripe
|
||||
}
|
||||
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
|
||||
getParentFragmentManager().popBackStack();
|
||||
|
@ -879,15 +879,13 @@ public class FragmentPop extends FragmentBase {
|
|||
DB db = DB.getInstance(context);
|
||||
db.account().setAccountTbd(id);
|
||||
|
||||
ServiceSynchronize.eval(context, "delete account");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, Void data) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "delete account");
|
||||
|
||||
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
|
||||
getParentFragmentManager().popBackStack();
|
||||
}
|
||||
|
|
|
@ -452,15 +452,13 @@ public class FragmentQuickSetup extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
ServiceSynchronize.eval(context, "quick setup");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onExecuted(Bundle args, EmailProvider result) {
|
||||
Context context = getContext();
|
||||
if (context != null)
|
||||
ServiceSynchronize.eval(context, "quick setup");
|
||||
|
||||
boolean check = args.getBoolean("check");
|
||||
if (check) {
|
||||
tvImap.setText(result == null ? null
|
||||
|
|
|
@ -2023,16 +2023,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
prefs.edit().putInt("poll_interval", OPTIMIZE_POLL_INTERVAL).apply();
|
||||
} else if (pollInterval <= 60 && account.poll_exempted) {
|
||||
db.account().setAccountPollExempted(account.id, false);
|
||||
ApplicationEx.getMainHandler().post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
onEval(new Intent().putExtra("account", account.id));
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
ServiceSynchronize.eval(this, "Optimize=" + reason);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2441,13 +2432,12 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
private static void start(Context context, Intent intent) {
|
||||
if (isBackgroundService(context))
|
||||
context.startService(intent);
|
||||
else {
|
||||
else
|
||||
try {
|
||||
ContextCompat.startForegroundService(context, intent);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isBackgroundService(Context context) {
|
||||
|
|
Loading…
Reference in New Issue