Merge "When KEYCODE_BACK is received, hide keyboard" into sc-dev

This commit is contained in:
Hyunyoung Song 2021-06-26 20:08:55 +00:00 committed by Android (Google) Code Review
commit 24c8ebd88d
1 changed files with 3 additions and 0 deletions

View File

@ -70,6 +70,9 @@ public class ExtendedEditText extends EditText {
public boolean onKeyPreIme(int keyCode, KeyEvent event) {
// If this is a back key, propagate the key back to the listener
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
if (TextUtils.isEmpty(getText())) {
hideKeyboard();
}
if (mBackKeyListener != null) {
return mBackKeyListener.onBackKey();
}