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

Commit 306bcc3d authored by Abodunrinwa Toki's avatar Abodunrinwa Toki Committed by Android (Google) Code Review
Browse files

Merge "EditText: Proper support for "textIsSelectable"."

parents 79758c8e 2d321c7c
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -1310,6 +1310,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            createEditorIfNeeded();
            mEditor.mKeyListener = TextKeyListener.getInstance(autotext, cap);
            mEditor.mInputType = inputType;
        } else if (editable) {
            createEditorIfNeeded();
            mEditor.mKeyListener = TextKeyListener.getInstance();
            mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;
        } else if (isTextSelectable()) {
            // Prevent text changes from keyboard.
            if (mEditor != null) {
@@ -1319,10 +1323,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
            bufferType = BufferType.SPANNABLE;
            // So that selection can be changed using arrow keys and touch is handled.
            setMovementMethod(ArrowKeyMovementMethod.getInstance());
        } else if (editable) {
            createEditorIfNeeded();
            mEditor.mKeyListener = TextKeyListener.getInstance();
            mEditor.mInputType = EditorInfo.TYPE_CLASS_TEXT;
        } else {
            if (mEditor != null) mEditor.mKeyListener = null;

@@ -8536,13 +8536,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
                handled |= mClickableSpanOnClickGestureDetector.onTouchEvent(event);
            }

            final boolean textIsSelectable = isTextSelectable();
            if (touchIsFinished && (isTextEditable() || textIsSelectable)) {
            if (touchIsFinished && (isTextEditable() || isTextSelectable())) {
                // Show the IME, except when selecting in read-only text.
                final InputMethodManager imm = InputMethodManager.peekInstance();
                viewClicked(imm);
                if (!textIsSelectable && mEditor.mShowSoftInputOnFocus) {
                    handled |= imm != null && imm.showSoftInput(this, 0);
                if (isTextEditable() && mEditor.mShowSoftInputOnFocus && imm != null) {
                    imm.showSoftInput(this, 0);
                }

                // The above condition ensures that the mEditor is not null