Apply custom colors to media indicator.

This commit is contained in:
Alex Ning 2021-10-15 09:04:44 +08:00
parent a129c918a0
commit 2fd0e2e0e5
4 changed files with 24 additions and 0 deletions

View File

@ -186,6 +186,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private int mArchivedTintColor;
private int mLockedTintColor;
private int mCrosspostTintColor;
private int mMediaIndicatorIconTint;
private int mMediaIndicatorBackgroundColor;
private int mUpvoteRatioTintColor;
private int mNoPreviewPostTypeBackgroundColor;
private int mNoPreviewPostTypeIconTint;
@ -402,6 +404,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mArchivedTintColor = customThemeWrapper.getArchivedIconTint();
mLockedTintColor = customThemeWrapper.getLockedIconTint();
mCrosspostTintColor = customThemeWrapper.getCrosspostIconTint();
mMediaIndicatorIconTint = customThemeWrapper.getMediaIndicatorIconColor();
mMediaIndicatorBackgroundColor = customThemeWrapper.getMediaIndicatorBackgroundColor();
mUpvoteRatioTintColor = customThemeWrapper.getUpvoteRatioIconTint();
mNoPreviewPostTypeBackgroundColor = customThemeWrapper.getNoPreviewPostTypeBackgroundColor();
mNoPreviewPostTypeIconTint = customThemeWrapper.getNoPreviewPostTypeIconTint();
@ -1829,6 +1833,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ProgressBar mLoadImageProgressBar;
@BindView(R.id.load_image_error_text_view_item_post_detail_video_and_gif_preview)
TextView mLoadImageErrorTextView;
@BindView(R.id.video_or_gif_indicator_image_view_item_post_detail)
ImageView videoOrGifIndicatorImageView;
@BindView(R.id.image_view_item_post_detail_video_and_gif_preview)
AspectRatioGifImageView mImageView;
@BindView(R.id.bottom_constraint_layout_item_post_detail_video_and_gif_preview)
@ -1872,6 +1878,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mSaveButton,
mShareButton);
videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
@ -2284,6 +2292,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
ProgressBar mLoadImageProgressBar;
@BindView(R.id.load_image_error_text_view_item_post_detail_gallery)
TextView mLoadImageErrorTextView;
@BindView(R.id.video_or_gif_indicator_image_view_item_post_detail)
ImageView videoOrGifIndicatorImageView;
@BindView(R.id.image_view_item_post_detail_gallery)
AspectRatioGifImageView mImageView;
@BindView(R.id.image_view_no_preview_link_item_post_detail_gallery)
@ -2329,6 +2339,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
mSaveButton,
mShareButton);
videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
mLoadImageProgressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
mLoadImageErrorTextView.setTextColor(mPrimaryTextColor);
mNoPreviewPostTypeImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor);

View File

@ -163,6 +163,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private int mArchivedIconTint;
private int mLockedIconTint;
private int mCrosspostIconTint;
private int mMediaIndicatorIconTint;
private int mMediaIndicatorBackgroundColor;
private int mNoPreviewPostTypeBackgroundColor;
private int mNoPreviewPostTypeIconTint;
private int mUpvotedColor;
@ -306,6 +308,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mArchivedIconTint = customThemeWrapper.getArchivedIconTint();
mLockedIconTint = customThemeWrapper.getLockedIconTint();
mCrosspostIconTint = customThemeWrapper.getCrosspostIconTint();
mMediaIndicatorIconTint = customThemeWrapper.getMediaIndicatorIconColor();
mMediaIndicatorBackgroundColor = customThemeWrapper.getMediaIndicatorBackgroundColor();
mNoPreviewPostTypeBackgroundColor = customThemeWrapper.getNoPreviewPostTypeBackgroundColor();
mNoPreviewPostTypeIconTint = customThemeWrapper.getNoPreviewPostTypeIconTint();
mUpvotedColor = customThemeWrapper.getUpvoted();
@ -2924,6 +2928,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
noPreviewLinkImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor);
noPreviewLinkImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
errorTextView.setTextColor(mPrimaryTextColor);
imageView.setOnClickListener(view -> {
@ -3741,6 +3747,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
noPreviewImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor);
noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
errorTextView.setTextColor(mPrimaryTextColor);
itemView.setOnClickListener(view -> {
@ -4144,6 +4152,8 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
noPreviewImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor);
noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN);
progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent));
videoOrGifIndicatorImageView.setColorFilter(mMediaIndicatorIconTint, PorterDuff.Mode.SRC_IN);
videoOrGifIndicatorImageView.setBackgroundTintList(ColorStateList.valueOf(mMediaIndicatorBackgroundColor));
errorTextView.setTextColor(mPrimaryTextColor);
divider.setBackgroundColor(mDividerColor);

View File

@ -220,6 +220,7 @@
android:scaleType="fitStart" />
<ImageView
android:id="@+id/video_or_gif_indicator_image_view_item_post_detail"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="16dp"

View File

@ -217,6 +217,7 @@
android:scaleType="fitStart" />
<ImageView
android:id="@+id/video_or_gif_indicator_image_view_item_post_detail"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_margin="16dp"