diff options
| author | Seigo Nonaka <nona@google.com> | 2018-09-18 13:26:24 -0700 |
|---|---|---|
| committer | Seigo Nonaka <nona@google.com> | 2018-09-18 14:10:14 -0700 |
| commit | 32b87e01e0b47873e0b29939deb4e42f45b718dd (patch) | |
| tree | 16e57daeea8a268400cde14ba40a627f1ed2abaa /core/java/android/text/TextPaint.java | |
| parent | 665f5b9b09b326fea468bdf9890f01fc09a7ab4e (diff) | |
Move hasEqualAttribute from Paint with adding some accessors
Paint#hasEqualAttributes is not a equal method in Paint.
TextLine depends on this method but making this public will make
developer confused. So, moving hasEqualAttributes to TextLine and
provide some accessors for shadow layer parameters.
For the TextPaint, unhide underlineColor and underlineThckness for
implementing equalAttributes in TextLine.
Bug: 112327179
Test: atest android.graphics.cts.PaintTest
Change-Id: I4565e18134856e31d26bd06bcddeb31ddbe7e093
Diffstat (limited to 'core/java/android/text/TextPaint.java')
| -rw-r--r-- | core/java/android/text/TextPaint.java | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/core/java/android/text/TextPaint.java b/core/java/android/text/TextPaint.java index 7bcc6859b8fc..d5aad33a85e7 100644 --- a/core/java/android/text/TextPaint.java +++ b/core/java/android/text/TextPaint.java @@ -17,7 +17,7 @@ package android.text; import android.annotation.ColorInt; -import android.annotation.NonNull; +import android.annotation.Px; import android.annotation.UnsupportedAppUsage; import android.graphics.Paint; @@ -37,17 +37,14 @@ public class TextPaint extends Paint { public float density = 1.0f; /** * Special value 0 means no custom underline - * @hide */ @ColorInt - @UnsupportedAppUsage public int underlineColor = 0; + /** * Thickness of the underline, in pixels. - * @hide */ - @UnsupportedAppUsage - public float underlineThickness; + public @Px float underlineThickness; public TextPaint() { super(); @@ -78,24 +75,6 @@ public class TextPaint extends Paint { } /** - * Returns true if all attributes, including the attributes inherited from Paint, are equal. - * - * The caller is expected to have checked the trivial cases, like the pointers being equal, - * the objects having different classes, or the parameter being null. - * @hide - */ - public boolean hasEqualAttributes(@NonNull TextPaint other) { - return bgColor == other.bgColor - && baselineShift == other.baselineShift - && linkColor == other.linkColor - && drawableState == other.drawableState - && density == other.density - && underlineColor == other.underlineColor - && underlineThickness == other.underlineThickness - && super.hasEqualAttributes((Paint) other); - } - - /** * Defines a custom underline for this Paint. * @param color underline solid color * @param thickness underline thickness |
