summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorChristopher Lane <lanechr@google.com>2014-10-31 22:13:29 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-31 22:13:29 +0000
commit1bb81dd46e05987fb47b0052c22b9fbf369e512c (patch)
tree0b490c2546c715a088d1f0b35ffd89e0d8fbc4f2 /core/java/android
parent486384ef46ead8e05fbf4cdb1c1b48e3a559d281 (diff)
parentc56a9d10f7b5ffa9a6023f3dff043cbea8b3cb96 (diff)
downloadframeworks_base-1bb81dd46e05987fb47b0052c22b9fbf369e512c.zip
frameworks_base-1bb81dd46e05987fb47b0052c22b9fbf369e512c.tar.gz
frameworks_base-1bb81dd46e05987fb47b0052c22b9fbf369e512c.tar.bz2
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
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/util/TypedValue.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/util/TypedValue.java b/core/java/android/util/TypedValue.java
index d42ed03..74d4245 100644
--- a/core/java/android/util/TypedValue.java
+++ b/core/java/android/util/TypedValue.java
@@ -312,6 +312,18 @@ public class TypedValue {
}
/**
+ * 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>
* are as in {@link #TYPE_DIMENSION}.