| Index: remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| diff --git a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| index ae3bbd8d7d7d4bfbf263c9b79f6c1461338e81c8..b4b4ae21b3deea0148c00374854edcbae46e8ec0 100644
|
| --- a/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| +++ b/remoting/android/java/src/org/chromium/chromoting/DesktopView.java
|
| @@ -7,8 +7,10 @@ package org.chromium.chromoting;
|
| import android.content.Context;
|
| import android.text.InputType;
|
| import android.util.AttributeSet;
|
| +import android.view.KeyEvent;
|
| import android.view.MotionEvent;
|
| import android.view.SurfaceView;
|
| +import android.view.inputmethod.BaseInputConnection;
|
| import android.view.inputmethod.EditorInfo;
|
| import android.view.inputmethod.InputConnection;
|
| import android.view.inputmethod.InputMethodManager;
|
| @@ -86,8 +88,8 @@ public final class DesktopView extends SurfaceView {
|
| /** Called when a software keyboard is requested, and specifies its options. */
|
| @Override
|
| public final InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
| - // Disables rich input support and instead requests simple key events.
|
| - outAttrs.inputType = InputType.TYPE_NULL;
|
| + // Enable rich input support and disable suggestions.
|
| + outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
|
|
|
| // Prevents most third-party IMEs from ignoring our Activity's adjustResize preference.
|
| outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN;
|
| @@ -98,7 +100,18 @@ public final class DesktopView extends SurfaceView {
|
| // Stops software keyboards from closing as soon as the enter key is pressed.
|
| outAttrs.imeOptions |= EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION;
|
|
|
| - return null;
|
| + return new BaseInputConnection(this, false) {
|
| + public boolean deleteSurroundingText(int beforeLength, int afterLength) {
|
| + // This is to fix the backspace functionality of the soft keyboard. The default
|
| + // connection will try to delete the last character in the context while DesktopView
|
| + // doesn't have a text context so we need to manually handle the backspace case.
|
| + if (beforeLength == 1 && afterLength == 0) {
|
| + return sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL))
|
| + && sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DEL));
|
| + }
|
| + return super.deleteSurroundingText(beforeLength, afterLength);
|
| + }
|
| + };
|
| }
|
|
|
| /** Called whenever the user attempts to touch the canvas. */
|
|
|