material-components/material-components-android-codelabs

[MDC-101] Should use TextWatcher instead of OnKeyListener for listening to text changes inside EditText

kdb13 opened this issue · 0 comments

kdb13 commented

Describe the bug
In MDC-101, when the password text field is being listened for text changes, the codelab is using an OnKeyListener, which should not be used as its documentation says that it will only detect hardware key presses and not software key presses.

Although it works in some cases, it might not always for every device.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://codelabs.developers.google.com/codelabs/mdc-101-java/#4
  2. Click on `Step 5 - Navigate to the next fragment'
  3. Scroll down to LoginFragment.java and see the implementation of onCreateView()
  4. See that an OnKeyListener is being set to passwordEditText.

Expected behavior
The implementation should be TextWatcher instead of OnKeyListener.

Codelab details (please complete the following information about the codelab):