diff options
| author | 2016-01-12 00:08:39 +0000 | |
|---|---|---|
| committer | 2016-01-12 00:08:39 +0000 | |
| commit | f55ed12fd128961db0ab02d9884bda9721cc1e66 (patch) | |
| tree | ada2e453454705739fc5f72dcd1d052f1c54670b | |
| parent | 7c132d82c5600eb266a0121fe940cd8711a047e7 (diff) | |
| parent | 5f137933d130e8e5f9d0d2285f6799e459befb5a (diff) | |
Merge "Enrich JavaDoc for IC#deleteSurroundingText()."
| -rw-r--r-- | core/java/android/view/inputmethod/BaseInputConnection.java | 21 | ||||
| -rw-r--r-- | core/java/android/view/inputmethod/InputConnection.java | 15 |
2 files changed, 23 insertions, 13 deletions
diff --git a/core/java/android/view/inputmethod/BaseInputConnection.java b/core/java/android/view/inputmethod/BaseInputConnection.java index ba5d6c2896ef..6e5e5915bb6f 100644 --- a/core/java/android/view/inputmethod/BaseInputConnection.java +++ b/core/java/android/view/inputmethod/BaseInputConnection.java @@ -201,10 +201,17 @@ public class BaseInputConnection implements InputConnection { } /** - * The default implementation performs the deletion around the current - * selection position of the editable text. - * @param beforeLength - * @param afterLength + * The default implementation performs the deletion around the current selection position of the + * editable text. + * + * @param beforeLength The number of characters before the cursor to be deleted, in code unit. + * If this is greater than the number of existing characters between the beginning of the + * text and the cursor, then this method does not fail but deletes all the characters in + * that range. + * @param afterLength The number of characters after the cursor to be deleted, in code unit. + * If this is greater than the number of existing characters between the cursor and + * the end of the text, then this method does not fail but deletes all the characters in + * that range. */ public boolean deleteSurroundingText(int beforeLength, int afterLength) { if (DEBUG) Log.v(TAG, "deleteSurroundingText " + beforeLength @@ -213,7 +220,7 @@ public class BaseInputConnection implements InputConnection { if (content == null) return false; beginBatchEdit(); - + int a = Selection.getSelectionStart(content); int b = Selection.getSelectionEnd(content); @@ -253,9 +260,9 @@ public class BaseInputConnection implements InputConnection { content.delete(b, end); } - + endBatchEdit(); - + return true; } diff --git a/core/java/android/view/inputmethod/InputConnection.java b/core/java/android/view/inputmethod/InputConnection.java index ff992d39fc66..be7bc14f0515 100644 --- a/core/java/android/view/inputmethod/InputConnection.java +++ b/core/java/android/view/inputmethod/InputConnection.java @@ -335,12 +335,15 @@ public interface InputConnection { * but be careful to wait until the batch edit is over if one is * in progress.</p> * - * @param beforeLength The number of characters to be deleted before the - * current cursor position. - * @param afterLength The number of characters to be deleted after the - * current cursor position. - * @return true on success, false if the input connection is no longer - * valid. + * @param beforeLength The number of characters before the cursor to be deleted, in code unit. + * If this is greater than the number of existing characters between the beginning of the + * text and the cursor, then this method does not fail but deletes all the characters in + * that range. + * @param afterLength The number of characters after the cursor to be deleted, in code unit. + * If this is greater than the number of existing characters between the cursor and + * the end of the text, then this method does not fail but deletes all the characters in + * that range. + * @return true on success, false if the input connection is no longer valid. */ public boolean deleteSurroundingText(int beforeLength, int afterLength); |