Loading core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -51196,6 +51196,7 @@ package android.view.inputmethod { method public boolean performContextMenuAction(int); method public boolean performContextMenuAction(int); method public boolean performEditorAction(int); method public boolean performEditorAction(int); method public boolean performPrivateCommand(String, android.os.Bundle); method public boolean performPrivateCommand(String, android.os.Bundle); method public default boolean performSpellCheck(); method public boolean reportFullscreenMode(boolean); method public boolean reportFullscreenMode(boolean); method public boolean requestCursorUpdates(int); method public boolean requestCursorUpdates(int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean sendKeyEvent(android.view.KeyEvent); core/java/android/view/inputmethod/InputConnection.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -857,6 +857,20 @@ public interface InputConnection { */ */ boolean reportFullscreenMode(boolean enabled); boolean reportFullscreenMode(boolean enabled); /** * Have the editor perform spell checking around the current selection. * * <p>The editor can ignore this method call if it does not support spell checking. * * @return For editor authors, the return value will always be ignored. For IME authors, this * method returns true if the spell check request was sent (whether or not the * associated editor supports spell checking), false if the input connection is no * longer valid. */ default boolean performSpellCheck() { return false; } /** /** * API to send private commands from an input method to its * API to send private commands from an input method to its * connected editor. This can be used to provide domain-specific * connected editor. This can be used to provide domain-specific Loading core/java/android/view/inputmethod/InputConnectionWrapper.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,15 @@ public class InputConnectionWrapper implements InputConnection { return mTarget.reportFullscreenMode(enabled); return mTarget.reportFullscreenMode(enabled); } } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public boolean performSpellCheck() { return mTarget.performSpellCheck(); } /** /** * {@inheritDoc} * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. * @throws NullPointerException if the target is {@code null}. Loading core/java/android/widget/SpellChecker.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -215,6 +215,27 @@ public class SpellChecker implements SpellCheckerSessionListener { spellCheck(); spellCheck(); } } void onPerformSpellCheck() { final int selectionStart = mTextView.getSelectionStart(); final int selectionEnd = mTextView.getSelectionEnd(); final int selectionRangeStart; final int selectionRangeEnd; if (selectionStart < selectionEnd) { selectionRangeStart = selectionStart; selectionRangeEnd = selectionEnd; } else { selectionRangeStart = selectionEnd; selectionRangeEnd = selectionStart; } // Expand the range so that it (hopefully) includes the current sentence. final int start = Math.max(0, selectionRangeStart - MIN_SENTENCE_LENGTH); final int end = Math.min(mTextView.length(), selectionRangeEnd + MIN_SENTENCE_LENGTH); if (DBG) { Log.d(TAG, "performSpellCheckAroundSelection: " + start + ", " + end); } spellCheck(start, end); } public void spellCheck(int start, int end) { public void spellCheck(int start, int end) { if (DBG) { if (DBG) { Log.d(TAG, "Start spell-checking: " + start + ", " + end); Log.d(TAG, "Start spell-checking: " + start + ", " + end); Loading core/java/android/widget/TextView.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -8913,6 +8913,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // intentionally empty // intentionally empty } } /** @hide */ public void onPerformSpellCheck() { if (mEditor != null && mEditor.mSpellChecker != null) { mEditor.mSpellChecker.onPerformSpellCheck(); } } /** /** * Called by the framework in response to a private command from the * Called by the framework in response to a private command from the * current method, provided by it calling * current method, provided by it calling Loading Loading
core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -51196,6 +51196,7 @@ package android.view.inputmethod { method public boolean performContextMenuAction(int); method public boolean performContextMenuAction(int); method public boolean performEditorAction(int); method public boolean performEditorAction(int); method public boolean performPrivateCommand(String, android.os.Bundle); method public boolean performPrivateCommand(String, android.os.Bundle); method public default boolean performSpellCheck(); method public boolean reportFullscreenMode(boolean); method public boolean reportFullscreenMode(boolean); method public boolean requestCursorUpdates(int); method public boolean requestCursorUpdates(int); method public boolean sendKeyEvent(android.view.KeyEvent); method public boolean sendKeyEvent(android.view.KeyEvent);
core/java/android/view/inputmethod/InputConnection.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -857,6 +857,20 @@ public interface InputConnection { */ */ boolean reportFullscreenMode(boolean enabled); boolean reportFullscreenMode(boolean enabled); /** * Have the editor perform spell checking around the current selection. * * <p>The editor can ignore this method call if it does not support spell checking. * * @return For editor authors, the return value will always be ignored. For IME authors, this * method returns true if the spell check request was sent (whether or not the * associated editor supports spell checking), false if the input connection is no * longer valid. */ default boolean performSpellCheck() { return false; } /** /** * API to send private commands from an input method to its * API to send private commands from an input method to its * connected editor. This can be used to provide domain-specific * connected editor. This can be used to provide domain-specific Loading
core/java/android/view/inputmethod/InputConnectionWrapper.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,15 @@ public class InputConnectionWrapper implements InputConnection { return mTarget.reportFullscreenMode(enabled); return mTarget.reportFullscreenMode(enabled); } } /** * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. */ @Override public boolean performSpellCheck() { return mTarget.performSpellCheck(); } /** /** * {@inheritDoc} * {@inheritDoc} * @throws NullPointerException if the target is {@code null}. * @throws NullPointerException if the target is {@code null}. Loading
core/java/android/widget/SpellChecker.java +21 −0 Original line number Original line Diff line number Diff line Loading @@ -215,6 +215,27 @@ public class SpellChecker implements SpellCheckerSessionListener { spellCheck(); spellCheck(); } } void onPerformSpellCheck() { final int selectionStart = mTextView.getSelectionStart(); final int selectionEnd = mTextView.getSelectionEnd(); final int selectionRangeStart; final int selectionRangeEnd; if (selectionStart < selectionEnd) { selectionRangeStart = selectionStart; selectionRangeEnd = selectionEnd; } else { selectionRangeStart = selectionEnd; selectionRangeEnd = selectionStart; } // Expand the range so that it (hopefully) includes the current sentence. final int start = Math.max(0, selectionRangeStart - MIN_SENTENCE_LENGTH); final int end = Math.min(mTextView.length(), selectionRangeEnd + MIN_SENTENCE_LENGTH); if (DBG) { Log.d(TAG, "performSpellCheckAroundSelection: " + start + ", " + end); } spellCheck(start, end); } public void spellCheck(int start, int end) { public void spellCheck(int start, int end) { if (DBG) { if (DBG) { Log.d(TAG, "Start spell-checking: " + start + ", " + end); Log.d(TAG, "Start spell-checking: " + start + ", " + end); Loading
core/java/android/widget/TextView.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -8913,6 +8913,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // intentionally empty // intentionally empty } } /** @hide */ public void onPerformSpellCheck() { if (mEditor != null && mEditor.mSpellChecker != null) { mEditor.mSpellChecker.onPerformSpellCheck(); } } /** /** * Called by the framework in response to a private command from the * Called by the framework in response to a private command from the * current method, provided by it calling * current method, provided by it calling Loading