summaryrefslogtreecommitdiffstats
path: root/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2018-01-18 09:44:54 -0800
committerJon Miranda <jonmiranda@google.com>2018-01-18 09:44:54 -0800
commit69057173a732add164f83ddc926009c0cdca5e7c (patch)
tree512dc37bfb7d53e9fe26cafceb129d82659e827f /src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
parentfddaaca841114f476c3322f88835a30c4504345b (diff)
downloadandroid_packages_apps_Trebuchet-69057173a732add164f83ddc926009c0cdca5e7c.tar.gz
android_packages_apps_Trebuchet-69057173a732add164f83ddc926009c0cdca5e7c.tar.bz2
android_packages_apps_Trebuchet-69057173a732add164f83ddc926009c0cdca5e7c.zip
Synchronized opening app transition animations.
Bug: 70220260 Change-Id: I3c8e1c477266fb3bd7a39f74e3e1191e82ce58e9
Diffstat (limited to 'src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java')
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java34
1 files changed, 34 insertions, 0 deletions
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
index 2ea10c28b..d1b903c83 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java
@@ -18,12 +18,20 @@ package com.android.launcher3.uioverrides;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import android.app.ActivityOptions;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.view.View;
import android.view.View.AccessibilityDelegate;
+import com.android.launcher3.BubbleTextView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherStateManager.StateHandler;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
import com.android.launcher3.graphics.BitmapRenderer;
import com.android.launcher3.util.TouchController;
@@ -58,4 +66,30 @@ public class UiFactory {
}
public static void resetOverview(Launcher launcher) { }
+
+ public static Bundle getActivityLaunchOptions(Launcher launcher, View v) {
+ if (Utilities.ATLEAST_MARSHMALLOW) {
+ int left = 0, top = 0;
+ int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
+ if (v instanceof BubbleTextView) {
+ // Launch from center of icon, not entire view
+ Drawable icon = ((BubbleTextView) v).getIcon();
+ if (icon != null) {
+ Rect bounds = icon.getBounds();
+ left = (width - bounds.width()) / 2;
+ top = v.getPaddingTop();
+ width = bounds.width();
+ height = bounds.height();
+ }
+ }
+ return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height).toBundle();
+ } else if (Utilities.ATLEAST_LOLLIPOP_MR1) {
+ // On L devices, we use the device default slide-up transition.
+ // On L MR1 devices, we use a custom version of the slide-up transition which
+ // doesn't have the delay present in the device default.
+ return ActivityOptions.makeCustomAnimation(
+ launcher, R.anim.task_open_enter, R.anim.no_anim).toBundle();
+ }
+ return null;
+ }
}