diff options
Diffstat (limited to 'core/java/android/text/TextPaint.java')
| -rw-r--r-- | core/java/android/text/TextPaint.java | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/core/java/android/text/TextPaint.java b/core/java/android/text/TextPaint.java index afd989256b88..044711711931 100644 --- a/core/java/android/text/TextPaint.java +++ b/core/java/android/text/TextPaint.java @@ -24,8 +24,6 @@ import android.graphics.Paint; */ public class TextPaint extends Paint { - private static final int DEFAULT_UNDERLINE_SIZE = 3; - // Special value 0 means no background paint public int bgColor; public int baselineShift; @@ -36,17 +34,12 @@ public class TextPaint extends Paint { * Special value 0 means no custom underline * @hide */ - public int[] underlineColors; + public int underlineColor = 0; /** * Defined as a multiplier of the default underline thickness. Use 1.0f for default thickness. * @hide */ - public float[] underlineThicknesses; - /** - * The number of underlines currently stored in the array. If 0, no underline is drawn. - * @hide - */ - public int underlineCount; + public float underlineThickness; public TextPaint() { super(); @@ -72,16 +65,8 @@ public class TextPaint extends Paint { linkColor = tp.linkColor; drawableState = tp.drawableState; density = tp.density; - - if (tp.underlineColors != null) { - if (underlineColors == null || underlineColors.length < tp.underlineCount) { - underlineColors = new int[tp.underlineCount]; - underlineThicknesses = new float[tp.underlineCount]; - } - System.arraycopy(tp.underlineColors, 0, underlineColors, 0, tp.underlineCount); - System.arraycopy(tp.underlineThicknesses, 0, underlineThicknesses, 0, tp.underlineCount); - } - underlineCount = tp.underlineCount; + underlineColor = tp.underlineColor; + underlineThickness = tp.underlineThickness; } /** @@ -91,31 +76,7 @@ public class TextPaint extends Paint { * @hide */ public void setUnderlineText(int color, float thickness) { - if (color == 0) { - // No underline - return; - } - - if (underlineCount == 0) { - underlineColors = new int[DEFAULT_UNDERLINE_SIZE]; - underlineThicknesses = new float[DEFAULT_UNDERLINE_SIZE]; - underlineColors[underlineCount] = color; - underlineThicknesses[underlineCount] = thickness; - underlineCount++; - } else { - if (underlineCount == underlineColors.length) { - int[] newColors = new int[underlineColors.length + DEFAULT_UNDERLINE_SIZE]; - float[] newThickness = new float[underlineThicknesses.length - + DEFAULT_UNDERLINE_SIZE]; - System.arraycopy(underlineColors, 0, newColors, 0, underlineColors.length); - System.arraycopy( - underlineThicknesses, 0, newThickness, 0, underlineThicknesses.length); - underlineColors = newColors; - underlineThicknesses = newThickness; - } - underlineColors[underlineCount] = color; - underlineThicknesses[underlineCount] = thickness; - underlineCount++; - } + underlineColor = color; + underlineThickness = thickness; } } |
