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

Commit 287035f5 authored by Gilles Debunne's avatar Gilles Debunne Committed by Android Git Automerger
Browse files

am 88b5953a: Merge "NULL inputType text fields should never show the IME." into honeycomb

* commit '88b5953a':
  NULL inputType text fields should never show the IME.
parents b77e727a 88b5953a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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();
+11 −12
Original line number Diff line number Diff line
@@ -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;
        }
+22 −36
Original line number Diff line number Diff line
@@ -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,36 +7329,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                        csr = new CommitSelectionReceiver(oldSelStart, oldSelEnd);
                    }

                    handled = onTouchFinished(csr);
                }
            }

            if (handled) {
                return true;
            }
        }

        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);
                        handled |= imm.showSoftInput(this, 0, csr) && (csr != null);
                    }

                    stopSelectionActionMode();
@@ -7363,8 +7342,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                    if (hasInsertionController() && !selectAllGotFocus) {
                        getInsertionController().show();
                    }
                }
            }

        return handled;
            if (handled) {
                return true;
            }
        }

        return superResult;
    }

    private void prepareCursorControllers() {