From 58efcce3a09f23b01dbd199fc422f44a0ba79dbc Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 16 Apr 2020 22:22:29 +0800 Subject: [PATCH] Show author flair for posts. --- .../CommentAndPostRecyclerViewAdapter.java | 19 +++++++++++++++++++ app/src/main/res/layout/item_post_detail.xml | 19 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java index 250d17d3..c003a876 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java @@ -492,6 +492,22 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter= android.os.Build.VERSION_CODES.N) { + flairHTML = (Spannable) Html.fromHtml(mPost.getAuthorFlairHTML(), Html.FROM_HTML_MODE_LEGACY, glideImageGetter, null); + } else { + flairHTML = (Spannable) Html.fromHtml(mPost.getAuthorFlairHTML(), glideImageGetter, null); + } + ((PostDetailViewHolder) holder).mAuthorFlairTextView.setText(flairHTML); + ((PostDetailViewHolder) holder).mAuthorFlairTextView.setOnClickListener(view -> ((PostDetailViewHolder) holder).mUserTextView.performClick()); + } else if (mPost.getAuthorFlair() != null && !mPost.getAuthorFlair().equals("")) { + ((PostDetailViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE); + ((PostDetailViewHolder) holder).mAuthorFlairTextView.setText(mPost.getAuthorFlair()); + } + switch (mPost.getVoteType()) { case 1: //Upvote @@ -1824,6 +1840,8 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter + +