am c56a9d10: am be36ebc2: Merge "Add convenience method for getting the complex unit type" into lmp-mr1-dev automerge: 38d6cf9

* commit 'c56a9d10f7b5ffa9a6023f3dff043cbea8b3cb96':
  Add convenience method for getting the complex unit type
This commit is contained in:
Christopher Lane
2014-10-31 22:13:29 +00:00
committed by Android Git Automerger
2 changed files with 13 additions and 0 deletions

View File

@@ -32397,6 +32397,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);

View File

@@ -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>