mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 15:32:52 +00:00
Always set swipe refreshing
This commit is contained in:
parent
195e9383b6
commit
efe20d64f3
1 changed files with 12 additions and 5 deletions
|
@ -1339,15 +1339,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
args.putLong("folder", folder);
|
args.putLong("folder", folder);
|
||||||
args.putString("type", type);
|
args.putString("type", type);
|
||||||
|
|
||||||
new SimpleTask<Void>() {
|
new SimpleTask<Integer>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
protected Integer onExecute(Context context, Bundle args) {
|
||||||
long fid = args.getLong("folder");
|
long fid = args.getLong("folder");
|
||||||
String type = args.getString("type");
|
String type = args.getString("type");
|
||||||
|
|
||||||
if (!ConnectionHelper.getNetworkState(context).isSuitable())
|
if (!ConnectionHelper.getNetworkState(context).isSuitable())
|
||||||
throw new IllegalStateException(context.getString(R.string.title_no_internet));
|
throw new IllegalStateException(context.getString(R.string.title_no_internet));
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
boolean now = true;
|
boolean now = true;
|
||||||
boolean force = false;
|
boolean force = false;
|
||||||
|
|
||||||
|
@ -1370,6 +1371,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
folders.add(folder);
|
folders.add(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count = folders.size();
|
||||||
|
|
||||||
for (EntityFolder folder : folders) {
|
for (EntityFolder folder : folders) {
|
||||||
EntityOperation.sync(context, folder.id, true);
|
EntityOperation.sync(context, folder.id, true);
|
||||||
|
|
||||||
|
@ -1397,13 +1400,17 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
if (!now)
|
if (!now)
|
||||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||||
|
|
||||||
return null;
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onExecuted(Bundle args, Integer count) {
|
||||||
|
if (count > 0)
|
||||||
|
swipeRefresh.setRefreshing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
protected void onException(Bundle args, Throwable ex) {
|
||||||
swipeRefresh.setRefreshing(false);
|
|
||||||
|
|
||||||
if (ex instanceof IllegalStateException) {
|
if (ex instanceof IllegalStateException) {
|
||||||
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG);
|
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG);
|
||||||
snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
|
snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue