Show loading indicator in the status cell when coming to the foreground

multisite
Floens 10 years ago
parent 7f89a3b50a
commit 32b34ec0f9
  1. 4
      Clover/app/src/main/java/org/floens/chan/core/presenter/ThreadPresenter.java
  2. 30
      Clover/app/src/main/java/org/floens/chan/ui/adapter/PostAdapter.java

@ -142,6 +142,10 @@ public class ThreadPresenter implements ChanLoader.ChanLoaderCallback, PostAdapt
if (chanLoader != null) { if (chanLoader != null) {
if (foreground && isWatching()) { if (foreground && isWatching()) {
chanLoader.requestMoreDataAndResetTimer(); chanLoader.requestMoreDataAndResetTimer();
if (chanLoader.getThread() != null) {
// Show loading indicator in the status cell
showPosts();
}
} else { } else {
chanLoader.clearTimer(); chanLoader.clearTimer();
} }

@ -45,7 +45,6 @@ public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private final ThreadStatusCell.Callback statusCellCallback; private final ThreadStatusCell.Callback statusCellCallback;
private final List<Post> sourceList = new ArrayList<>(); private final List<Post> sourceList = new ArrayList<>();
private final List<Post> displayList = new ArrayList<>(); private final List<Post> displayList = new ArrayList<>();
private int lastPostCount = 0;
private String error = null; private String error = null;
private Post highlightedPost; private Post highlightedPost;
private String highlightedPostId; private String highlightedPostId;
@ -130,6 +129,20 @@ public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
return size; return size;
} }
public int getUnfilteredDisplaySize() {
int size = sourceList.size();
if (showStatusView()) {
size++;
}
if (lastSeenIndicatorPosition >= 0) {
size++;
}
return size;
}
@Override @Override
public int getItemViewType(int position) { public int getItemViewType(int position) {
if (position == lastSeenIndicatorPosition) { if (position == lastSeenIndicatorPosition) {
@ -183,20 +196,6 @@ public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
notifyDataSetChanged(); notifyDataSetChanged();
} }
public int getUnfilteredDisplaySize() {
int size = sourceList.size();
if (showStatusView()) {
size++;
}
if (lastSeenIndicatorPosition >= 0) {
size++;
}
return size;
}
public List<Post> getDisplayList() { public List<Post> getDisplayList() {
return displayList; return displayList;
} }
@ -206,7 +205,6 @@ public class PostAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
highlightedPostId = null; highlightedPostId = null;
highlightedPostNo = -1; highlightedPostNo = -1;
highlightedPostTripcode = null; highlightedPostTripcode = null;
lastPostCount = 0;
lastSeenIndicatorPosition = -1; lastSeenIndicatorPosition = -1;
bound = false; bound = false;
} }

Loading…
Cancel
Save