Fix showing double "no comments" message in CommentsRecyclerViewAdapter if it's in single thread mode and the comment is filtered out.

This commit is contained in:
Docile-Alligator
2023-10-31 23:58:11 -04:00
parent fc462849ec
commit cf327fe8ae

View File

@ -279,8 +279,14 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
if (isInitiallyLoading) {
return VIEW_TYPE_FIRST_LOADING;
} else if (isInitiallyLoadingFailed) {
if(mIsSingleCommentThreadMode && position == 0) {
return VIEW_TYPE_VIEW_ALL_COMMENTS;
}
return VIEW_TYPE_FIRST_LOADING_FAILED;
} else {
if(mIsSingleCommentThreadMode && position == 0) {
return VIEW_TYPE_VIEW_ALL_COMMENTS;
}
return VIEW_TYPE_NO_COMMENT_PLACEHOLDER;
}
}
@ -1137,10 +1143,14 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
@Override
public int getItemCount() {
if (isInitiallyLoading || isInitiallyLoadingFailed || mVisibleComments.size() == 0) {
if (isInitiallyLoading) {
return 1;
}
if (isInitiallyLoadingFailed || mVisibleComments.size() == 0) {
return mIsSingleCommentThreadMode ? 2 : 1;
}
if (mHasMoreComments || loadMoreCommentsFailed) {
if (mIsSingleCommentThreadMode) {
return mVisibleComments.size() + 2;