Force+sync

This commit is contained in:
M66B 2021-07-17 15:50:36 +02:00
parent 3f065e4a30
commit 6b3c03a65c
3 changed files with 20 additions and 6 deletions

View File

@ -325,7 +325,7 @@ public class FragmentAccounts extends FragmentBase {
}
private void onMenuForceSync() {
ServiceSynchronize.reload(getContext(), null, true, "force sync");
refresh(true);
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
}
@ -339,7 +339,12 @@ public class FragmentAccounts extends FragmentBase {
}
private void onSwipeRefresh() {
refresh(false);
}
private void refresh(boolean force) {
Bundle args = new Bundle();
args.putBoolean("force", force);
new SimpleTask<Void>() {
@Override
@ -353,7 +358,7 @@ public class FragmentAccounts extends FragmentBase {
throw new IllegalStateException(context.getString(R.string.title_no_internet));
boolean now = true;
boolean force = false;
boolean force = args.getBoolean("force");
boolean outbox = false;
DB db = DB.getInstance(context);

View File

@ -347,9 +347,14 @@ public class FragmentFolders extends FragmentBase {
}
private void onSwipeRefresh() {
refresh(false);
}
private void refresh(boolean force) {
Bundle args = new Bundle();
args.putLong("account", account);
args.putBoolean("primary", primary);
args.putBoolean("force", force);
new SimpleTask<Void>() {
@Override
@ -366,7 +371,7 @@ public class FragmentFolders extends FragmentBase {
throw new IllegalStateException(context.getString(R.string.title_no_internet));
boolean now = true;
boolean force = false;
boolean force = args.getBoolean("force");
boolean outbox = false;
DB db = DB.getInstance(context);
@ -593,7 +598,7 @@ public class FragmentFolders extends FragmentBase {
}
private void onMenuForceSync() {
ServiceSynchronize.reload(getContext(), null, true, "force sync");
refresh(true);
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
}

View File

@ -1541,10 +1541,14 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
private void onSwipeRefresh() {
swipeRefresh.onRefresh();
refresh(false);
}
private void refresh(boolean force) {
Bundle args = new Bundle();
args.putLong("folder", folder);
args.putString("type", type);
args.putBoolean("force", force);
new SimpleTask<Void>() {
@Override
@ -1556,7 +1560,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
throw new IllegalStateException(context.getString(R.string.title_no_internet));
boolean now = true;
boolean force = false;
boolean force = args.getBoolean("force");
DB db = DB.getInstance(context);
try {
@ -4851,7 +4855,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
private void onMenuForceSync() {
ServiceSynchronize.reload(getContext(), null, true, "force sync");
refresh(true);
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
}