From 69057173a732add164f83ddc926009c0cdca5e7c Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 18 Jan 2018 09:44:54 -0800 Subject: Synchronized opening app transition animations. Bug: 70220260 Change-Id: I3c8e1c477266fb3bd7a39f74e3e1191e82ce58e9 --- .../android/launcher3/uioverrides/UiFactory.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src_ui_overrides/com/android/launcher3/uioverrides/UiFactory.java') 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; + } } -- cgit v1.2.3