am 1dcd2bfc: Merge "API fix in TextView" into jb-dev

* commit '1dcd2bfcabf565aa860fabc69ef54c8d66128a45':
  API fix in TextView
This commit is contained in:
Gilles Debunne
2012-05-01 12:01:03 -07:00
committed by Android Git Automerger
2 changed files with 340 additions and 9 deletions

View File

@@ -28425,11 +28425,13 @@ package android.widget {
method public android.text.InputFilter[] getFilters(); method public android.text.InputFilter[] getFilters();
method public boolean getFreezesText(); method public boolean getFreezesText();
method public int getGravity(); method public int getGravity();
method public int getHighlightColor();
method public java.lang.CharSequence getHint(); method public java.lang.CharSequence getHint();
method public final android.content.res.ColorStateList getHintTextColors(); method public final android.content.res.ColorStateList getHintTextColors();
method public int getImeActionId(); method public int getImeActionId();
method public java.lang.CharSequence getImeActionLabel(); method public java.lang.CharSequence getImeActionLabel();
method public int getImeOptions(); method public int getImeOptions();
method public boolean getIncludeFontPadding();
method public android.os.Bundle getInputExtras(boolean); method public android.os.Bundle getInputExtras(boolean);
method public int getInputType(); method public int getInputType();
method public final android.text.method.KeyListener getKeyListener(); method public final android.text.method.KeyListener getKeyListener();
@@ -28437,8 +28439,19 @@ package android.widget {
method public int getLineBounds(int, android.graphics.Rect); method public int getLineBounds(int, android.graphics.Rect);
method public int getLineCount(); method public int getLineCount();
method public int getLineHeight(); method public int getLineHeight();
method public float getLineSpacingExtra();
method public float getLineSpacingMultiplier();
method public final android.content.res.ColorStateList getLinkTextColors(); method public final android.content.res.ColorStateList getLinkTextColors();
method public final boolean getLinksClickable(); method public final boolean getLinksClickable();
method public int getMarqueeRepeatLimit();
method public int getMaxEms();
method public int getMaxHeight();
method public int getMaxLines();
method public int getMaxWidth();
method public int getMinEms();
method public int getMinHeight();
method public int getMinLines();
method public int getMinWidth();
method public final android.text.method.MovementMethod getMovementMethod(); method public final android.text.method.MovementMethod getMovementMethod();
method public int getOffsetForPosition(float, float); method public int getOffsetForPosition(float, float);
method public android.text.TextPaint getPaint(); method public android.text.TextPaint getPaint();
@@ -28446,6 +28459,10 @@ package android.widget {
method public java.lang.String getPrivateImeOptions(); method public java.lang.String getPrivateImeOptions();
method public int getSelectionEnd(); method public int getSelectionEnd();
method public int getSelectionStart(); method public int getSelectionStart();
method public int getShadowColor();
method public float getShadowDx();
method public float getShadowDy();
method public float getShadowRadius();
method public java.lang.CharSequence getText(); method public java.lang.CharSequence getText();
method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int); method public static int getTextColor(android.content.Context, android.content.res.TypedArray, int);
method public final android.content.res.ColorStateList getTextColors(); method public final android.content.res.ColorStateList getTextColors();
@@ -28462,6 +28479,7 @@ package android.widget {
method public android.graphics.Typeface getTypeface(); method public android.graphics.Typeface getTypeface();
method public android.text.style.URLSpan[] getUrls(); method public android.text.style.URLSpan[] getUrls();
method public boolean hasSelection(); method public boolean hasSelection();
method public boolean isCursorVisible();
method public boolean isInputMethodTarget(); method public boolean isInputMethodTarget();
method public boolean isSuggestionsEnabled(); method public boolean isSuggestionsEnabled();
method public boolean isTextSelectable(); method public boolean isTextSelectable();

View File

@@ -1250,6 +1250,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* *
* Note: The content of the return value should not be modified. If you want * Note: The content of the return value should not be modified. If you want
* a modifiable one, you should make your own copy first. * a modifiable one, you should make your own copy first.
*
* @attr ref android.R.styleable#TextView_text
*/ */
@ViewDebug.CapturedViewProperty @ViewDebug.CapturedViewProperty
public CharSequence getText() { public CharSequence getText() {
@@ -1294,6 +1296,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* @return the current key listener for this TextView. * @return the current key listener for this TextView.
* This will frequently be null for non-EditText TextViews. * This will frequently be null for non-EditText TextViews.
*
* @attr ref android.R.styleable#TextView_numeric
* @attr ref android.R.styleable#TextView_digits
* @attr ref android.R.styleable#TextView_phoneNumber
* @attr ref android.R.styleable#TextView_inputMethod
* @attr ref android.R.styleable#TextView_capitalize
* @attr ref android.R.styleable#TextView_autoText
*/ */
public final KeyListener getKeyListener() { public final KeyListener getKeyListener() {
return mEditor == null ? null : mEditor.mKeyListener; return mEditor == null ? null : mEditor.mKeyListener;
@@ -1408,6 +1417,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* @return the current transformation method for this TextView. * @return the current transformation method for this TextView.
* This will frequently be null except for single-line and password * This will frequently be null except for single-line and password
* fields. * fields.
*
* @attr ref android.R.styleable#TextView_password
* @attr ref android.R.styleable#TextView_singleLine
*/ */
public final TransformationMethod getTransformationMethod() { public final TransformationMethod getTransformationMethod() {
return mTransformation; return mTransformation;
@@ -1988,6 +2000,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Returns drawables for the left, top, right, and bottom borders. * Returns drawables for the left, top, right, and bottom borders.
*
* @attr ref android.R.styleable#TextView_drawableLeft
* @attr ref android.R.styleable#TextView_drawableTop
* @attr ref android.R.styleable#TextView_drawableRight
* @attr ref android.R.styleable#TextView_drawableBottom
*/ */
public Drawable[] getCompoundDrawables() { public Drawable[] getCompoundDrawables() {
final Drawables dr = mDrawables; final Drawables dr = mDrawables;
@@ -2002,6 +2019,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Returns drawables for the start, top, end, and bottom borders. * Returns drawables for the start, top, end, and bottom borders.
*
* @attr ref android.R.styleable#TextView_drawableStart
* @attr ref android.R.styleable#TextView_drawableTop
* @attr ref android.R.styleable#TextView_drawableEnd
* @attr ref android.R.styleable#TextView_drawableBottom
*/ */
public Drawable[] getCompoundDrawablesRelative() { public Drawable[] getCompoundDrawablesRelative() {
final Drawables dr = mDrawables; final Drawables dr = mDrawables;
@@ -2040,6 +2062,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Returns the padding between the compound drawables and the text. * Returns the padding between the compound drawables and the text.
*
* @attr ref android.R.styleable#TextView_drawablePadding
*/ */
public int getCompoundDrawablePadding() { public int getCompoundDrawablePadding() {
final Drawables dr = mDrawables; final Drawables dr = mDrawables;
@@ -2235,6 +2259,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* {@link #setTypeface(Typeface, int)} to get the appearance * {@link #setTypeface(Typeface, int)} to get the appearance
* that you actually want. * that you actually want.
* *
* @see #getTypeface()
*
* @attr ref android.R.styleable#TextView_typeface * @attr ref android.R.styleable#TextView_typeface
* @attr ref android.R.styleable#TextView_textStyle * @attr ref android.R.styleable#TextView_textStyle
*/ */
@@ -2253,6 +2279,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* @return the current typeface and style in which the text is being * @return the current typeface and style in which the text is being
* displayed. * displayed.
*
* @see #setTypeface(Typeface)
*
* @attr ref android.R.styleable#TextView_typeface
* @attr ref android.R.styleable#TextView_textStyle
*/ */
public Typeface getTypeface() { public Typeface getTypeface() {
return mTextPaint.getTypeface(); return mTextPaint.getTypeface();
@@ -2262,6 +2293,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* Sets the text color for all the states (normal, selected, * Sets the text color for all the states (normal, selected,
* focused) to be this color. * focused) to be this color.
* *
* @see #setTextColor(ColorStateList)
* @see #getTextColors()
*
* @attr ref android.R.styleable#TextView_textColor * @attr ref android.R.styleable#TextView_textColor
*/ */
@android.view.RemotableViewMethod @android.view.RemotableViewMethod
@@ -2273,6 +2307,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Sets the text color. * Sets the text color.
* *
* @see #setTextColor(int)
* @see #getTextColors()
* @see #setHintTextColor(ColorStateList)
* @see #setLinkTextColor(ColorStateList)
*
* @attr ref android.R.styleable#TextView_textColor * @attr ref android.R.styleable#TextView_textColor
*/ */
public void setTextColor(ColorStateList colors) { public void setTextColor(ColorStateList colors) {
@@ -2285,9 +2324,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Return the set of text colors. * Gets the text colors for the different states (normal, selected, focused) of the TextView.
* *
* @return Returns the set of text colors. * @see #setTextColor(ColorStateList)
* @see #setTextColor(int)
*
* @attr ref android.R.styleable#TextView_textColor
*/ */
public final ColorStateList getTextColors() { public final ColorStateList getTextColors() {
return mTextColor; return mTextColor;
@@ -2315,6 +2357,17 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
} }
/**
* @return the color used to display the selection highlight
*
* @see #setHighlightColor(int)
*
* @attr ref android.R.styleable#TextView_textColorHighlight
*/
public int getHighlightColor() {
return mHighlightColor;
}
/** /**
* Sets whether the soft input method will be made visible when this * Sets whether the soft input method will be made visible when this
* TextView gets focused. The default is true. * TextView gets focused. The default is true.
@@ -2357,6 +2410,52 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* Gets the radius of the shadow layer.
*
* @return the radius of the shadow layer. If 0, the shadow layer is not visible
*
* @see #setShadowLayer(float, float, float, int)
*
* @attr ref android.R.styleable#TextView_shadowRadius
*/
public float getShadowRadius() {
return mShadowRadius;
}
/**
* @return the horizontal offset of the shadow layer
*
* @see #setShadowLayer(float, float, float, int)
*
* @attr ref android.R.styleable#TextView_shadowDx
*/
public float getShadowDx() {
return mShadowDx;
}
/**
* @return the vertical offset of the shadow layer
*
* @see #setShadowLayer(float, float, float, int)
*
* @attr ref android.R.styleable#TextView_shadowDy
*/
public float getShadowDy() {
return mShadowDy;
}
/**
* @return the color of the shadow layer
*
* @see #setShadowLayer(float, float, float, int)
*
* @attr ref android.R.styleable#TextView_shadowColor
*/
public int getShadowColor() {
return mTextPaint.shadowColor;
}
/** /**
* @return the base paint used for the text. Please use this only to * @return the base paint used for the text. Please use this only to
* consult the Paint's properties and not to change them. * consult the Paint's properties and not to change them.
@@ -2418,7 +2517,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Sets the color of the hint text. * Sets the color of the hint text for all the states (disabled, focussed, selected...) of this
* TextView.
*
* @see #setHintTextColor(ColorStateList)
* @see #getHintTextColors()
* @see #setTextColor(int)
* *
* @attr ref android.R.styleable#TextView_textColorHint * @attr ref android.R.styleable#TextView_textColorHint
*/ */
@@ -2431,6 +2535,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Sets the color of the hint text. * Sets the color of the hint text.
* *
* @see #getHintTextColors()
* @see #setHintTextColor(int)
* @see #setTextColor(ColorStateList)
* @see #setLinkTextColor(ColorStateList)
*
* @attr ref android.R.styleable#TextView_textColorHint * @attr ref android.R.styleable#TextView_textColorHint
*/ */
public final void setHintTextColor(ColorStateList colors) { public final void setHintTextColor(ColorStateList colors) {
@@ -2439,9 +2548,14 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* <p>Return the color used to paint the hint text.</p> * @return the color of the hint text, for the different states of this TextView.
* *
* @return Returns the list of hint text colors. * @see #setHintTextColor(ColorStateList)
* @see #setHintTextColor(int)
* @see #setTextColor(ColorStateList)
* @see #setLinkTextColor(ColorStateList)
*
* @attr ref android.R.styleable#TextView_textColorHint
*/ */
public final ColorStateList getHintTextColors() { public final ColorStateList getHintTextColors() {
return mHintTextColor; return mHintTextColor;
@@ -2459,6 +2573,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Sets the color of links in the text. * Sets the color of links in the text.
* *
* @see #setLinkTextColor(ColorStateList)
* @see #getLinkTextColors()
*
* @attr ref android.R.styleable#TextView_textColorLink * @attr ref android.R.styleable#TextView_textColorLink
*/ */
@android.view.RemotableViewMethod @android.view.RemotableViewMethod
@@ -2470,6 +2587,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Sets the color of links in the text. * Sets the color of links in the text.
* *
* @see #setLinkTextColor(int)
* @see #getLinkTextColors()
* @see #setTextColor(ColorStateList)
* @see #setHintTextColor(ColorStateList)
*
* @attr ref android.R.styleable#TextView_textColorLink * @attr ref android.R.styleable#TextView_textColorLink
*/ */
public final void setLinkTextColor(ColorStateList colors) { public final void setLinkTextColor(ColorStateList colors) {
@@ -2478,9 +2600,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* <p>Returns the color used to paint links in the text.</p> * @return the list of colors used to paint the links in the text, for the different states of
* this TextView
* *
* @return Returns the list of link text colors. * @see #setLinkTextColor(ColorStateList)
* @see #setLinkTextColor(int)
*
* @attr ref android.R.styleable#TextView_textColorLink
*/ */
public final ColorStateList getLinkTextColors() { public final ColorStateList getLinkTextColors() {
return mLinkTextColor; return mLinkTextColor;
@@ -2598,6 +2724,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* Setting this value overrides any other (minimum) height setting. A single line TextView will * Setting this value overrides any other (minimum) height setting. A single line TextView will
* set this value to 1. * set this value to 1.
* *
* @see #getMinLines()
*
* @attr ref android.R.styleable#TextView_minLines * @attr ref android.R.styleable#TextView_minLines
*/ */
@android.view.RemotableViewMethod @android.view.RemotableViewMethod
@@ -2609,6 +2737,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the minimum number of lines displayed in this TextView, or -1 if the minimum
* height was set in pixels instead using {@link #setMinHeight(int) or #setHeight(int)}.
*
* @see #setMinLines(int)
*
* @attr ref android.R.styleable#TextView_minLines
*/
public int getMinLines() {
return mMinMode == LINES ? mMinimum : -1;
}
/** /**
* Makes the TextView at least this many pixels tall. * Makes the TextView at least this many pixels tall.
* *
@@ -2625,6 +2765,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the minimum height of this TextView expressed in pixels, or -1 if the minimum
* height was set in number of lines instead using {@link #setMinLines(int) or #setLines(int)}.
*
* @see #setMinHeight(int)
*
* @attr ref android.R.styleable#TextView_minHeight
*/
public int getMinHeight() {
return mMinMode == PIXELS ? mMinimum : -1;
}
/** /**
* Makes the TextView at most this many lines tall. * Makes the TextView at most this many lines tall.
* *
@@ -2641,6 +2793,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the maximum number of lines displayed in this TextView, or -1 if the maximum
* height was set in pixels instead using {@link #setMaxHeight(int) or #setHeight(int)}.
*
* @see #setMaxLines(int)
*
* @attr ref android.R.styleable#TextView_maxLines
*/
public int getMaxLines() {
return mMaxMode == LINES ? mMaximum : -1;
}
/** /**
* Makes the TextView at most this many pixels tall. This option is mutually exclusive with the * Makes the TextView at most this many pixels tall. This option is mutually exclusive with the
* {@link #setMaxLines(int)} method. * {@link #setMaxLines(int)} method.
@@ -2658,6 +2822,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the maximum height of this TextView expressed in pixels, or -1 if the maximum
* height was set in number of lines instead using {@link #setMaxLines(int) or #setLines(int)}.
*
* @see #setMaxHeight(int)
*
* @attr ref android.R.styleable#TextView_maxHeight
*/
public int getMaxHeight() {
return mMaxMode == PIXELS ? mMaximum : -1;
}
/** /**
* Makes the TextView exactly this many lines tall. * Makes the TextView exactly this many lines tall.
* *
@@ -2708,6 +2884,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the minimum width of the TextView, expressed in ems or -1 if the minimum width
* was set in pixels instead (using {@link #setMinWidth(int)} or {@link #setWidth(int)}).
*
* @see #setMinEms(int)
* @see #setEms(int)
*
* @attr ref android.R.styleable#TextView_minEms
*/
public int getMinEms() {
return mMinWidthMode == EMS ? mMinWidth : -1;
}
/** /**
* Makes the TextView at least this many pixels wide * Makes the TextView at least this many pixels wide
* *
@@ -2722,6 +2911,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the minimum width of the TextView, in pixels or -1 if the minimum width
* was set in ems instead (using {@link #setMinEms(int)} or {@link #setEms(int)}).
*
* @see #setMinWidth(int)
* @see #setWidth(int)
*
* @attr ref android.R.styleable#TextView_minWidth
*/
public int getMinWidth() {
return mMinWidthMode == PIXELS ? mMinWidth : -1;
}
/** /**
* Makes the TextView at most this many ems wide * Makes the TextView at most this many ems wide
* *
@@ -2736,6 +2938,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the maximum width of the TextView, expressed in ems or -1 if the maximum width
* was set in pixels instead (using {@link #setMaxWidth(int)} or {@link #setWidth(int)}).
*
* @see #setMaxEms(int)
* @see #setEms(int)
*
* @attr ref android.R.styleable#TextView_maxEms
*/
public int getMaxEms() {
return mMaxWidthMode == EMS ? mMaxWidth : -1;
}
/** /**
* Makes the TextView at most this many pixels wide * Makes the TextView at most this many pixels wide
* *
@@ -2750,9 +2965,27 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/**
* @return the maximum width of the TextView, in pixels or -1 if the maximum width
* was set in ems instead (using {@link #setMaxEms(int)} or {@link #setEms(int)}).
*
* @see #setMaxWidth(int)
* @see #setWidth(int)
*
* @attr ref android.R.styleable#TextView_maxWidth
*/
public int getMaxWidth() {
return mMaxWidthMode == PIXELS ? mMaxWidth : -1;
}
/** /**
* Makes the TextView exactly this many ems wide * Makes the TextView exactly this many ems wide
* *
* @see #setMaxEms(int)
* @see #setMinEms(int)
* @see #getMinEms()
* @see #getMaxEms()
*
* @attr ref android.R.styleable#TextView_ems * @attr ref android.R.styleable#TextView_ems
*/ */
@android.view.RemotableViewMethod @android.view.RemotableViewMethod
@@ -2769,6 +3002,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* You could do the same thing by specifying this number in the * You could do the same thing by specifying this number in the
* LayoutParams. * LayoutParams.
* *
* @see #setMaxWidth(int)
* @see #setMinWidth(int)
* @see #getMinWidth()
* @see #getMaxWidth()
*
* @attr ref android.R.styleable#TextView_width * @attr ref android.R.styleable#TextView_width
*/ */
@android.view.RemotableViewMethod @android.view.RemotableViewMethod
@@ -2780,7 +3018,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
invalidate(); invalidate();
} }
/** /**
* Sets line spacing for this TextView. Each line will have its height * Sets line spacing for this TextView. Each line will have its height
* multiplied by <code>mult</code> and have <code>add</code> added to it. * multiplied by <code>mult</code> and have <code>add</code> added to it.
@@ -2801,6 +3038,34 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
} }
/**
* Gets the line spacing multiplier
*
* @return the value by which each line's height is multiplied to get its actual height.
*
* @see #setLineSpacing(float, float)
* @see #getLineSpacingExtra()
*
* @attr ref android.R.styleable#TextView_lineSpacingMultiplier
*/
public float getLineSpacingMultiplier() {
return mSpacingMult;
}
/**
* Gets the line spacing extra space
*
* @return the extra space that is added to the height of each lines of this TextView.
*
* @see #setLineSpacing(float, float)
* @see #getLineSpacingMultiplier()
*
* @attr ref android.R.styleable#TextView_lineSpacingExtra
*/
public float getLineSpacingExtra() {
return mSpacingAdd;
}
/** /**
* Convenience method: Append the specified text to the TextView's * Convenience method: Append the specified text to the TextView's
* display buffer, upgrading it to BufferType.EDITABLE if it was * display buffer, upgrading it to BufferType.EDITABLE if it was
@@ -3883,6 +4148,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
/** /**
* Returns the current list of input filters. * Returns the current list of input filters.
*
* @attr ref android.R.styleable#TextView_maxLength
*/ */
public InputFilter[] getFilters() { public InputFilter[] getFilters() {
return mFilters; return mFilters;
@@ -5639,6 +5906,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* room for accents that go above the normal ascent and descent. * room for accents that go above the normal ascent and descent.
* The default is true. * The default is true.
* *
* @see #getIncludeFontPadding()
*
* @attr ref android.R.styleable#TextView_includeFontPadding * @attr ref android.R.styleable#TextView_includeFontPadding
*/ */
public void setIncludeFontPadding(boolean includepad) { public void setIncludeFontPadding(boolean includepad) {
@@ -5653,6 +5922,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
} }
/**
* Gets whether the TextView includes extra top and bottom padding to make
* room for accents that go above the normal ascent and descent.
*
* @see #setIncludeFontPadding(boolean)
*
* @attr ref android.R.styleable#TextView_includeFontPadding
*/
public boolean getIncludeFontPadding() {
return mIncludePad;
}
private static final BoringLayout.Metrics UNKNOWN_BORING = new BoringLayout.Metrics(); private static final BoringLayout.Metrics UNKNOWN_BORING = new BoringLayout.Metrics();
@Override @Override
@@ -6504,12 +6785,29 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* Sets how many times to repeat the marquee animation. Only applied if the * Sets how many times to repeat the marquee animation. Only applied if the
* TextView has marquee enabled. Set to -1 to repeat indefinitely. * TextView has marquee enabled. Set to -1 to repeat indefinitely.
* *
* @see #getMarqueeRepeatLimit()
*
* @attr ref android.R.styleable#TextView_marqueeRepeatLimit * @attr ref android.R.styleable#TextView_marqueeRepeatLimit
*/ */
public void setMarqueeRepeatLimit(int marqueeLimit) { public void setMarqueeRepeatLimit(int marqueeLimit) {
mMarqueeRepeatLimit = marqueeLimit; mMarqueeRepeatLimit = marqueeLimit;
} }
/**
* Gets the number of times the marquee animation is repeated. Only meaningful if the
* TextView has marquee enabled.
*
* @return the number of times the marquee animation is repeated. -1 if the animation
* repeats indefinitely
*
* @see #setMarqueeRepeatLimit(int)
*
* @attr ref android.R.styleable#TextView_marqueeRepeatLimit
*/
public int getMarqueeRepeatLimit() {
return mMarqueeRepeatLimit;
}
/** /**
* Returns where, if anywhere, words that are longer than the view * Returns where, if anywhere, words that are longer than the view
* is wide should be ellipsized. * is wide should be ellipsized.
@@ -6536,7 +6834,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
/** /**
* Set whether the cursor is visible. The default is true. * Set whether the cursor is visible. The default is true. Note that this property only
* makes sense for editable TextView.
*
* @see #isCursorVisible()
* *
* @attr ref android.R.styleable#TextView_cursorVisible * @attr ref android.R.styleable#TextView_cursorVisible
*/ */
@@ -6555,6 +6856,18 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
} }
} }
/**
* @return whether or not the cursor is visible (assuming this TextView is editable)
*
* @see #setCursorVisible(boolean)
*
* @attr ref android.R.styleable#TextView_cursorVisible
*/
public boolean isCursorVisible() {
// true is the default value
return mEditor == null ? true : mEditor.mCursorVisible;
}
private boolean canMarquee() { private boolean canMarquee() {
int width = (mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight()); int width = (mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight());
return width > 0 && (mLayout.getLineWidth(0) > width || return width > 0 && (mLayout.getLineWidth(0) > width ||