summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java4
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java23
-rw-r--r--core/java/android/widget/TextView.java58
3 files changed, 35 insertions, 50 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index f35a438..255eb6c 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -49,6 +49,7 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AnimationUtils;
import android.view.inputmethod.CompletionInfo;
+import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.ExtractedText;
import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputBinding;
@@ -56,7 +57,6 @@ import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
-import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
@@ -1024,7 +1024,7 @@ public class InputMethodService extends AbstractInputMethodService {
* there is no hard keyboard or the keyboard is hidden. If you change what
* this returns, you will need to call {@link #updateInputViewShown()}
* yourself whenever the returned value may have changed to have it
- * re-evalauted and applied.
+ * re-evaluated and applied.
*/
public boolean onEvaluateInputViewShown() {
Configuration config = getResources().getConfiguration();
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index d310237..3afc02c 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -16,6 +16,15 @@
package android.view.inputmethod;
+import com.android.internal.os.HandlerCaller;
+import com.android.internal.view.IInputConnectionWrapper;
+import com.android.internal.view.IInputContext;
+import com.android.internal.view.IInputMethodCallback;
+import com.android.internal.view.IInputMethodClient;
+import com.android.internal.view.IInputMethodManager;
+import com.android.internal.view.IInputMethodSession;
+import com.android.internal.view.InputBindResult;
+
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
@@ -27,23 +36,12 @@ import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
import android.util.Log;
-import android.util.Pair;
import android.util.PrintWriterPrinter;
import android.util.Printer;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewRoot;
-import android.view.inputmethod.InputMethodSubtype;
-
-import com.android.internal.os.HandlerCaller;
-import com.android.internal.view.IInputConnectionWrapper;
-import com.android.internal.view.IInputContext;
-import com.android.internal.view.IInputMethodCallback;
-import com.android.internal.view.IInputMethodClient;
-import com.android.internal.view.IInputMethodManager;
-import com.android.internal.view.IInputMethodSession;
-import com.android.internal.view.InputBindResult;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -96,7 +94,7 @@ import java.util.concurrent.TimeUnit;
* be aware of are:</p>
*
* <ul>
- * <li> Properly set the {@link android.R.attr#inputType} if your editable
+ * <li> Properly set the {@link android.R.attr#inputType} in your editable
* text views, so that the input method will have enough context to help the
* user in entering text into them.
* <li> Deal well with losing screen space when the input method is
@@ -389,6 +387,7 @@ public final class InputMethodManager {
super(mainLooper, conn);
}
+ @Override
public boolean isActive() {
return mActive;
}
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index ab07a7e..ae6ecfb 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -372,7 +372,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mTextPaint.density = getResources().getDisplayMetrics().density;
mTextPaint.setCompatibilityScaling(
getResources().getCompatibilityInfo().applicationScale);
-
+
// If we get the paint from the skin, we should set it to left, since
// the layout always wants it to be left.
// mTextPaint.setTextAlign(Paint.Align.LEFT);
@@ -7130,11 +7130,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
super.onFocusChanged(focused, direction, previouslyFocusedRect);
- // After super.onFocusChanged so that this TextView is registered and can ask for the IME
- // Showing the IME while focus is moved using the D-Pad is a bad idea, however this does
- // not happen in that case (using the arrows on a bluetooth keyboard).
- if (focused) {
- onTouchFinished(null);
+ // Performed after super.onFocusChanged so that this TextView is registered and can ask for
+ // the IME. Showing the IME while focus is moved using the D-Pad is a bad idea, however this
+ // does not happen in that case (using the arrows on a bluetooth keyboard).
+ if (focused && isTextEditable()) {
+ final InputMethodManager imm = (InputMethodManager)
+ getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+
+ imm.showSoftInput(this, 0, null);
}
}
@@ -7326,7 +7329,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
csr = new CommitSelectionReceiver(oldSelStart, oldSelEnd);
}
- handled = onTouchFinished(csr);
+ // Show the IME, except when selecting in read-only text.
+ if (!mTextIsSelectable) {
+ final InputMethodManager imm = (InputMethodManager)
+ getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+
+ handled |= imm.showSoftInput(this, 0, csr) && (csr != null);
+ }
+
+ stopSelectionActionMode();
+ boolean selectAllGotFocus = mSelectAllOnFocus && mTouchFocusSelected;
+ if (hasInsertionController() && !selectAllGotFocus) {
+ getInsertionController().show();
+ }
}
}
@@ -7338,35 +7353,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
return superResult;
}
- /** Shows the IME if applicable, ends selection mode and displays the selection controller.
- *
- * This method is called at the end of a touch event, when the finger is lifted up.
- * It is also called when the TextField gains focus indirectly through a dispatched event from
- * one of its parents. We want to have the same behavior in that case.
- *
- * @param csr A (possibly null) callback called if the IME has been displayed
- * @return true if the event was properly sent to the csr
- */
- private boolean onTouchFinished(CommitSelectionReceiver csr) {
- boolean handled = false;
-
- // Show the IME, except when selecting in read-only text.
- if (!mTextIsSelectable) {
- final InputMethodManager imm = (InputMethodManager)
- getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
-
- handled = imm.showSoftInput(this, 0, csr) && (csr != null);
- }
-
- stopSelectionActionMode();
- boolean selectAllGotFocus = mSelectAllOnFocus && mTouchFocusSelected;
- if (hasInsertionController() && !selectAllGotFocus) {
- getInsertionController().show();
- }
-
- return handled;
- }
-
private void prepareCursorControllers() {
boolean windowSupportsHandles = false;