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

Commit 9f357ae9 authored by Christopher Lane's avatar Christopher Lane
Browse files

Add convenience method for getting the complex unit type

Bug: 18193912
Change-Id: Ida29c12c6c3f07ac0657e70d2ab07f2fc4f2cb20
parent b9144cea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -32155,6 +32155,7 @@ package android.util {
    method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics);
    method public static float complexToFloat(int);
    method public static float complexToFraction(int, float, float);
    method public int getComplexUnit();
    method public float getDimension(android.util.DisplayMetrics);
    method public final float getFloat();
    method public float getFraction(float, float);
+12 −0
Original line number Diff line number Diff line
@@ -311,6 +311,18 @@ public class TypedValue {
        return complexToDimension(data, metrics);
    }

    /**
     * Return the complex unit type for this value. For example, a dimen type
     * with value 12sp will return {@link #COMPLEX_UNIT_SP}. Only use for values
     * whose type is {@link #TYPE_DIMENSION}.
     *
     * @return The complex unit type.
     */
     public int getComplexUnit()
     {
         return COMPLEX_UNIT_MASK & (data>>TypedValue.COMPLEX_UNIT_SHIFT);
     }

    /**
     * Converts an unpacked complex data value holding a dimension to its final floating 
     * point value. The two parameters <var>unit</var> and <var>value</var>