From fd0e95dbac415c3bb35a37804c800ead3791dee9 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Fri, 21 Jan 2022 22:22:37 +0800 Subject: Show author icon in CommentFullyCollapsedViewHolder. --- .../adapters/CommentsRecyclerViewAdapter.java | 22 ++++++++++++++++++++++ app/src/main/res/layout/item_comment.xml | 2 +- .../res/layout/item_comment_fully_collapsed.xml | 16 +++++++++++++--- 3 files changed, 36 insertions(+), 4 deletions(-) (limited to 'app/src/main') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index 9ea07970..1cd992ad 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -519,6 +519,26 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter { + if (authorName.equals(comment.getAuthor())) { + mGlide.load(iconUrl) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .error(mGlide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) + .into(((CommentFullyCollapsedViewHolder) holder).authorIconImageView); + comment.setAuthorIconUrl(iconUrl); + } + }); + } else { + mGlide.load(comment.getAuthorIconUrl()) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) + .error(mGlide.load(R.drawable.subreddit_default_icon) + .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0)))) + .into(((CommentFullyCollapsedViewHolder) holder).authorIconImageView); + } + if (comment.getChildCount() > 0) { ((CommentFullyCollapsedViewHolder) holder).childCountTextView.setVisibility(View.VISIBLE); ((CommentFullyCollapsedViewHolder) holder).childCountTextView.setText("+" + comment.getChildCount()); @@ -1610,6 +1630,8 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter diff --git a/app/src/main/res/layout/item_comment_fully_collapsed.xml b/app/src/main/res/layout/item_comment_fully_collapsed.xml index 8f547138..5bda1d1f 100644 --- a/app/src/main/res/layout/item_comment_fully_collapsed.xml +++ b/app/src/main/res/layout/item_comment_fully_collapsed.xml @@ -15,16 +15,24 @@ + android:layout_height="wrap_content" + android:layout_marginStart="16dp"> + +