Fixed scroll to top thread

pull/168/head
M66B 5 years ago
parent f5edd14d69
commit 04d5b49160

@ -3186,14 +3186,12 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (handleThreadActions(messages))
return;
if (viewType == AdapterMessage.ViewType.THREAD)
adapter.gotoTop();
else if (viewType != AdapterMessage.ViewType.SEARCH) {
if (viewType != AdapterMessage.ViewType.SEARCH) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean autoscroll = prefs.getBoolean("autoscroll", true);
if (autoscroll) {
boolean gotoTop = false;
for (int i = 0; i < messages.size(); i++) {
for (int i = 0; i < messages.size() && i < ViewModelMessages.LOCAL_PAGE_SIZE; i++) {
TupleMessageEx message = messages.get(i);
if (message != null && !ids.contains(message.id)) {
ids.add(message.id);
@ -3202,10 +3200,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}
}
if (gotoTop)
if (gotoTop &&
(autoscroll || viewType == AdapterMessage.ViewType.THREAD))
adapter.gotoTop();
}
}
Log.i("Submit messages=" + messages.size());
adapter.submitList(messages);

@ -51,7 +51,7 @@ public class ViewModelMessages extends ViewModel {
private ExecutorService executor = Helper.getBackgroundExecutor(2, "model");
private static final int LOCAL_PAGE_SIZE = 100;
static final int LOCAL_PAGE_SIZE = 100;
private static final int REMOTE_PAGE_SIZE = 10;
private static final int SEARCH_PAGE_SIZE = 10;
private static final int LOW_MEM_MB = 32;

Loading…
Cancel
Save