Fix scroll to bottom not working when the last seen indicator is enabled

multisite
Floens 10 years ago
parent 28c42612b0
commit 1fd81aceec
  1. 4
      Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java
  2. 10
      Clover/app/src/main/java/org/floens/chan/ui/layout/ThreadListLayout.java

@ -183,10 +183,6 @@ public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
notifyDataSetChanged();
}
public int getDisplaySize() {
return displayList.size();
}
public int getUnfilteredDisplaySize() {
int size = sourceList.size();

@ -276,7 +276,7 @@ public class ThreadListLayout extends LinearLayout implements ReplyLayout.ReplyL
}
if (query != null) {
int size = postAdapter.getDisplaySize();
int size = postAdapter.getDisplayList().size();
searchStatus.setText(getContext().getString(R.string.search_results,
size, getContext().getResources().getQuantityString(R.plurals.posts, size, size), query));
}
@ -368,9 +368,12 @@ public class ThreadListLayout extends LinearLayout implements ReplyLayout.ReplyL
public void scrollTo(int displayPosition, boolean smooth) {
if (displayPosition < 0) {
displayPosition = recyclerView.getAdapter().getItemCount() - 1;
if (smooth) {
recyclerView.smoothScrollToPosition(postAdapter.getItemCount() - 1);
} else {
recyclerView.scrollToPosition(postAdapter.getItemCount() - 1);
}
} else {
int scrollPosition = postAdapter.getScrollPosition(displayPosition);
int difference = Math.abs(scrollPosition - getTopAdapterPosition());
@ -384,6 +387,7 @@ public class ThreadListLayout extends LinearLayout implements ReplyLayout.ReplyL
recyclerView.scrollToPosition(scrollPosition);
}
}
}
public void highlightPost(Post post) {
postAdapter.highlightPost(post);

Loading…
Cancel
Save