Search in sources :

Example 26 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsActivity method composeRecentsLaunchAnimator.

/**
 * Composes the animations for a launch from the recents list if possible.
 */
private AnimatorSet composeRecentsLaunchAnimator(TaskView taskView, RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets) {
    AnimatorSet target = new AnimatorSet();
    boolean activityClosing = taskIsATargetWithMode(appTargets, getTaskId(), MODE_CLOSING);
    PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
    createRecentsWindowAnimator(taskView, !activityClosing, appTargets, wallpaperTargets, null, /* depthController */
    pa);
    target.play(pa.buildAnim());
    // Found a visible recents task that matches the opening app, lets launch the app from there
    if (activityClosing) {
        Animator adjacentAnimation = mFallbackRecentsView.createAdjacentPageAnimForTaskLaunch(taskView);
        adjacentAnimation.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
        adjacentAnimation.setDuration(RECENTS_LAUNCH_DURATION);
        adjacentAnimation.addListener(resetStateListener());
        target.play(adjacentAnimation);
    }
    return target;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskViewUtils.createRecentsWindowAnimator(com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator) Animator(android.animation.Animator) AnimatorSet(android.animation.AnimatorSet)

Example 27 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsActivity method getActivityLaunchOptions.

@Override
public ActivityOptions getActivityLaunchOptions(final View v) {
    if (!(v instanceof TaskView)) {
        return null;
    }
    final TaskView taskView = (TaskView) v;
    RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mUiHandler, true) {

        /* startAtFrontOfQueue */
        @Override
        public void onCreateAnimation(RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, AnimationResult result) {
            AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, wallpaperTargets);
            anim.addListener(resetStateListener());
            result.setAnimation(anim, RecentsActivity.this);
        }
    };
    return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(runner, RECENTS_LAUNCH_DURATION, RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY));
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) TaskView(com.android.quickstep.views.TaskView) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) AnimatorSet(android.animation.AnimatorSet) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat)

Example 28 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by ArrowOS.

the class RecentsActivity method getActivityLaunchOptions.

@Override
public ActivityOptionsWrapper getActivityLaunchOptions(final View v, @Nullable ItemInfo item) {
    if (!(v instanceof TaskView)) {
        return super.getActivityLaunchOptions(v, item);
    }
    final TaskView taskView = (TaskView) v;
    RunnableList onEndCallback = new RunnableList();
    mActivityLaunchAnimationRunner = new RemoteAnimationFactory() {

        @Override
        public void onCreateAnimation(int transit, RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) {
            mHandler.removeCallbacks(mAnimationStartTimeoutRunnable);
            AnimatorSet anim = composeRecentsLaunchAnimator(taskView, appTargets, wallpaperTargets, nonAppTargets);
            anim.addListener(resetStateListener());
            result.setAnimation(anim, RecentsActivity.this, onEndCallback::executeAllAndDestroy, true);
        }

        @Override
        public void onAnimationCancelled() {
            mHandler.removeCallbacks(mAnimationStartTimeoutRunnable);
            onEndCallback.executeAllAndDestroy();
        }
    };
    final LauncherAnimationRunner wrapper = new LauncherAnimationRunner(mUiHandler, mActivityLaunchAnimationRunner, true);
    RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(wrapper, RECENTS_LAUNCH_DURATION, RECENTS_LAUNCH_DURATION - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY, getIApplicationThread());
    final ActivityOptionsWrapper activityOptions = new ActivityOptionsWrapper(ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
    activityOptions.options.setSplashscreenStyle(SplashScreen.SPLASH_SCREEN_STYLE_ICON);
    mHandler.postDelayed(mAnimationStartTimeoutRunnable, RECENTS_ANIMATION_TIMEOUT);
    return activityOptions;
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) TaskView(com.android.quickstep.views.TaskView) RemoteAnimationFactory(com.android.launcher3.LauncherAnimationRunner.RemoteAnimationFactory) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) AnimationResult(com.android.launcher3.LauncherAnimationRunner.AnimationResult) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) AnimatorSet(android.animation.AnimatorSet) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) RunnableList(com.android.launcher3.util.RunnableList)

Example 29 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by ArrowOS.

the class RecentsActivity method composeRecentsLaunchAnimator.

/**
 * Composes the animations for a launch from the recents list if possible.
 */
private AnimatorSet composeRecentsLaunchAnimator(TaskView taskView, RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets, RemoteAnimationTargetCompat[] nonAppTargets) {
    AnimatorSet target = new AnimatorSet();
    boolean activityClosing = taskIsATargetWithMode(appTargets, getTaskId(), MODE_CLOSING);
    PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
    createRecentsWindowAnimator(taskView, !activityClosing, appTargets, wallpaperTargets, nonAppTargets, null, /* depthController */
    pa);
    target.play(pa.buildAnim());
    // Found a visible recents task that matches the opening app, lets launch the app from there
    if (activityClosing) {
        Animator adjacentAnimation = mFallbackRecentsView.createAdjacentPageAnimForTaskLaunch(taskView);
        adjacentAnimation.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
        adjacentAnimation.setDuration(RECENTS_LAUNCH_DURATION);
        adjacentAnimation.addListener(resetStateListener());
        target.play(adjacentAnimation);
    }
    return target;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Animator(android.animation.Animator) TaskViewUtils.createRecentsWindowAnimator(com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator) AnimatorSet(android.animation.AnimatorSet)

Example 30 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepAppTransitionManagerImpl.RECENTS_LAUNCH_DURATION in project android_packages_apps_Launcher3 by ArrowOS.

the class QuickstepTransitionManager method getActivityLaunchOptions.

/**
 * @return ActivityOptions with remote animations that controls how the window of the opening
 * targets are displayed.
 */
public ActivityOptionsWrapper getActivityLaunchOptions(View v) {
    boolean fromRecents = isLaunchingFromRecents(v, null);
    RunnableList onEndCallback = new RunnableList();
    mAppLaunchRunner = new AppLaunchAnimationRunner(v, onEndCallback);
    RemoteAnimationRunnerCompat runner = new LauncherAnimationRunner(mHandler, mAppLaunchRunner, true);
    // Note that this duration is a guess as we do not know if the animation will be a
    // recents launch or not for sure until we know the opening app targets.
    long duration = fromRecents ? RECENTS_LAUNCH_DURATION : APP_LAUNCH_DURATION;
    long statusBarTransitionDelay = duration - STATUS_BAR_TRANSITION_DURATION - STATUS_BAR_TRANSITION_PRE_DELAY;
    RemoteAnimationAdapterCompat adapterCompat = new RemoteAnimationAdapterCompat(runner, duration, statusBarTransitionDelay, mLauncher.getIApplicationThread());
    return new ActivityOptionsWrapper(ActivityOptionsCompat.makeRemoteAnimation(adapterCompat), onEndCallback);
}
Also used : RemoteAnimationAdapterCompat(com.android.systemui.shared.system.RemoteAnimationAdapterCompat) ActivityOptionsWrapper(com.android.launcher3.util.ActivityOptionsWrapper) RunnableList(com.android.launcher3.util.RunnableList) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat)

Aggregations

Animator (android.animation.Animator)21 PendingAnimation (com.android.launcher3.anim.PendingAnimation)15 AnimatorSet (android.animation.AnimatorSet)14 TaskView (com.android.quickstep.views.TaskView)14 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)13 ObjectAnimator (android.animation.ObjectAnimator)12 RemoteAnimationAdapterCompat (com.android.systemui.shared.system.RemoteAnimationAdapterCompat)12 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)12 Context (android.content.Context)11 DeviceProfile (com.android.launcher3.DeviceProfile)11 ValueAnimator (android.animation.ValueAnimator)10 ActivityOptionsWrapper (com.android.launcher3.util.ActivityOptionsWrapper)10 RunnableList (com.android.launcher3.util.RunnableList)10 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)9 RecentsView (com.android.quickstep.views.RecentsView)9 Rect (android.graphics.Rect)7 LauncherAnimationRunner (com.android.launcher3.LauncherAnimationRunner)7 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)7 TaskViewUtils.createRecentsWindowAnimator (com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator)7 SurfaceTransactionApplier (com.android.quickstep.util.SurfaceTransactionApplier)7