diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 19 | ||||
-rw-r--r-- | src/com/android/launcher3/anim/Interpolators.java | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 158c540ac..d559b44be 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -237,16 +237,27 @@ public final class Utilities { int cx = r.centerX(); int cy = r.centerY(); r.offset(-cx, -cy); + scaleRect(r, scale); + r.offset(cx, cy); + } + } + public static void scaleRect(Rect r, float scale) { + if (scale != 1.0f) { r.left = (int) (r.left * scale + 0.5f); r.top = (int) (r.top * scale + 0.5f); r.right = (int) (r.right * scale + 0.5f); r.bottom = (int) (r.bottom * scale + 0.5f); - - r.offset(cx, cy); } } + public static void insetRect(Rect r, Rect insets) { + r.left = Math.min(r.right, r.left + insets.left); + r.top = Math.min(r.bottom, r.top + insets.top); + r.right = Math.max(r.left, r.right - insets.right); + r.bottom = Math.max(r.top, r.bottom - insets.bottom); + } + public static float shrinkRect(Rect r, float scaleX, float scaleY) { float scale = Math.min(Math.min(scaleX, scaleY), 1.0f); if (scale < 1.0f) { @@ -261,6 +272,10 @@ public final class Utilities { return scale; } + public static float mapRange(float value, float min, float max) { + return min + (value * (max - min)); + } + public static boolean isSystemApp(Context context, Intent intent) { PackageManager pm = context.getPackageManager(); ComponentName cn = intent.getComponent(); diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java index 234365424..0dcebe38e 100644 --- a/src/com/android/launcher3/anim/Interpolators.java +++ b/src/com/android/launcher3/anim/Interpolators.java @@ -50,6 +50,9 @@ public class Interpolators { public static final Interpolator OVERSHOOT_0 = new OvershootInterpolator(0); + public static final Interpolator TOUCH_RESPONSE_INTERPOLATOR = + new PathInterpolator(0.3f, 0f, 0.1f, 1f); + /** * Inversion of zInterpolate, compounded with an ease-out. */ |