diff options
| author | Yohei Yukawa <yukawa@google.com> | 2014-06-10 12:26:34 +0900 |
|---|---|---|
| committer | Yohei Yukawa <yukawa@google.com> | 2014-06-10 14:19:28 +0900 |
| commit | c46b5f04aa2a9fd292c117d2824f70fcf06e86ba (patch) | |
| tree | 46d6c2beefa882c6418454e05845ab0921792cc1 | |
| parent | cbb0213d81205c4843816c6d4bcee5e4e29936e8 (diff) | |
| download | frameworks_base-c46b5f04aa2a9fd292c117d2824f70fcf06e86ba.zip frameworks_base-c46b5f04aa2a9fd292c117d2824f70fcf06e86ba.tar.gz frameworks_base-c46b5f04aa2a9fd292c117d2824f70fcf06e86ba.tar.bz2 | |
Rename CursorAnchorInfoBuilder with Builder
Inner Builder class should not inherit full class name of outer
class.
BUG: 15516230
Change-Id: I2d56edebb0c85639db57ca5b2aadb22c67fc5926
| -rw-r--r-- | api/current.txt | 14 | ||||
| -rw-r--r-- | core/java/android/view/inputmethod/CursorAnchorInfo.java | 23 | ||||
| -rw-r--r-- | core/java/android/widget/Editor.java | 5 | ||||
| -rw-r--r-- | core/tests/inputmethodtests/src/android/os/CursorAnchorInfoTest.java | 9 |
4 files changed, 23 insertions, 28 deletions
diff --git a/api/current.txt b/api/current.txt index d18fddc..ddc29a2 100644 --- a/api/current.txt +++ b/api/current.txt @@ -33917,15 +33917,15 @@ package android.view.inputmethod { field public static final android.os.Parcelable.Creator CREATOR; } - public static final class CursorAnchorInfo.CursorAnchorInfoBuilder { - ctor public CursorAnchorInfo.CursorAnchorInfoBuilder(); - method public android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder addCharacterRect(int, float, float, float, float); + public static final class CursorAnchorInfo.Builder { + ctor public CursorAnchorInfo.Builder(); + method public android.view.inputmethod.CursorAnchorInfo.Builder addCharacterRect(int, float, float, float, float); method public android.view.inputmethod.CursorAnchorInfo build(); method public void reset(); - method public android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder setComposingText(int, java.lang.CharSequence); - method public android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder setInsertionMarkerLocation(float, float, float, float); - method public android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder setMatrix(android.graphics.Matrix); - method public android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder setSelectionRange(int, int); + method public android.view.inputmethod.CursorAnchorInfo.Builder setComposingText(int, java.lang.CharSequence); + method public android.view.inputmethod.CursorAnchorInfo.Builder setInsertionMarkerLocation(float, float, float, float); + method public android.view.inputmethod.CursorAnchorInfo.Builder setMatrix(android.graphics.Matrix); + method public android.view.inputmethod.CursorAnchorInfo.Builder setSelectionRange(int, int); } public class EditorInfo implements android.text.InputType android.os.Parcelable { diff --git a/core/java/android/view/inputmethod/CursorAnchorInfo.java b/core/java/android/view/inputmethod/CursorAnchorInfo.java index fad6747..66f5f6c 100644 --- a/core/java/android/view/inputmethod/CursorAnchorInfo.java +++ b/core/java/android/view/inputmethod/CursorAnchorInfo.java @@ -186,12 +186,12 @@ public final class CursorAnchorInfo implements Parcelable { /** * Builder for {@link CursorAnchorInfo}. This class is not designed to be thread-safe. */ - public static final class CursorAnchorInfoBuilder { + public static final class Builder { /** * Sets the text range of the selection. Calling this can be skipped if there is no * selection. */ - public CursorAnchorInfoBuilder setSelectionRange(final int newStart, final int newEnd) { + public Builder setSelectionRange(final int newStart, final int newEnd) { mSelectionStart = newStart; mSelectionEnd = newEnd; return this; @@ -205,8 +205,7 @@ public final class CursorAnchorInfo implements Parcelable { * @param index index where the composing text starts. * @param composingText the entire composing text. */ - public CursorAnchorInfoBuilder setComposingText(final int index, - final CharSequence composingText) { + public Builder setComposingText(final int index, final CharSequence composingText) { mComposingTextStart = index; if (composingText == null) { mComposingText = null; @@ -236,9 +235,8 @@ public final class CursorAnchorInfo implements Parcelable { * that will be transformed with the transformation matrix when rendered on the screen. This * should be calculated or compatible with {@link Layout#getLineBottom(int)}. */ - public CursorAnchorInfoBuilder setInsertionMarkerLocation( - final float horizontalPosition, final float lineTop, final float lineBaseline, - final float lineBottom){ + public Builder setInsertionMarkerLocation(final float horizontalPosition, + final float lineTop, final float lineBaseline, final float lineBottom){ mInsertionMarkerHorizontal = horizontalPosition; mInsertionMarkerTop = lineTop; mInsertionMarkerBaseline = lineBaseline; @@ -269,9 +267,8 @@ public final class CursorAnchorInfo implements Parcelable { * @throws IllegalArgumentException If the index is a negative value, or not greater than * all of the previously called indices. */ - public CursorAnchorInfoBuilder addCharacterRect(final int index, - final float leadingEdgeX, final float leadingEdgeY, final float trailingEdgeX, - final float trailingEdgeY) { + public Builder addCharacterRect(final int index, final float leadingEdgeX, + final float leadingEdgeY, final float trailingEdgeX, final float trailingEdgeY) { if (index < 0) { throw new IllegalArgumentException("index must not be a negative integer."); } @@ -289,7 +286,7 @@ public final class CursorAnchorInfo implements Parcelable { * @param matrix transformation matrix from local coordinates into screen coordinates. null * is interpreted as an identity matrix. */ - public CursorAnchorInfoBuilder setMatrix(final Matrix matrix) { + public Builder setMatrix(final Matrix matrix) { mMatrix.set(matrix != null ? matrix : Matrix.IDENTITY_MATRIX); return this; } @@ -297,7 +294,7 @@ public final class CursorAnchorInfo implements Parcelable { /** * @return {@link CursorAnchorInfo} using parameters in this - * {@link CursorAnchorInfoBuilder}. + * {@link Builder}. */ public CursorAnchorInfo build() { return new CursorAnchorInfo(this); @@ -323,7 +320,7 @@ public final class CursorAnchorInfo implements Parcelable { } } - private CursorAnchorInfo(final CursorAnchorInfoBuilder builder) { + private CursorAnchorInfo(final Builder builder) { mSelectionStart = builder.mSelectionStart; mSelectionEnd = builder.mSelectionEnd; mComposingTextStart = builder.mComposingTextStart; diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 27d6b82..4467128 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -96,7 +96,6 @@ import android.view.ViewTreeObserver; import android.view.WindowManager; import android.view.inputmethod.CorrectionInfo; import android.view.inputmethod.CursorAnchorInfo; -import android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.ExtractedText; import android.view.inputmethod.ExtractedTextRequest; @@ -3013,7 +3012,7 @@ public class Editor { * {@link InputMethodManager#isWatchingCursor(View)} returns false. */ private final class CursorAnchorInfoNotifier implements TextViewPositionListener { - final CursorAnchorInfoBuilder mSelectionInfoBuilder = new CursorAnchorInfoBuilder(); + final CursorAnchorInfo.Builder mSelectionInfoBuilder = new CursorAnchorInfo.Builder(); final int[] mTmpIntOffset = new int[2]; final Matrix mViewToScreenMatrix = new Matrix(); @@ -3037,7 +3036,7 @@ public class Editor { return; } - final CursorAnchorInfoBuilder builder = mSelectionInfoBuilder; + final CursorAnchorInfo.Builder builder = mSelectionInfoBuilder; builder.reset(); final int selectionStart = mTextView.getSelectionStart(); diff --git a/core/tests/inputmethodtests/src/android/os/CursorAnchorInfoTest.java b/core/tests/inputmethodtests/src/android/os/CursorAnchorInfoTest.java index 7d72f3e..d850c7c 100644 --- a/core/tests/inputmethodtests/src/android/os/CursorAnchorInfoTest.java +++ b/core/tests/inputmethodtests/src/android/os/CursorAnchorInfoTest.java @@ -21,7 +21,7 @@ import android.graphics.RectF; import android.test.InstrumentationTestCase; import android.test.suitebuilder.annotation.SmallTest; import android.view.inputmethod.CursorAnchorInfo; -import android.view.inputmethod.CursorAnchorInfo.CursorAnchorInfoBuilder; +import android.view.inputmethod.CursorAnchorInfo.Builder; public class CursorAnchorInfoTest extends InstrumentationTestCase { // null represents a character that is invisible, for example because it's overlapped by some @@ -64,7 +64,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { Matrix TRANSFORM_MATRIX = new Matrix(Matrix.IDENTITY_MATRIX); TRANSFORM_MATRIX.setScale(10.0f, 20.0f); - final CursorAnchorInfoBuilder builder = new CursorAnchorInfoBuilder(); + final Builder builder = new Builder(); builder.setSelectionRange(SELECTION_START, SELECTION_END) .setComposingText(COMPOSING_TEXT_START, COMPOSING_TEXT) .setInsertionMarkerLocation(INSERTION_MARKER_HORIZONTAL, INSERTION_MARKER_TOP, @@ -148,7 +148,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { final Matrix MATRIX3 = new Matrix(); MATRIX3.setTranslate(210.0f, 220.0f); final Matrix matrix = new Matrix(); - final CursorAnchorInfoBuilder builder = new CursorAnchorInfoBuilder(); + final Builder builder = new Builder(); matrix.set(MATRIX1); builder.setMatrix(matrix); @@ -171,7 +171,7 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { public void testBuilderAdd() throws Exception { // A negative index should be rejected. try { - new CursorAnchorInfoBuilder().addCharacterRect(-1, 0.0f, 0.0f, 0.0f, 0.0f); + new Builder().addCharacterRect(-1, 0.0f, 0.0f, 0.0f, 0.0f); } catch (IllegalArgumentException ex) { assertTrue(true); } @@ -191,4 +191,3 @@ public class CursorAnchorInfoTest extends InstrumentationTestCase { } } } - |
