mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
am 83e60f1b: am bca00ffa: Merge "Make sure that we reset the EditText backgroud tint" into mnc-ub-dev
* commit '83e60f1bbb345b753d49613687ef4bb3976dcd84': Make sure that we reset the EditText backgroud tint GitOrigin-RevId=b3140f0b62e15e7d4f548e9efe1538907d0a1194 PiperOrigin-RevId: 140550025
This commit is contained in:
parent
ba00002ac7
commit
cfffaeecb6
@ -309,6 +309,7 @@ public class TextInputLayout extends LinearLayout {
|
||||
0, ViewCompat.getPaddingEnd(mEditText), mEditText.getPaddingBottom());
|
||||
}
|
||||
} else {
|
||||
updateEditTextBackground(false);
|
||||
removeView(mErrorView);
|
||||
mErrorView = null;
|
||||
}
|
||||
@ -364,11 +365,8 @@ public class TextInputLayout extends LinearLayout {
|
||||
.start();
|
||||
|
||||
// Set the EditText's background tint to the error color
|
||||
ViewCompat.setBackgroundTintList(mEditText,
|
||||
ColorStateList.valueOf(mErrorView.getCurrentTextColor()));
|
||||
|
||||
updateEditTextBackground(true);
|
||||
updateLabelVisibility(true);
|
||||
|
||||
} else {
|
||||
if (mErrorView.getVisibility() == VISIBLE) {
|
||||
ViewCompat.animate(mErrorView)
|
||||
@ -385,15 +383,25 @@ public class TextInputLayout extends LinearLayout {
|
||||
}).start();
|
||||
|
||||
// Restore the 'original' tint, using colorControlNormal and colorControlActivated
|
||||
final TintManager tintManager = TintManager.get(getContext());
|
||||
ViewCompat.setBackgroundTintList(mEditText,
|
||||
tintManager.getTintList(R.drawable.abc_edit_text_material));
|
||||
updateEditTextBackground(false);
|
||||
}
|
||||
}
|
||||
|
||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
|
||||
}
|
||||
|
||||
private void updateEditTextBackground(boolean errorShown) {
|
||||
if (errorShown && mErrorView != null) {
|
||||
// Set the EditText's background tint to the error color
|
||||
ViewCompat.setBackgroundTintList(mEditText,
|
||||
ColorStateList.valueOf(mErrorView.getCurrentTextColor()));
|
||||
} else {
|
||||
final TintManager tintManager = TintManager.get(getContext());
|
||||
ViewCompat.setBackgroundTintList(mEditText,
|
||||
tintManager.getTintList(R.drawable.abc_edit_text_material));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the error message that was set to be displayed with
|
||||
* {@link #setError(CharSequence)}, or <code>null</code> if no error was set
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user