From 58efcce3a09f23b01dbd199fc422f44a0ba79dbc Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Thu, 16 Apr 2020 22:22:29 +0800 Subject: Show author flair for posts. --- .../Adapter/CommentAndPostRecyclerViewAdapter.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'app/src/main/java') 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