Commit 8712abcb authored by Theresa's avatar Theresa Committed by Commit Bot

[EoC] Remove use of TintedImageView in card layout

The use of a TintedImageView was causing crashes on older versions of
Android when trying to mutate the state of a LayerDrawable containing a
RoundedBitmapDrawable on older versions of Android.

BUG=857408

Change-Id: I81326ab571c34e10a739d5f185c9179e41faf94e
Reviewed-on: https://chromium-review.googlesource.com/1122853Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571929}
parent d0e8185c
......@@ -37,7 +37,7 @@
tools:text="Article snippet" />
</LinearLayout>
<org.chromium.chrome.browser.widget.TintedImageView
<ImageView
android:id="@+id/article_thumbnail"
android:layout_marginStart="@dimen/snippets_padding"
android:layout_width="@dimen/snippets_thumbnail_size_small"
......@@ -46,9 +46,7 @@
android:layout_alignParentEnd="true"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"
android:src="@null"
app:chrometint="@color/dark_mode_tint"
tools:src="@drawable/ic_snippet_thumbnail_placeholder" />
android:src="@null" />
<LinearLayout
tools:ignore="UseCompoundDrawables"
......
......@@ -59,7 +59,10 @@ public class SuggestionsBinder {
private final @Nullable TextView mSnippetTextView;
private final TextView mPublisherTextView;
private final TextView mAgeTextView;
private final TintedImageView mThumbnailView;
// TODO(twellington): Try to change this back to a TintedImageView. This was changed for a crash
// in contextual suggestions that occurs when trying to mutate state when tinting a
// LayerDrawable that contains a RoundedBitmapDrawable on older versions of Android.
private final ImageView mThumbnailView;
private final @Nullable ImageView mVideoBadge;
private final ImageView mOfflineBadge;
private final @Nullable ImageView mOfflineBadgePublisherRow;
......@@ -252,7 +255,7 @@ public class SuggestionsBinder {
} else {
mThumbnailView.setImageResource(R.drawable.ic_snippet_thumbnail_placeholder);
}
mThumbnailView.setTint(null);
if (!mIsContextual) ((TintedImageView) mThumbnailView).setTint(null);
// Fetch thumbnail for the current article.
mImageFetcher.makeArticleThumbnailRequest(
......@@ -300,7 +303,7 @@ public class SuggestionsBinder {
mThumbnailView.setScaleType(ImageView.ScaleType.CENTER_CROP);
mThumbnailView.setBackground(null);
mThumbnailView.setImageDrawable(thumbnail);
mThumbnailView.setTint(null);
if (!mIsContextual) ((TintedImageView) mThumbnailView).setTint(null);
}
private void setThumbnailFromFileType(@DownloadFilter.Type int fileType) {
......@@ -312,7 +315,7 @@ public class SuggestionsBinder {
mThumbnailView.setBackgroundColor(iconBackgroundColor);
mThumbnailView.setImageResource(
DownloadUtils.getIconResId(fileType, DownloadUtils.ICON_SIZE_36_DP));
mThumbnailView.setTint(iconForegroundColorList);
if (!mIsContextual) ((TintedImageView) mThumbnailView).setTint(iconForegroundColorList);
}
private void setDefaultFaviconOnView(int faviconSizePx) {
......@@ -341,7 +344,7 @@ public class SuggestionsBinder {
mThumbnailView.setScaleType(ImageView.ScaleType.CENTER_CROP);
mThumbnailView.setBackground(null);
mThumbnailView.setTint(null);
if (!mIsContextual) ((TintedImageView) mThumbnailView).setTint(null);
int duration = (int) (FADE_IN_ANIMATION_TIME_MS
* ChromeAnimation.Animation.getAnimationMultiplier());
if (duration == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment