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

View File

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

View File

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

View File

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