Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -50628,6 +50628,7 @@ package android.view.inputmethod { method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public boolean setComposingText(CharSequence, int); method public default boolean setImeTemporarilyConsumesInput(boolean); method public boolean setSelection(int, int); field public static final int CURSOR_UPDATE_IMMEDIATE = 1; // 0x1 field public static final int CURSOR_UPDATE_MONITOR = 2; // 0x2 core/java/android/view/inputmethod/BaseInputConnection.java +3 −1 Original line number Diff line number Diff line Loading @@ -163,11 +163,13 @@ public class BaseInputConnection implements InputConnection { } /** * Default implementation calls {@link #finishComposingText()}. * Default implementation calls {@link #finishComposingText()} and * {@code setImeTemporarilyConsumesInput(false)}. */ @CallSuper public void closeConnection() { finishComposingText(); setImeTemporarilyConsumesInput(false); } /** Loading core/java/android/view/inputmethod/InputConnection.java +18 −0 Original line number Diff line number Diff line Loading @@ -1002,4 +1002,22 @@ public interface InputConnection { */ boolean commitContent(@NonNull InputContentInfo inputContentInfo, int flags, @Nullable Bundle opts); /** * Called by the input method to indicate that it temporarily consumes all input for itself, * or no longer does so. * * <p>Editors should reflect that they are temporarily not receiving input by hiding the * cursor if {@code imeTemporarilyConsumesInput} is {@code true}, and resume showing the * cursor if it is {@code false}. * * @param imeTemporarilyConsumesInput {@code true} when the IME is temporarily consuming input * and the cursor should be hidden, {@code false} when input to the editor resumes and the * cursor should be shown again. * @return {@code true} on success, {@code false} if the input connection is no longer valid, or * the protocol is not supported. */ default boolean setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { return false; } } core/java/android/view/inputmethod/InputConnectionWrapper.java +9 −0 Original line number Diff line number Diff line Loading @@ -335,4 +335,13 @@ public class InputConnectionWrapper implements InputConnection { public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return mTarget.commitContent(inputContentInfo, flags, opts); } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public boolean setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { return mTarget.setImeTemporarilyConsumesInput(imeTemporarilyConsumesInput); } } core/java/android/widget/TextView.java +33 −2 Original line number Diff line number Diff line Loading @@ -494,6 +494,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private TextUtils.TruncateAt mEllipsize; // A flag to indicate the cursor was hidden by IME. private boolean mImeTemporarilyConsumesInput; // Whether cursor is visible without regard to {@link mImeTemporarilyConsumesInput}. // {code true} is the default value. private boolean mCursorVisibleFromAttr = true; static class Drawables { static final int LEFT = 0; static final int TOP = 1; Loading Loading @@ -10496,7 +10503,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * Set whether the cursor is visible. The default is true. Note that this property only * makes sense for editable TextView. * makes sense for editable TextView. If IME is temporarily consuming the input, the cursor will * be always invisible, visibility will be updated as the last state when IME does not consume * the input anymore. * * @see #isCursorVisible() * Loading @@ -10504,6 +10513,25 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @android.view.RemotableViewMethod public void setCursorVisible(boolean visible) { mCursorVisibleFromAttr = visible; updateCursorVisibleInternal(); } /** * Sets the IME is temporarily consuming the input and make the cursor invisible if * {@code imeTemporarilyConsumesInput} is {@code true}. Otherwise, make the cursor visible. * * @param imeTemporarilyConsumesInput {@code true} if IME is temporarily consuming the input * * @hide */ public void setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { mImeTemporarilyConsumesInput = imeTemporarilyConsumesInput; updateCursorVisibleInternal(); } private void updateCursorVisibleInternal() { boolean visible = mCursorVisibleFromAttr && !mImeTemporarilyConsumesInput; if (visible && mEditor == null) return; // visible is the default value with no edit data createEditorIfNeeded(); if (mEditor.mCursorVisible != visible) { Loading @@ -10518,7 +10546,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } /** * @return whether or not the cursor is visible (assuming this TextView is editable) * @return whether or not the cursor is visible (assuming this TextView is editable). This * method may return {@code false} when the IME is temporarily consuming the input even if the * {@code mEditor.mCursorVisible} attribute is {@code true} or {@code #setCursorVisible(true)} * is called. * * @see #setCursorVisible(boolean) * Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -50628,6 +50628,7 @@ package android.view.inputmethod { method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean setComposingRegion(int, int); method public boolean setComposingText(CharSequence, int); method public default boolean setImeTemporarilyConsumesInput(boolean); method public boolean setSelection(int, int); field public static final int CURSOR_UPDATE_IMMEDIATE = 1; // 0x1 field public static final int CURSOR_UPDATE_MONITOR = 2; // 0x2
core/java/android/view/inputmethod/BaseInputConnection.java +3 −1 Original line number Diff line number Diff line Loading @@ -163,11 +163,13 @@ public class BaseInputConnection implements InputConnection { } /** * Default implementation calls {@link #finishComposingText()}. * Default implementation calls {@link #finishComposingText()} and * {@code setImeTemporarilyConsumesInput(false)}. */ @CallSuper public void closeConnection() { finishComposingText(); setImeTemporarilyConsumesInput(false); } /** Loading
core/java/android/view/inputmethod/InputConnection.java +18 −0 Original line number Diff line number Diff line Loading @@ -1002,4 +1002,22 @@ public interface InputConnection { */ boolean commitContent(@NonNull InputContentInfo inputContentInfo, int flags, @Nullable Bundle opts); /** * Called by the input method to indicate that it temporarily consumes all input for itself, * or no longer does so. * * <p>Editors should reflect that they are temporarily not receiving input by hiding the * cursor if {@code imeTemporarilyConsumesInput} is {@code true}, and resume showing the * cursor if it is {@code false}. * * @param imeTemporarilyConsumesInput {@code true} when the IME is temporarily consuming input * and the cursor should be hidden, {@code false} when input to the editor resumes and the * cursor should be shown again. * @return {@code true} on success, {@code false} if the input connection is no longer valid, or * the protocol is not supported. */ default boolean setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { return false; } }
core/java/android/view/inputmethod/InputConnectionWrapper.java +9 −0 Original line number Diff line number Diff line Loading @@ -335,4 +335,13 @@ public class InputConnectionWrapper implements InputConnection { public boolean commitContent(InputContentInfo inputContentInfo, int flags, Bundle opts) { return mTarget.commitContent(inputContentInfo, flags, opts); } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public boolean setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { return mTarget.setImeTemporarilyConsumesInput(imeTemporarilyConsumesInput); } }
core/java/android/widget/TextView.java +33 −2 Original line number Diff line number Diff line Loading @@ -494,6 +494,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private TextUtils.TruncateAt mEllipsize; // A flag to indicate the cursor was hidden by IME. private boolean mImeTemporarilyConsumesInput; // Whether cursor is visible without regard to {@link mImeTemporarilyConsumesInput}. // {code true} is the default value. private boolean mCursorVisibleFromAttr = true; static class Drawables { static final int LEFT = 0; static final int TOP = 1; Loading Loading @@ -10496,7 +10503,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * Set whether the cursor is visible. The default is true. Note that this property only * makes sense for editable TextView. * makes sense for editable TextView. If IME is temporarily consuming the input, the cursor will * be always invisible, visibility will be updated as the last state when IME does not consume * the input anymore. * * @see #isCursorVisible() * Loading @@ -10504,6 +10513,25 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener */ @android.view.RemotableViewMethod public void setCursorVisible(boolean visible) { mCursorVisibleFromAttr = visible; updateCursorVisibleInternal(); } /** * Sets the IME is temporarily consuming the input and make the cursor invisible if * {@code imeTemporarilyConsumesInput} is {@code true}. Otherwise, make the cursor visible. * * @param imeTemporarilyConsumesInput {@code true} if IME is temporarily consuming the input * * @hide */ public void setImeTemporarilyConsumesInput(boolean imeTemporarilyConsumesInput) { mImeTemporarilyConsumesInput = imeTemporarilyConsumesInput; updateCursorVisibleInternal(); } private void updateCursorVisibleInternal() { boolean visible = mCursorVisibleFromAttr && !mImeTemporarilyConsumesInput; if (visible && mEditor == null) return; // visible is the default value with no edit data createEditorIfNeeded(); if (mEditor.mCursorVisible != visible) { Loading @@ -10518,7 +10546,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } /** * @return whether or not the cursor is visible (assuming this TextView is editable) * @return whether or not the cursor is visible (assuming this TextView is editable). This * method may return {@code false} when the IME is temporarily consuming the input even if the * {@code mEditor.mCursorVisible} attribute is {@code true} or {@code #setCursorVisible(true)} * is called. * * @see #setCursorVisible(boolean) * Loading