diff options
author | Xavier Ducrohet <xav@android.com> | 2010-11-03 18:00:21 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-11-03 19:15:07 -0700 |
commit | 9c05b3972872d83c60bf5afe1a05f08c7753cd9a (patch) | |
tree | fb46e02e4e3a4d04b798f59bb3511ae404b56a63 /tools | |
parent | 4b606da91d2d76dd90a427cb3e37ea7df655e8e0 (diff) | |
download | frameworks_base-9c05b3972872d83c60bf5afe1a05f08c7753cd9a.zip frameworks_base-9c05b3972872d83c60bf5afe1a05f08c7753cd9a.tar.gz frameworks_base-9c05b3972872d83c60bf5afe1a05f08c7753cd9a.tar.bz2 |
Layoutlib native delegate: FloatMath.
While the difference is pretty minor since it's a small class,
the point is that the unit test will ensure that we detect
new methods added to FloatMath more easily.
Change-Id: Ia8bfee231cc4ae0cfeb18692be86d02649c187d5
Diffstat (limited to 'tools')
-rw-r--r-- | tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java (renamed from tools/layoutlib/bridge/src/android/util/FloatMath.java) | 30 | ||||
-rw-r--r-- | tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/tools/layoutlib/bridge/src/android/util/FloatMath.java b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java index aae44f2..ed24e16 100644 --- a/tools/layoutlib/bridge/src/android/util/FloatMath.java +++ b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java @@ -16,20 +16,22 @@ package android.util; +import com.android.layoutlib.bridge.DelegateManager; + /** - * Reimplements _Original_FloatMath with the standard libraries. - * - * Math routines similar to those found in {@link java.lang.Math}. Performs - * computations on {@code float} values directly without incurring the overhead - * of conversions to and from {@code double}. + * Delegate implementing the native methods of android.util.FloatMath + * + * Through the layoutlib_create tool, the original native methods of FloatMath have been replaced + * by calls to methods of the same name in this delegate class. + * + * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager} + * around to map int to instance of the delegate. * - * <p>On one platform, {@code FloatMath.sqrt(100)} executes in one third of the - * time required by {@code java.lang.Math.sqrt(100)}.</p> */ -public class FloatMath { +/*package*/ final class FloatMath_Delegate { /** Prevents instantiation. */ - private FloatMath() {} + private FloatMath_Delegate() {} /** * Returns the float conversion of the most positive (i.e. closest to @@ -38,7 +40,7 @@ public class FloatMath { * @param value to be converted * @return the floor of value */ - public static float floor(float value) { + /*package*/ static float floor(float value) { return (float)Math.floor(value); } @@ -49,7 +51,7 @@ public class FloatMath { * @param value to be converted * @return the ceiling of value */ - public static float ceil(float value) { + /*package*/ static float ceil(float value) { return (float)Math.ceil(value); } @@ -59,7 +61,7 @@ public class FloatMath { * @param angle to compute the cosine of, in radians * @return the sine of angle */ - public static float sin(float angle) { + /*package*/ static float sin(float angle) { return (float)Math.sin(angle); } @@ -69,7 +71,7 @@ public class FloatMath { * @param angle to compute the cosine of, in radians * @return the cosine of angle */ - public static float cos(float angle) { + /*package*/ static float cos(float angle) { return (float)Math.cos(angle); } @@ -80,7 +82,7 @@ public class FloatMath { * @param value to compute sqrt of * @return the square root of value */ - public static float sqrt(float value) { + /*package*/ static float sqrt(float value) { return (float)Math.sqrt(value); } } diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 19bdb2c..8e05c31 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -116,6 +116,7 @@ public final class CreateInfo implements ICreateInfo { "android.graphics.SweepGradient", "android.graphics.Typeface", "android.graphics.Xfermode", + "android.util.FloatMath", }; /** @@ -137,7 +138,6 @@ public final class CreateInfo implements ICreateInfo { "android.graphics.BitmapFactory", "android.graphics._Original_BitmapFactory", "android.graphics.Path", "android.graphics._Original_Path", "android.os.ServiceManager", "android.os._Original_ServiceManager", - "android.util.FloatMath", "android.util._Original_FloatMath", "android.view.SurfaceView", "android.view._Original_SurfaceView", "android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager", }; |