Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa554ae6 authored by Ember Rose's avatar Ember Rose
Browse files

Add isColorType to TypedValue

There's a lot of places that used TypedValue.TYPE_FIRST_COLOR_INT and
TypedValue.TYPE_LAST_COLOR_INT, and I'd like to propose that it's enough
of an implementation detail that it should have a dedicated public
method to query it.

Fixes: 114126626
Test: CTS tests to be added
Change-Id: I4d2a927cc3d2e999985d7e1c9b647d513fff53fc
parent 7ea11f2b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -45984,6 +45984,7 @@ package android.util {
    method public float getDimension(android.util.DisplayMetrics);
    method public final float getFloat();
    method public float getFraction(float, float);
    method public boolean isColorType();
    method public void setTo(android.util.TypedValue);
    field public static final int COMPLEX_MANTISSA_MASK = 16777215; // 0xffffff
    field public static final int COMPLEX_MANTISSA_SHIFT = 8; // 0x8
+10 −0
Original line number Diff line number Diff line
@@ -231,6 +231,16 @@ public class TypedValue {
        1.0f/(1<<15)*MANTISSA_MULT, 1.0f/(1<<23)*MANTISSA_MULT
    };

    /**
     * Determine if a value is a color by comparing {@link type} to {@link #TYPE_FIRST_COLOR_INT}
     * and {@link #TYPE_LAST_COLOR_INT}.
     *
     * @return true if this value is a color
     */
    public boolean isColorType() {
        return (type >= TYPE_FIRST_COLOR_INT && type <= TYPE_LAST_COLOR_INT);
    }

    /**
     * Retrieve the base value from a complex data integer.  This uses the 
     * {@link #COMPLEX_MANTISSA_MASK} and {@link #COMPLEX_RADIX_MASK} fields of