Fixed a bug that the expand less button and the expand more button is not shown at the right time.

This commit is contained in:
Alex Ning 2018-09-03 16:17:51 +08:00
parent 06a692130c
commit 5c51450a8e
2 changed files with 3 additions and 1 deletions

View File

@ -67,8 +67,8 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if(commentItem.hasChildren() && commentItem.getChildren().size() > 0) { if(commentItem.hasChildren() && commentItem.getChildren().size() > 0) {
setExpandButton(((CommentViewHolder) holder).expandButton, commentItem.isExpanded());
mMultiLevelRecyclerView.toggleItemsGroup(holder.getAdapterPosition()); mMultiLevelRecyclerView.toggleItemsGroup(holder.getAdapterPosition());
setExpandButton(((CommentViewHolder) holder).expandButton, commentItem.isExpanded());
} else { } else {
((CommentViewHolder) holder).loadMoreCommentsProgressBar.setVisibility(View.VISIBLE); ((CommentViewHolder) holder).loadMoreCommentsProgressBar.setVisibility(View.VISIBLE);
FetchComment.fetchComment(subredditNamePrefixed, article, commentItem.getId(), FetchComment.fetchComment(subredditNamePrefixed, article, commentItem.getId(),
@ -83,6 +83,8 @@ class CommentMultiLevelRecyclerViewAdapter extends MultiLevelAdapter {
((CommentViewHolder) holder).loadMoreCommentsProgressBar ((CommentViewHolder) holder).loadMoreCommentsProgressBar
.setVisibility(View.GONE); .setVisibility(View.GONE);
mMultiLevelRecyclerView.toggleItemsGroup(holder.getAdapterPosition()); mMultiLevelRecyclerView.toggleItemsGroup(holder.getAdapterPosition());
((CommentViewHolder) holder).expandButton
.setImageResource(R.drawable.ic_expand_less_black_20dp);
} }
@Override @Override