summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2018-06-25 15:11:09 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-26 13:43:19 -0700
commitb97e4dd76e162ae3f94f4057d8779154bf89f591 (patch)
treedc773b3bd7c9227663d96a34ae9c30a63575c506 /java
parent19e85a54d723bbe23e51bed70df89bd3861570d7 (diff)
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
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/rtt/impl/RttChatFragment.java11
1 files changed, 7 insertions, 4 deletions
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);