Loading core/java/android/view/inputmethod/InputConnection.java +21 −15 Original line number Original line Diff line number Diff line Loading @@ -337,14 +337,17 @@ public interface InputConnection { public boolean deleteSurroundingText(int beforeLength, int afterLength); public boolean deleteSurroundingText(int beforeLength, int afterLength); /** /** * Set composing text around the current cursor position with the * Replace the currently composing text with the given text, and * given text, and set the new cursor position. Any composing text * set the new cursor position. Any composing text set previously * set previously will be removed automatically. * will be removed automatically. * * * <p>If there is any composing span currently active, all * <p>If there is any composing span currently active, all * characters that it comprises are removed. The passed text is * characters that it comprises are removed. The passed text is * added in its place, and a composing span is added to this * added in its place, and a composing span is added to this * text. Finally, the cursor is moved to the location specified by * text. If there is no composing span active, the passed text is * added at the cursor position (removing selected characters * first if any), and a composing span is added on the new text. * Finally, the cursor is moved to the location specified by * <code>newCursorPosition</code>.</p> * <code>newCursorPosition</code>.</p> * * * <p>This is usually called by IMEs to add or remove or change * <p>This is usually called by IMEs to add or remove or change Loading Loading @@ -447,8 +450,10 @@ public interface InputConnection { * * * <p>This method removes the contents of the currently composing * <p>This method removes the contents of the currently composing * text and replaces it with the passed CharSequence, and then * text and replaces it with the passed CharSequence, and then * moves the cursor according to {@code newCursorPosition}. * moves the cursor according to {@code newCursorPosition}. If there * This behaves like calling * is no composing text when this method is called, the new text is * inserted at the cursor position, removing text inside the selection * if any. This behaves like calling * {@link #setComposingText(CharSequence, int) setComposingText(text, newCursorPosition)} * {@link #setComposingText(CharSequence, int) setComposingText(text, newCursorPosition)} * then {@link #finishComposingText()}.</p> * then {@link #finishComposingText()}.</p> * * Loading @@ -461,15 +466,16 @@ public interface InputConnection { * but be careful to wait until the batch edit is over if one is * but be careful to wait until the batch edit is over if one is * in progress.</p> * in progress.</p> * * * @param text The committed text. This may include styles. * @param text The text to commit. This may include styles. * @param newCursorPosition The new cursor position around the text. If * @param newCursorPosition The new cursor position around the text, * > 0, this is relative to the end of the text - 1; if <= 0, this * in Java characters. If > 0, this is relative to the end * is relative to the start of the text. So a value of 1 will * of the text - 1; if <= 0, this is relative to the start * always advance you to the position after the full text being * of the text. So a value of 1 will always advance the cursor * inserted. Note that this means you can't position the cursor * to the position after the full text being inserted. Note that * within the text, because the editor can make modifications to * this means you can't position the cursor within the text, * the text you are providing so it is not possible to correctly * because the editor can make modifications to the text * specify locations there. * you are providing so it is not possible to correctly specify * locations there. * @return true on success, false if the input connection is no longer * @return true on success, false if the input connection is no longer * valid. * valid. */ */ Loading Loading
core/java/android/view/inputmethod/InputConnection.java +21 −15 Original line number Original line Diff line number Diff line Loading @@ -337,14 +337,17 @@ public interface InputConnection { public boolean deleteSurroundingText(int beforeLength, int afterLength); public boolean deleteSurroundingText(int beforeLength, int afterLength); /** /** * Set composing text around the current cursor position with the * Replace the currently composing text with the given text, and * given text, and set the new cursor position. Any composing text * set the new cursor position. Any composing text set previously * set previously will be removed automatically. * will be removed automatically. * * * <p>If there is any composing span currently active, all * <p>If there is any composing span currently active, all * characters that it comprises are removed. The passed text is * characters that it comprises are removed. The passed text is * added in its place, and a composing span is added to this * added in its place, and a composing span is added to this * text. Finally, the cursor is moved to the location specified by * text. If there is no composing span active, the passed text is * added at the cursor position (removing selected characters * first if any), and a composing span is added on the new text. * Finally, the cursor is moved to the location specified by * <code>newCursorPosition</code>.</p> * <code>newCursorPosition</code>.</p> * * * <p>This is usually called by IMEs to add or remove or change * <p>This is usually called by IMEs to add or remove or change Loading Loading @@ -447,8 +450,10 @@ public interface InputConnection { * * * <p>This method removes the contents of the currently composing * <p>This method removes the contents of the currently composing * text and replaces it with the passed CharSequence, and then * text and replaces it with the passed CharSequence, and then * moves the cursor according to {@code newCursorPosition}. * moves the cursor according to {@code newCursorPosition}. If there * This behaves like calling * is no composing text when this method is called, the new text is * inserted at the cursor position, removing text inside the selection * if any. This behaves like calling * {@link #setComposingText(CharSequence, int) setComposingText(text, newCursorPosition)} * {@link #setComposingText(CharSequence, int) setComposingText(text, newCursorPosition)} * then {@link #finishComposingText()}.</p> * then {@link #finishComposingText()}.</p> * * Loading @@ -461,15 +466,16 @@ public interface InputConnection { * but be careful to wait until the batch edit is over if one is * but be careful to wait until the batch edit is over if one is * in progress.</p> * in progress.</p> * * * @param text The committed text. This may include styles. * @param text The text to commit. This may include styles. * @param newCursorPosition The new cursor position around the text. If * @param newCursorPosition The new cursor position around the text, * > 0, this is relative to the end of the text - 1; if <= 0, this * in Java characters. If > 0, this is relative to the end * is relative to the start of the text. So a value of 1 will * of the text - 1; if <= 0, this is relative to the start * always advance you to the position after the full text being * of the text. So a value of 1 will always advance the cursor * inserted. Note that this means you can't position the cursor * to the position after the full text being inserted. Note that * within the text, because the editor can make modifications to * this means you can't position the cursor within the text, * the text you are providing so it is not possible to correctly * because the editor can make modifications to the text * specify locations there. * you are providing so it is not possible to correctly specify * locations there. * @return true on success, false if the input connection is no longer * @return true on success, false if the input connection is no longer * valid. * valid. */ */ Loading