Mholloway has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/378088 )
Change subject: Update: fix article subtitle compound drawable tint on API <23 ...................................................................... Update: fix article subtitle compound drawable tint on API <23 The TextView drawableTint property only applies to API 23 (M) and higher; we'll have to shim it in Java code for pre-Marshmallow versions. Bug: T172157 Change-Id: I41c8c9246bc614d9ad7f253573e998e97b8973bd --- M app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java M app/src/main/res/layout/view_page_header.xml 2 files changed, 15 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/88/378088/1 diff --git a/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java index ca31c78..09955de 100644 --- a/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java +++ b/app/src/main/java/org/wikipedia/page/leadimages/PageHeaderView.java @@ -4,8 +4,11 @@ import android.content.Context; import android.graphics.Bitmap; import android.graphics.PointF; +import android.graphics.PorterDuff; import android.graphics.Typeface; +import android.graphics.drawable.Drawable; import android.os.Build; +import android.support.annotation.ColorInt; import android.support.annotation.DimenRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -196,6 +199,9 @@ 0, isLangRTL(locale) ? R.drawable.ic_short_text : 0, 0); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { + addSubtitleDrawableTintPreMarshmallow(); + } } else { subtitleText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } @@ -342,6 +348,14 @@ setPadding(0, offset, 0, 0); } + private void addSubtitleDrawableTintPreMarshmallow() { + @ColorInt int accentColor = getThemedColor(getContext(), R.attr.colorAccent); + Drawable[] drawables = subtitleText.getCompoundDrawables(); + if (drawables[0] != null) { + drawables[0].setColorFilter(accentColor, PorterDuff.Mode.SRC_IN); + } + } + private class DescriptionClickableSpan extends ClickableSpan { @Override public void onClick(View view) { diff --git a/app/src/main/res/layout/view_page_header.xml b/app/src/main/res/layout/view_page_header.xml index 1a0eb99..360cc9b 100644 --- a/app/src/main/res/layout/view_page_header.xml +++ b/app/src/main/res/layout/view_page_header.xml @@ -52,6 +52,7 @@ android:textColorHighlight="?attr/page_description_color" android:drawablePadding="8dp" android:drawableTint="?attr/colorAccent" + tools:targetApi="23" tools:text="Subtitle" /> <View -- To view, visit https://gerrit.wikimedia.org/r/378088 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I41c8c9246bc614d9ad7f253573e998e97b8973bd Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Mholloway <mhollo...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits