diff --git a/FAQ.md b/FAQ.md
index 10f1547b0a..3bc1c03537 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -1133,7 +1133,7 @@ for example one listed [here](https://github.com/offa/android-foss#-document--pd
**(69) Can you add auto scroll up on new message?**
-The message list is automatically scrolled up when navigating from a new message notification.
+The message list is automatically scrolled up when navigating from a new message notification or after a manual refresh.
Always automatically scrolling up on arrival of new messages would interfere with your own navigation and scrolling.
diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java
index 3bc0af293d..a700184ce5 100644
--- a/app/src/main/java/eu/faircode/email/FragmentMessages.java
+++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java
@@ -134,6 +134,7 @@ public class FragmentMessages extends FragmentBase {
private boolean outbox = false;
private boolean connected;
private boolean searching = false;
+ private boolean manual = false;
private AdapterMessage adapter;
private AdapterMessage.ViewType viewType;
@@ -488,6 +489,11 @@ public class FragmentMessages extends FragmentBase {
args.putLong("folder", folder);
new SimpleTask() {
+ @Override
+ protected void onPreExecute(Bundle args) {
+ manual = true;
+ }
+
@Override
protected Boolean onExecute(Context context, Bundle args) {
long fid = args.getLong("folder");
@@ -519,6 +525,7 @@ public class FragmentMessages extends FragmentBase {
@Override
protected void onException(Bundle args, Throwable ex) {
+ manual = false;
swipeRefresh.setRefreshing(false);
if (ex instanceof IllegalArgumentException)
Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_LONG).show();
@@ -1525,6 +1532,11 @@ public class FragmentMessages extends FragmentBase {
break;
}
+ if (!refreshing && manual) {
+ manual = false;
+ rvMessage.scrollToPosition(0);
+ }
+
swipeRefresh.setRefreshing(refreshing);
}
});
@@ -1550,7 +1562,14 @@ public class FragmentMessages extends FragmentBase {
}
}
- swipeRefresh.setRefreshing(folder != null && folder.isSynchronizing());
+ boolean refreshing = (folder != null && folder.isSynchronizing());
+
+ if (!refreshing && manual) {
+ manual = false;
+ rvMessage.scrollToPosition(0);
+ }
+
+ swipeRefresh.setRefreshing(refreshing);
}
});
break;