Skip to content

Commit 0e9513a

Browse files
ymariangsajith
authored andcommitted
Fix getter in text input layout
PiperOrigin-RevId: 245479204
1 parent 7a4ecb0 commit 0e9513a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,8 +1262,11 @@ public void setHintTextAppearance(@StyleRes int resId) {
12621262
* @attr ref com.google.android.material.R.styleable#TextInputLayout_hintTextColor
12631263
*/
12641264
public void setHintTextColor(@Nullable ColorStateList hintTextColor) {
1265-
if (collapsingTextHelper.getCollapsedTextColor() != hintTextColor) {
1266-
collapsingTextHelper.setCollapsedTextColor(hintTextColor);
1265+
if (focusedTextColor != hintTextColor) {
1266+
if (defaultHintTextColor == null) {
1267+
collapsingTextHelper.setCollapsedTextColor(hintTextColor);
1268+
}
1269+
12671270
focusedTextColor = hintTextColor;
12681271

12691272
if (editText != null) {
@@ -1279,7 +1282,7 @@ public void setHintTextColor(@Nullable ColorStateList hintTextColor) {
12791282
*/
12801283
@Nullable
12811284
public ColorStateList getHintTextColor() {
1282-
return collapsingTextHelper.getCollapsedTextColor();
1285+
return focusedTextColor;
12831286
}
12841287

12851288
/** Sets the text color used by the hint in both the collapsed and expanded states. */

0 commit comments

Comments
 (0)