aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/CommentAndPostRecyclerViewAdapter.java19
-rw-r--r--app/src/main/res/layout/item_post_detail.xml19
2 files changed, 37 insertions, 1 deletions
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<Recy
}
}
+ if (mPost.getAuthorFlairHTML() != null && !mPost.getAuthorFlairHTML().equals("")) {
+ ((PostDetailViewHolder) holder).mAuthorFlairTextView.setVisibility(View.VISIBLE);
+ Spannable flairHTML;
+ GlideImageGetter glideImageGetter = new GlideImageGetter(((PostDetailViewHolder) holder).mAuthorFlairTextView);
+ if (android.os.Build.VERSION.SDK_INT >= 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<Recy
TextView mSubredditTextView;
@BindView(R.id.user_text_view_item_post_detail)
TextView mUserTextView;
+ @BindView(R.id.author_flair_text_view_item_post_detail)
+ TextView mAuthorFlairTextView;
@BindView(R.id.post_time_text_view_item_post_detail)
TextView mPostTimeTextView;
@BindView(R.id.title_text_view_item_post_detail)
@@ -2093,6 +2111,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
itemView.setBackgroundColor(mCardViewColor);
mSubredditTextView.setTextColor(mSubredditColor);
mUserTextView.setTextColor(mUsernameColor);
+ mAuthorFlairTextView.setTextColor(mAuthorFlairTextColor);
mPostTimeTextView.setTextColor(mSecondaryTextColor);
mTitleTextView.setTextColor(mPostTitleColor);
mTypeTextView.setBackgroundColor(mPostTypeBackgroundColor);
diff --git a/app/src/main/res/layout/item_post_detail.xml b/app/src/main/res/layout/item_post_detail.xml
index f68ffb3c..dd8b842f 100644
--- a/app/src/main/res/layout/item_post_detail.xml
+++ b/app/src/main/res/layout/item_post_detail.xml
@@ -45,13 +45,30 @@
android:textSize="?attr/font_default"
android:maxLines="2"
android:ellipsize="end"
- app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintBottom_toTopOf="@+id/author_flair_text_view_item_post_detail"
app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail"
app:layout_constraintEnd_toStartOf="@id/guideline"
app:layout_constraintTop_toBottomOf="@+id/subreddit_text_view_item_post_detail"
app:layout_constraintHorizontal_bias="0" />
<TextView
+ android:id="@+id/author_flair_text_view_item_post_detail"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="8dp"
+ android:textColor="?attr/username"
+ android:textSize="?attr/font_default"
+ android:maxLines="2"
+ android:ellipsize="end"
+ android:visibility="gone"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toEndOf="@+id/icon_gif_image_view_item_post_detail"
+ app:layout_constraintEnd_toStartOf="@id/guideline"
+ app:layout_constraintTop_toBottomOf="@+id/user_text_view_item_post_detail"
+ app:layout_constraintHorizontal_bias="0" />
+
+ <TextView
android:id="@+id/post_time_text_view_item_post_detail"
android:layout_width="0dp"
android:layout_height="wrap_content"