Revert "Run start service on foreground"

This reverts commit f7a85deeec.
This commit is contained in:
M66B
2021-03-27 15:50:39 +01:00
parent a5e0d8f086
commit e35cbd0f37
18 changed files with 114 additions and 263 deletions

View File

@@ -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