Skip to content

Commit

Permalink
[TextInputLayout] Fixed clear icon and placeholder text being display…
Browse files Browse the repository at this point in the history
…ed when the text field is initialized with input text.

Resolves #1379

PiperOrigin-RevId: 315317199
  • Loading branch information
leticiarossi authored and ymarian committed Jun 8, 2020
1 parent 3e3bc41 commit 9b0a8d9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void onFocusChange(View v, boolean hasFocus) {
@Override
public void onEditTextAttached(@NonNull TextInputLayout textInputLayout) {
EditText editText = textInputLayout.getEditText();
textInputLayout.setEndIconVisible(hasText(editText.getText()));
textInputLayout.setEndIconVisible(editText.hasFocus() && hasText(editText.getText()));
// Make sure there's always only one clear text text watcher added
textInputLayout.setEndIconCheckable(false);
editText.setOnFocusChangeListener(onFocusChangeListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3809,7 +3809,7 @@ private void collapseHint(boolean animate) {
if (cutoutEnabled()) {
openCutout();
}
showPlaceholderText();
updatePlaceholderText();

updatePrefixTextVisibility();
updateSuffixTextVisibility();
Expand Down

0 comments on commit 9b0a8d9

Please sign in to comment.