diff options
author | Raph Levien <raph@google.com> | 2015-06-17 15:53:33 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2015-06-17 15:53:33 -0700 |
commit | 8edac58e55808042af4365aa5a28dfdd1ebf65fc (patch) | |
tree | 0505337473ab8d189b3f16977136d34fdce21e83 /core | |
parent | c20c1eec9e222870b08c079898dbc334858994cc (diff) | |
download | frameworks_base-8edac58e55808042af4365aa5a28dfdd1ebf65fc.zip frameworks_base-8edac58e55808042af4365aa5a28dfdd1ebf65fc.tar.gz frameworks_base-8edac58e55808042af4365aa5a28dfdd1ebf65fc.tar.bz2 |
Remove indents from TextView
On more careful reflection, the "indents" feature was not ready for
inclusion in the public API. It is still available at a lower level
in StaticLayout.
Also fix a minor typo in the doc for breakStrategy.
Bug: 20641996
Change-Id: I5cd976a536c48615980860396b1564b51b19e14a
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/TextView.java | 65 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 10 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 5 |
3 files changed, 8 insertions, 72 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 78b5d5d..c538dc2 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -241,8 +241,6 @@ import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; * @attr ref android.R.styleable#TextView_fontFeatureSettings * @attr ref android.R.styleable#TextView_breakStrategy * @attr ref android.R.styleable#TextView_hyphenationFrequency - * @attr ref android.R.styleable#TextView_leftIndents - * @attr ref android.R.styleable#TextView_rightIndents */ @RemoteView public class TextView extends View implements ViewTreeObserver.OnPreDrawListener { @@ -559,8 +557,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener private int mBreakStrategy; private int mHyphenationFrequency; - private int[] mLeftIndents; - private int[] mRightIndents; private int mMaximum = Integer.MAX_VALUE; private int mMaxMode = LINES; @@ -1165,16 +1161,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener case com.android.internal.R.styleable.TextView_hyphenationFrequency: mHyphenationFrequency = a.getInt(attr, Layout.HYPHENATION_FREQUENCY_NONE); break; - - case com.android.internal.R.styleable.TextView_leftIndents: - TypedArray margins = res.obtainTypedArray(a.getResourceId(attr, View.NO_ID)); - mLeftIndents = parseDimensionArray(margins); - break; - - case com.android.internal.R.styleable.TextView_rightIndents: - margins = res.obtainTypedArray(a.getResourceId(attr, View.NO_ID)); - mRightIndents = parseDimensionArray(margins); - break; } } a.recycle(); @@ -3095,51 +3081,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } /** - * Set indents. Arguments are arrays holding an indent amount, one per line, measured in - * pixels. For lines past the last element in the array, the last element repeats. - * - * @param leftIndents array of indent values for left margin, in pixels - * @param rightIndents array of indent values for right margin, in pixels - * - * @see #getLeftIndents() - * @see #getRightIndents() - * - * @attr ref android.R.styleable#TextView_leftIndents - * @attr ref android.R.styleable#TextView_rightIndents - */ - public void setIndents(@Nullable int[] leftIndents, @Nullable int[] rightIndents) { - mLeftIndents = leftIndents; - mRightIndents = rightIndents; - if (mLayout != null) { - nullLayouts(); - requestLayout(); - invalidate(); - } - } - - /** - * Get left indents. See {#link setMargins} for more details. - * - * @return left indents - * @see #setIndents(int[], int[]) - * @attr ref android.R.styleable#TextView_leftIndents - */ - public int[] getLeftIndents() { - return mLeftIndents; - } - - /** - * Get right indents. See {#link setMargins} for more details. - * - * @return right indents - * @see #setIndents(int[], int[]) - * @attr ref android.R.styleable#TextView_rightIndents - */ - public int[] getRightIndents() { - return mRightIndents; - } - - /** * Sets font feature settings. The format is the same as the CSS * font-feature-settings attribute: * http://dev.w3.org/csswg/css-fonts/#propdef-font-feature-settings @@ -6685,9 +6626,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener .setIncludePad(mIncludePad) .setBreakStrategy(mBreakStrategy) .setHyphenationFrequency(mHyphenationFrequency); - if (mLeftIndents != null || mRightIndents != null) { - builder.setIndents(mLeftIndents, mRightIndents); - } if (shouldEllipsize) { builder.setEllipsize(mEllipsize) .setEllipsizedWidth(ellipsisWidth) @@ -6776,9 +6714,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener .setIncludePad(mIncludePad) .setBreakStrategy(mBreakStrategy) .setHyphenationFrequency(mHyphenationFrequency); - if (mLeftIndents != null || mRightIndents != null) { - builder.setIndents(mLeftIndents, mRightIndents); - } if (shouldEllipsize) { builder.setEllipsize(effectiveEllipsize) .setEllipsizedWidth(ellipsisWidth) diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index c08d511..f4950e1 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -4384,7 +4384,7 @@ i <enum name="simple" value="0" /> <!-- Line breaking uses high-quality strategy, including hyphenation. --> <enum name="high_quality" value="1" /> - <!-- Line breaking stratgegy balances line lengths. --> + <!-- Line breaking strategy balances line lengths. --> <enum name="balanced" value="2" /> </attr> <!-- Frequency of automatic hyphenation. --> @@ -4398,10 +4398,10 @@ i screens with limited space for text. --> <enum name="full" value="2" /> </attr> - <!-- Array of indents, one dimension value per line, left side. --> - <attr name="leftIndents" format="reference" /> - <!-- Array of indents, one dimension value per line, right side. --> - <attr name="rightIndents" format="reference" /> + <!-- Placeholder for a deleted attribute. This should be removed before M release. --> + <attr name="__removeBeforeMRelease_leftIndents" format="reference" /> + <!-- Placeholder for a deleted attribute. This should be removed before M release. --> + <attr name="__removeBeforeMRelease_rightIndents" format="reference" /> </declare-styleable> <declare-styleable name="TextViewAppearance"> <!-- Base text color, typeface, size, and style. --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index bbe27a4..0d3bf58 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2683,8 +2683,9 @@ <public type="attr" name="lockTaskMode" /> - <public type="attr" name="leftIndents" /> - <public type="attr" name="rightIndents" /> + <!-- Placeholder for a removed attribute. Remove this before M release. --> + <public type="attr" name="__removeBeforeMRelease_leftIndents" /> + <public type="attr" name="__removeBeforeMRelease_rightIndents" /> <public type="attr" name="showForAllUsers" /> |