From b97e4dd76e162ae3f94f4057d8779154bf89f591 Mon Sep 17 00:00:00 2001 From: wangqi Date: Mon, 25 Jun 2018 15:11:09 -0700 Subject: Fix bug that input cannot be deleted on non-English keybaord such as Japanese and Chinese keyboard. Bug: 110564298 Test: manual PiperOrigin-RevId: 202027152 Change-Id: If27d23fb04abe6db49748dec68c4cd9be5f11fb1 --- java/com/android/incallui/rtt/impl/RttChatFragment.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'java') diff --git a/java/com/android/incallui/rtt/impl/RttChatFragment.java b/java/com/android/incallui/rtt/impl/RttChatFragment.java index 36235df19..73adb9f1c 100644 --- a/java/com/android/incallui/rtt/impl/RttChatFragment.java +++ b/java/com/android/incallui/rtt/impl/RttChatFragment.java @@ -177,10 +177,13 @@ public class RttChatFragment extends Fragment editText.setOnKeyListener( (v, keyCode, event) -> { - // This is only triggered when input method doesn't handle delete key, which means the - // current - // input box is empty. - if (keyCode == KeyEvent.KEYCODE_DEL && event.getAction() == KeyEvent.ACTION_DOWN) { + // This is only triggered when input method doesn't handle delete key, which usually means + // the current input box is empty. + // On non-English keyboard delete key could be passed here so we still need to check if + // the input box is empty. + if (keyCode == KeyEvent.KEYCODE_DEL + && event.getAction() == KeyEvent.ACTION_DOWN + && TextUtils.isEmpty(editText.getText())) { String lastMessage = adapter.retrieveLastLocalMessage(); if (lastMessage != null) { resumeInput(lastMessage); -- cgit v1.2.3