aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2022-01-21 14:22:37 +0000
committerAlex Ning <chineseperson5@gmail.com>2022-01-21 14:22:37 +0000
commitfd0e95dbac415c3bb35a37804c800ead3791dee9 (patch)
tree58eb333a8c2899377d29270cd6367833c2bbfddf /app/src/main/java
parentdb48b940d7ee3ae5f8f54556b81d43f67327f4b9 (diff)
downloadinfinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar.gz
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar.bz2
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar.lz
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar.xz
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.tar.zst
infinity-for-reddit-fd0e95dbac415c3bb35a37804c800ead3791dee9.zip
Show author icon in CommentFullyCollapsedViewHolder.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java22
1 files changed, 22 insertions, 0 deletions
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<RecyclerVi
if (comment != null) {
String authorWithPrefix = "u/" + comment.getAuthor();
((CommentFullyCollapsedViewHolder) holder).usernameTextView.setText(authorWithPrefix);
+
+ if (comment.getAuthorIconUrl() == null) {
+ mFragment.loadIcon(comment.getAuthor(), (authorName, iconUrl) -> {
+ 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<RecyclerVi
class CommentFullyCollapsedViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.vertical_block_indentation_item_comment_fully_collapsed)
CommentIndentationView commentIndentationView;
+ @BindView(R.id.author_icon_image_view_item_comment_fully_collapsed)
+ ImageView authorIconImageView;
@BindView(R.id.user_name_text_view_item_comment_fully_collapsed)
TextView usernameTextView;
@BindView(R.id.child_count_text_view_item_comment_fully_collapsed)