diff options
author | Winson Chung <winsonc@google.com> | 2018-01-29 11:16:32 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2018-02-09 12:40:10 -0800 |
commit | 3e803c7a4bec4d14006057d918fe8663c7d36769 (patch) | |
tree | 722cfb15c4bf00dfd45f492d662f8b848ff3df5d /src/com/android/launcher3/Utilities.java | |
parent | 7780fa7bc711afbf89fbdc6fe94b473f2e3db3f2 (diff) | |
download | android_packages_apps_Trebuchet-3e803c7a4bec4d14006057d918fe8663c7d36769.tar.gz android_packages_apps_Trebuchet-3e803c7a4bec4d14006057d918fe8663c7d36769.tar.bz2 android_packages_apps_Trebuchet-3e803c7a4bec4d14006057d918fe8663c7d36769.zip |
Animate the visible task view if launching an app that resolves to the task
Test: Manual, launch app for associated visible task
Change-Id: I7a56553197ad23e1269eb50523eca0ea88898f47
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 19 |
1 files changed, 17 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(); |