Added message about delay sync

This commit is contained in:
M66B 2019-02-21 08:13:44 +00:00
parent d4f2c0d7c4
commit 0731872dcf
3 changed files with 19 additions and 6 deletions

View File

@ -284,9 +284,9 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
args.putLong("account", folder.account == null ? -1 : folder.account);
args.putLong("folder", folder.id);
new SimpleTask<Void>() {
new SimpleTask<Boolean>() {
@Override
protected Void onExecute(Context context, Bundle args) {
protected Boolean onExecute(Context context, Bundle args) {
long aid = args.getLong("account");
long fid = args.getLong("folder");
@ -298,9 +298,13 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
try {
db.beginTransaction();
if (aid < 0) // outbox
boolean now;
if (aid < 0) {
// outbox
now = ("connected".equals(folder.state));
EntityOperation.sync(db, fid);
else {
} else {
now = true;
if ("connected".equals(db.account().getAccount(aid).state))
EntityOperation.sync(db, fid);
else {
@ -310,11 +314,17 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
db.setTransactionSuccessful();
return now;
} finally {
db.endTransaction();
}
}
return null;
@Override
protected void onExecuted(Bundle args, Boolean now) {
if (!now)
Snackbar.make(itemView, R.string.title_sync_delayed, Snackbar.LENGTH_LONG).show();
}
@Override

View File

@ -536,8 +536,10 @@ public class FragmentMessages extends FragmentBase {
@Override
protected void onExecuted(Bundle args, Boolean now) {
if (!now)
if (!now) {
swipeRefresh.setRefreshing(false);
Snackbar.make(view, R.string.title_sync_delayed, Snackbar.LENGTH_LONG).show();
}
}
@Override

View File

@ -256,6 +256,7 @@
<string name="title_no_utf8">This provider does not support UTF-8</string>
<string name="title_no_sync">Synchronization errors since %1$s</string>
<string name="title_sync_disabled">Synchronization is disabled</string>
<string name="title_sync_delayed">Synchronization will be performed on the next account connection</string>
<string name="title_drafts_required">A drafts folder is required to send messages</string>
<string name="title_account_delete">Delete this account permanently?</string>
<string name="title_identity_delete">Delete this identity permanently?</string>