Skip to content

Commit 16024fd

Browse files
leticiarossipekingme
authored andcommitted
[TextInputLayout] Fixing disabled color set for android:textColorHint not being applied on the label.
Before, the disabled box stroke color was being used. Resolves #789 PiperOrigin-RevId: 288887455
1 parent 07931b6 commit 16024fd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

lib/java/com/google/android/material/textfield/TextInputLayout.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,8 +1313,13 @@ private void updateLabelState(boolean animate, boolean force) {
13131313

13141314
// Set the collapsed and expanded label text colors based on the current state.
13151315
if (!isEnabled) {
1316-
collapsingTextHelper.setCollapsedTextColor(ColorStateList.valueOf(disabledColor));
1317-
collapsingTextHelper.setExpandedTextColor(ColorStateList.valueOf(disabledColor));
1316+
int disabledHintColor =
1317+
defaultHintTextColor != null
1318+
? defaultHintTextColor.getColorForState(
1319+
new int[] {-android.R.attr.state_enabled}, disabledColor)
1320+
: disabledColor;
1321+
collapsingTextHelper.setCollapsedTextColor(ColorStateList.valueOf(disabledHintColor));
1322+
collapsingTextHelper.setExpandedTextColor(ColorStateList.valueOf(disabledHintColor));
13181323
} else if (errorShouldBeShown) {
13191324
collapsingTextHelper.setCollapsedTextColor(indicatorViewController.getErrorViewTextColors());
13201325
} else if (counterOverflowed && counterView != null) {

0 commit comments

Comments
 (0)