Search in sources :

Example 6 with LAUNCHER_TASK_LAUNCH_SWIPE_DOWN

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN in project android_packages_apps_Launcher3 by ProtonAOSP.

the class RecentsView method createTaskLaunchAnimation.

public PendingAnimation createTaskLaunchAnimation(TaskView tv, long duration, Interpolator interpolator) {
    if (FeatureFlags.IS_STUDIO_BUILD && mPendingAnimation != null) {
        throw new IllegalStateException("Another pending animation is still running");
    }
    int count = getTaskViewCount();
    if (count == 0) {
        return new PendingAnimation(duration);
    }
    // When swiping down from overview to tasks, ensures the snapped page's scroll maintain
    // invariant between quick switch and overview, to ensure a smooth animation transition.
    updateGridProperties();
    updateScrollSynchronously();
    int targetSysUiFlags = tv.getThumbnail().getSysUiStatusNavFlags();
    final boolean[] passedOverviewThreshold = new boolean[] { false };
    ValueAnimator progressAnim = ValueAnimator.ofFloat(0, 1);
    progressAnim.addUpdateListener(animator -> {
        // tasks' flags
        if (animator.getAnimatedFraction() > UPDATE_SYSUI_FLAGS_THRESHOLD) {
            mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, targetSysUiFlags);
        } else {
            mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0);
        }
        // Passing the threshold from taskview to fullscreen app will vibrate
        final boolean passed = animator.getAnimatedFraction() >= SUCCESS_TRANSITION_PROGRESS;
        if (passed != passedOverviewThreshold[0]) {
            passedOverviewThreshold[0] = passed;
            performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
        }
    });
    AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv);
    DepthController depthController = getDepthController();
    if (depthController != null) {
        ObjectAnimator depthAnimator = ObjectAnimator.ofFloat(depthController, DEPTH, BACKGROUND_APP.getDepth(mActivity));
        anim.play(depthAnimator);
    }
    anim.play(progressAnim);
    anim.setInterpolator(interpolator);
    mPendingAnimation = new PendingAnimation(duration);
    mPendingAnimation.add(anim);
    if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
        runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator().addOverviewToAppAnim(mPendingAnimation, interpolator));
        mPendingAnimation.addOnFrameCallback(this::redrawLiveTile);
    }
    mPendingAnimation.addEndListener(isSuccess -> {
        if (isSuccess) {
            if (tv.getTaskIds()[1] != -1) {
                // TODO(b/194414938): make this part of the animations instead.
                TaskViewUtils.setSplitAuxiliarySurfacesShown(mRemoteTargetHandles[0].getTransformParams().getTargetSet().nonApps, true, /*shown*/
                false);
            }
            if (ENABLE_QUICKSTEP_LIVE_TILE.get() && tv.isRunningTask()) {
                finishRecentsAnimation(false, /* toRecents */
                null);
                onTaskLaunchAnimationEnd(true);
            } else {
                tv.launchTask(this::onTaskLaunchAnimationEnd);
            }
            Task task = tv.getTask();
            if (task != null) {
                mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo()).log(LAUNCHER_TASK_LAUNCH_SWIPE_DOWN);
            }
        } else {
            onTaskLaunchAnimationEnd(false);
        }
        mPendingAnimation = null;
    });
    return mPendingAnimation;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Task(com.android.systemui.shared.recents.model.Task) GroupTask(com.android.quickstep.util.GroupTask) ObjectAnimator(android.animation.ObjectAnimator) AnimatorSet(android.animation.AnimatorSet) ValueAnimator(android.animation.ValueAnimator) DepthController(com.android.launcher3.statehandlers.DepthController) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Aggregations

AnimatorSet (android.animation.AnimatorSet)6 ObjectAnimator (android.animation.ObjectAnimator)6 ValueAnimator (android.animation.ValueAnimator)6 Point (android.graphics.Point)6 TextPaint (android.text.TextPaint)6 PendingAnimation (com.android.launcher3.anim.PendingAnimation)6 DepthController (com.android.launcher3.statehandlers.DepthController)6 Task (com.android.systemui.shared.recents.model.Task)6 GroupTask (com.android.quickstep.util.GroupTask)4 LayoutTransition (android.animation.LayoutTransition)1 TransitionListener (android.animation.LayoutTransition.TransitionListener)1 TargetApi (android.annotation.TargetApi)1 RunningTaskInfo (android.app.ActivityManager.RunningTaskInfo)1 Context (android.content.Context)1 Configuration (android.content.res.Configuration)1 Canvas (android.graphics.Canvas)1 PointF (android.graphics.PointF)1 Rect (android.graphics.Rect)1 RectF (android.graphics.RectF)1 Typeface (android.graphics.Typeface)1