Search in sources :

Example 21 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION in project Neo-Launcher by NeoApplications.

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[] targetCompats, AnimationResult result) {
            AnimatorSet anim = composeRecentsLaunchAnimator(taskView, targetCompats);
            anim.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    mFallbackRecentsView.resetViewUI();
                }
            });
            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) TaskViewUtils.getRecentsWindowAnimator(com.android.quickstep.TaskViewUtils.getRecentsWindowAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) LauncherAnimationRunner(com.android.launcher3.LauncherAnimationRunner) AnimatorSet(android.animation.AnimatorSet) RemoteAnimationRunnerCompat(com.android.systemui.shared.system.RemoteAnimationRunnerCompat)

Example 22 with RECENTS_LAUNCH_DURATION

use of com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DURATION in project Neo-Launcher by NeoApplications.

the class LauncherAppTransitionManagerImpl method composeRecentsLaunchAnimator.

@Override
protected void composeRecentsLaunchAnimator(@NonNull AnimatorSet anim, @NonNull View v, @NonNull RemoteAnimationTargetCompat[] targets, boolean launcherClosing) {
    RecentsView recentsView = mLauncher.getOverviewPanel();
    boolean skipLauncherChanges = !launcherClosing;
    TaskView taskView = findTaskViewToLaunch(mLauncher, v, targets);
    ClipAnimationHelper helper = new ClipAnimationHelper(mLauncher);
    anim.play(getRecentsWindowAnimator(taskView, skipLauncherChanges, targets, helper).setDuration(RECENTS_LAUNCH_DURATION));
    Animator childStateAnimation = null;
    // Found a visible recents task that matches the opening app, lets launch the app from there
    Animator launcherAnim;
    final AnimatorListenerAdapter windowAnimEndListener;
    if (launcherClosing) {
        launcherAnim = recentsView.createAdjacentPageAnimForTaskLaunch(taskView, helper);
        launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
        launcherAnim.setDuration(RECENTS_LAUNCH_DURATION);
        // Make sure recents gets fixed up by resetting task alphas and scales, etc.
        windowAnimEndListener = new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLauncher.getStateManager().moveToRestState();
                mLauncher.getStateManager().reapplyState();
            }
        };
    } else {
        AnimatorPlaybackController controller = mLauncher.getStateManager().createAnimationToNewWorkspace(NORMAL, RECENTS_LAUNCH_DURATION);
        controller.dispatchOnStart();
        childStateAnimation = controller.getTarget();
        launcherAnim = controller.getAnimationPlayer().setDuration(RECENTS_LAUNCH_DURATION);
        windowAnimEndListener = new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLauncher.getStateManager().goToState(NORMAL, false);
            }
        };
    }
    anim.play(launcherAnim);
    // Set the current animation first, before adding windowAnimEndListener. Setting current
    // animation adds some listeners which need to be called before windowAnimEndListener
    // (the ordering of listeners matter in this case).
    mLauncher.getStateManager().setCurrentAnimation(anim, childStateAnimation);
    anim.addListener(windowAnimEndListener);
}
Also used : ClipAnimationHelper(com.android.quickstep.util.ClipAnimationHelper) TaskView(com.android.quickstep.views.TaskView) TaskViewUtils.getRecentsWindowAnimator(com.android.quickstep.TaskViewUtils.getRecentsWindowAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) RecentsView(com.android.quickstep.views.RecentsView)

Example 23 with RECENTS_LAUNCH_DURATION

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

the class TaskView method createLaunchAnimationForRunningTask.

public AnimatorPlaybackController createLaunchAnimationForRunningTask() {
    final PendingAnimation pendingAnimation = getRecentsView().createTaskLaunchAnimation(this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR);
    AnimatorPlaybackController currentAnimation = pendingAnimation.createPlaybackController();
    currentAnimation.setEndAction(() -> {
        pendingAnimation.finish(true, Touch.SWIPE);
        launchTask(false);
    });
    return currentAnimation;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 24 with RECENTS_LAUNCH_DURATION

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

the class LauncherAppTransitionManagerImpl method composeRecentsLaunchAnimator.

@Override
protected void composeRecentsLaunchAnimator(@NonNull AnimatorSet anim, @NonNull View v, @NonNull RemoteAnimationTargetCompat[] appTargets, @NonNull RemoteAnimationTargetCompat[] wallpaperTargets, boolean launcherClosing) {
    RecentsView recentsView = mLauncher.getOverviewPanel();
    boolean skipLauncherChanges = !launcherClosing;
    TaskView taskView = findTaskViewToLaunch(mLauncher, v, appTargets);
    PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
    createRecentsWindowAnimator(taskView, skipLauncherChanges, appTargets, wallpaperTargets, mLauncher.getDepthController(), pa);
    anim.play(pa.buildAnim());
    Animator childStateAnimation = null;
    // Found a visible recents task that matches the opening app, lets launch the app from there
    Animator launcherAnim;
    final AnimatorListenerAdapter windowAnimEndListener;
    if (launcherClosing) {
        launcherAnim = recentsView.createAdjacentPageAnimForTaskLaunch(taskView);
        launcherAnim.setInterpolator(Interpolators.TOUCH_RESPONSE_INTERPOLATOR);
        launcherAnim.setDuration(RECENTS_LAUNCH_DURATION);
        // Make sure recents gets fixed up by resetting task alphas and scales, etc.
        windowAnimEndListener = new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLauncher.getStateManager().moveToRestState();
                mLauncher.getStateManager().reapplyState();
            }
        };
    } else {
        AnimatorPlaybackController controller = mLauncher.getStateManager().createAnimationToNewWorkspace(NORMAL, RECENTS_LAUNCH_DURATION);
        controller.dispatchOnStart();
        childStateAnimation = controller.getTarget();
        launcherAnim = controller.getAnimationPlayer().setDuration(RECENTS_LAUNCH_DURATION);
        windowAnimEndListener = new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                mLauncher.getStateManager().goToState(NORMAL, false);
            }
        };
    }
    anim.play(launcherAnim);
    // Set the current animation first, before adding windowAnimEndListener. Setting current
    // animation adds some listeners which need to be called before windowAnimEndListener
    // (the ordering of listeners matter in this case).
    mLauncher.getStateManager().setCurrentAnimation(anim, childStateAnimation);
    anim.addListener(windowAnimEndListener);
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskView(com.android.quickstep.views.TaskView) TaskViewUtils.createRecentsWindowAnimator(com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator) ObjectAnimator(android.animation.ObjectAnimator) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) RecentsView(com.android.quickstep.views.RecentsView)

Example 25 with RECENTS_LAUNCH_DURATION

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

the class AppToOverviewAnimationProvider method createWindowAnimation.

/**
 * Create remote window animation from the currently running app to the overview panel.
 *
 * @param appTargets the target apps
 * @return animation from app to overview
 */
@Override
public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] appTargets, RemoteAnimationTargetCompat[] wallpaperTargets) {
    PendingAnimation pa = new PendingAnimation(RECENTS_LAUNCH_DURATION);
    if (mActivity == null) {
        Log.e(TAG, "Animation created, before activity");
        return pa.buildAnim();
    }
    mRecentsView.setRunningTaskIconScaledDown(true);
    pa.addListener(new AnimationSuccessListener() {

        @Override
        public void onAnimationSuccess(Animator animator) {
            mActivityInterface.onSwipeUpToRecentsComplete();
            mRecentsView.animateUpRunningTaskIconScale();
        }
    });
    DepthController depthController = mActivityInterface.getDepthController();
    if (depthController != null) {
        pa.addFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(mActivity), OVERVIEW.getDepth(mActivity), TOUCH_RESPONSE_INTERPOLATOR);
    }
    RemoteAnimationTargets targets = new RemoteAnimationTargets(appTargets, wallpaperTargets, MODE_CLOSING);
    // Use the top closing app to determine the insets for the animation
    RemoteAnimationTargetCompat runningTaskTarget = mTargetTask == null ? null : targets.findTask(mTargetTask.taskId);
    if (runningTaskTarget == null) {
        Log.e(TAG, "No closing app");
        return pa.buildAnim();
    }
    TaskViewSimulator tsv = new TaskViewSimulator(mActivity, mRecentsView.getSizeStrategy());
    tsv.setDp(mActivity.getDeviceProfile());
    tsv.setPreview(runningTaskTarget);
    tsv.setLayoutRotation(mRecentsView.getPagedViewOrientedState().getTouchRotation(), mRecentsView.getPagedViewOrientedState().getDisplayRotation());
    TransformParams params = new TransformParams().setTargetSet(targets).setSyncTransactionApplier(new SurfaceTransactionApplier(mActivity.getRootView()));
    AnimatedFloat recentsAlpha = new AnimatedFloat(() -> {
    });
    params.setBaseBuilderProxy((builder, app, p) -> builder.withAlpha(recentsAlpha.value));
    Interpolator taskInterpolator;
    if (targets.isAnimatingHome()) {
        params.setHomeBuilderProxy((builder, app, p) -> builder.withAlpha(1 - p.getProgress()));
        taskInterpolator = TOUCH_RESPONSE_INTERPOLATOR;
        pa.addFloat(recentsAlpha, AnimatedFloat.VALUE, 0, 1, TOUCH_RESPONSE_INTERPOLATOR);
    } else {
        // When animation from app to recents, the recents layer is drawn on top of the app. To
        // prevent the overlap, we animate the task first and then quickly fade in the recents.
        taskInterpolator = clampToProgress(TOUCH_RESPONSE_INTERPOLATOR, 0, 0.8f);
        pa.addFloat(recentsAlpha, AnimatedFloat.VALUE, 0, 1, clampToProgress(TOUCH_RESPONSE_INTERPOLATOR, 0.8f, 1));
    }
    pa.addFloat(params, TransformParams.PROGRESS, 0, 1, taskInterpolator);
    tsv.addAppToOverviewAnim(pa, taskInterpolator);
    pa.addOnFrameCallback(() -> tsv.apply(params));
    return pa.buildAnim();
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Animator(android.animation.Animator) SurfaceTransactionApplier(com.android.quickstep.util.SurfaceTransactionApplier) TaskViewSimulator(com.android.quickstep.util.TaskViewSimulator) RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) TransformParams(com.android.quickstep.util.TransformParams) Interpolator(android.view.animation.Interpolator) DepthController(com.android.launcher3.statehandlers.DepthController) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener)

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