Fixed
Status Update
Comments
ki...@google.com <ki...@google.com> #2
Hi Ed, Thank you so much for these suggestions. I've been reviewing them and merging them in. Hopefully it should be live. I've included a thank you note too in the article.
ki...@google.com <ki...@google.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
he...@ataulm.com <he...@ataulm.com> #4
>In your workaround you probably intended to add code for TextAppearance_android_textColorHint and TextAppearance_android_textColorLink
:+1:
>Not worth spinning another beta for, imo.
I don't follow whether this means not fixing it at all, or not fixing for a specific version?
:+1:
>Not worth spinning another beta for, imo.
I don't follow whether this means not fixing it at all, or not fixing for a specific version?
ki...@google.com <ki...@google.com> #5
We'll definitely fix it, but most probably for 1.3.0-alpha01
he...@ataulm.com <he...@ataulm.com> #6
Perfect thanks!
For us, there's no urgency as we're wrapping usages of `TextViewCompat.setTextAppearance` with our own function and applying this workaround on Lollipop, but would be great to ditch it at some point because no doubt this sort of thing is the source of subtle bugs/divergences in intended behaviour.
For us, there's no urgency as we're wrapping usages of `TextViewCompat.setTextAppearance` with our own function and applying this workaround on Lollipop, but would be great to ditch it at some point because no doubt this sort of thing is the source of subtle bugs/divergences in intended behaviour.
ki...@google.com <ki...@google.com>
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 7869860590c185a90287c9b94e1de151b0c75504
Author: Kirill Grouchnikov <kirillg@google.com>
Date: Tue May 05 12:55:01 2020
Consistent resolution of text hint and link colors
Same as for changing set appearance and resolving the main
text color - do the same for text link and text hint colors.
Test: ./gradlew appcompat:appcompat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=androidx.appcompat.widget.AppCompatEditTextTest
Test: ./gradlew appcompat:appcompat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=androidx.appcompat.widget.AppCompatTextViewTest
Bug: 154702995
Change-Id: Iddb7f1e7f17b9bceb14c20ca0b3468b10092b8f9
M appcompat/appcompat/src/androidTest/AndroidManifest.xml
M appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java
M appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java
A appcompat/appcompat/src/androidTest/res/color/color_state_list_hint.xml
A appcompat/appcompat/src/androidTest/res/color/color_state_list_refs12.xml
A appcompat/appcompat/src/androidTest/res/color/color_state_list_refs34.xml
M appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml
A appcompat/appcompat/src/androidTest/res/values/attrs.xml
M appcompat/appcompat/src/androidTest/res/values/strings.xml
M appcompat/appcompat/src/androidTest/res/values/styles.xml
M appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextHelper.java
https://android-review.googlesource.com/1302103
Branch: androidx-master-dev
commit 7869860590c185a90287c9b94e1de151b0c75504
Author: Kirill Grouchnikov <kirillg@google.com>
Date: Tue May 05 12:55:01 2020
Consistent resolution of text hint and link colors
Same as for changing set appearance and resolving the main
text color - do the same for text link and text hint colors.
Test: ./gradlew appcompat:appcompat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=androidx.appcompat.widget.AppCompatEditTextTest
Test: ./gradlew appcompat:appcompat:connectedCheck --info --daemon -Pandroid.testInstrumentationRunnerArguments.class=androidx.appcompat.widget.AppCompatTextViewTest
Bug: 154702995
Change-Id: Iddb7f1e7f17b9bceb14c20ca0b3468b10092b8f9
M appcompat/appcompat/src/androidTest/AndroidManifest.xml
M appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatEditTextTest.java
M appcompat/appcompat/src/androidTest/java/androidx/appcompat/widget/AppCompatTextViewTest.java
A appcompat/appcompat/src/androidTest/res/color/color_state_list_hint.xml
A appcompat/appcompat/src/androidTest/res/color/color_state_list_refs12.xml
A appcompat/appcompat/src/androidTest/res/color/color_state_list_refs34.xml
M appcompat/appcompat/src/androidTest/res/layout/appcompat_edittext_activity.xml
A appcompat/appcompat/src/androidTest/res/values/attrs.xml
M appcompat/appcompat/src/androidTest/res/values/strings.xml
M appcompat/appcompat/src/androidTest/res/values/styles.xml
M appcompat/appcompat/src/main/java/androidx/appcompat/widget/AppCompatTextHelper.java
Description
androidx.appcompat:appcompat
1.2.0-beta01
Theme.MaterialComponents.Light.NoActionBar
Issue
Setting the text appearance programmatically with
TextViewCompat.setTextAppearance(TextView, Int)
on anAppCompatEditText
does not take into account theme attrs being used inColorStateList
asandroid:textColorHint
(orandroid:textColorLink
).So on Lollipop, such a hint color is rendered as red (see screenshot).
Cause
Internally, it delegates to
AppCompatTextHelper.onSetTextAppearance
, which doesn't handle these two attributes - it only considersandroid:textColor
:However, it does consider them in
loadFromAttributes()
so it seems like it's an oversight.Feature request/bug fix
Update
AppCompatTextHelper
to handle theme attributes in CSLs forandroid:textColorHint
andandroid:textColorLink
inonSetTextAppearance()
as it's done inloadFromAttributes()
.Workaround
For folks in the meantime - call this too, after calling
TextViewCompat.setTextAppearance()
.