Fix getting comment for "continue thread" button (#1207)

It used position of viewholder during binding which could get outdated by the time user clicks on the button. This would result in retrieving wrong comment or even null. Replaced with getting comment based on current position of vieholder.
This commit is contained in:
Sergei Kozelko 2022-11-08 12:53:39 +07:00 committed by GitHub
parent c2360ca59a
commit 2c9ffbc614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -780,7 +780,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
}); });
} else { } else {
((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setOnClickListener(view -> { ((LoadMoreChildCommentsViewHolder) holder).placeholderTextView.setOnClickListener(view -> {
Comment comment = getCurrentComment(position); Comment comment = getCurrentComment(holder);
if (comment != null) { if (comment != null) {
Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); Intent intent = new Intent(mActivity, ViewPostDetailActivity.class);
intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, mPost); intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, mPost);