mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Show author flair for posts.
This commit is contained in:
parent
504b005cf7
commit
58efcce3a0
@ -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);
|
||||
|
@ -45,12 +45,29 @@
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user