Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b97e4dd7 authored by wangqi's avatar wangqi Committed by Copybara-Service
Browse files

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
parent 19e85a54
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -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);