Search in sources :

Example 26 with RemoteTargetHandle

use of com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle in project android_packages_apps_Launcher3 by ArrowOS.

the class RecentsView method createAdjacentPageAnimForTaskLaunch.

/**
 * Animate adjacent tasks off screen while scaling up.
 *
 * If launching one of the adjacent tasks, parallax the center task and other adjacent task
 * to the right.
 */
public AnimatorSet createAdjacentPageAnimForTaskLaunch(TaskView tv) {
    AnimatorSet anim = new AnimatorSet();
    int taskIndex = indexOfChild(tv);
    int centerTaskIndex = getCurrentPage();
    boolean launchingCenterTask = taskIndex == centerTaskIndex;
    float toScale = getMaxScaleForFullScreen();
    RecentsView recentsView = tv.getRecentsView();
    if (launchingCenterTask) {
        anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale));
        anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
    } else {
        // We are launching an adjacent task, so parallax the center and other adjacent task.
        float displacementX = tv.getWidth() * (toScale - 1f);
        float primaryTranslation = mIsRtl ? -displacementX : displacementX;
        anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex), mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation));
        int runningTaskIndex = recentsView.getRunningTaskIndex();
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && runningTaskIndex != -1 && runningTaskIndex != taskIndex) {
            for (RemoteTargetHandle remoteHandle : recentsView.getRemoteTargetHandles()) {
                anim.play(ObjectAnimator.ofFloat(remoteHandle.getTaskViewSimulator().taskPrimaryTranslation, AnimatedFloat.VALUE, primaryTranslation));
            }
        }
        int otherAdjacentTaskIndex = centerTaskIndex + (centerTaskIndex - taskIndex);
        if (otherAdjacentTaskIndex >= 0 && otherAdjacentTaskIndex < getPageCount()) {
            PropertyValuesHolder[] properties = new PropertyValuesHolder[3];
            properties[0] = PropertyValuesHolder.ofFloat(mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation);
            properties[1] = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
            properties[2] = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
            anim.play(ObjectAnimator.ofPropertyValuesHolder(getPageAt(otherAdjacentTaskIndex), properties));
        }
    }
    return anim;
}
Also used : RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) PropertyValuesHolder(android.animation.PropertyValuesHolder) AnimatorSet(android.animation.AnimatorSet) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 27 with RemoteTargetHandle

use of com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle in project android_packages_apps_Launcher3 by ArrowOS.

the class SwipeUpAnimationLogic method initTransitionEndpoints.

protected void initTransitionEndpoints(DeviceProfile dp) {
    mDp = dp;
    mTransitionDragLength = mGestureState.getActivityInterface().getSwipeUpDestinationAndLength(dp, mContext, TEMP_RECT, mRemoteTargetHandles[0].getTaskViewSimulator().getOrientationState().getOrientationHandler());
    mDragLengthFactor = (float) dp.heightPx / mTransitionDragLength;
    for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) {
        PendingAnimation pendingAnimation = new PendingAnimation(mTransitionDragLength * 2);
        TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator();
        taskViewSimulator.setDp(dp);
        taskViewSimulator.addAppToOverviewAnim(pendingAnimation, LINEAR);
        AnimatorPlaybackController playbackController = pendingAnimation.createPlaybackController();
        remoteHandle.setPlaybackController(AnimatorControllerWithResistance.createForRecents(playbackController, mContext, taskViewSimulator.getOrientationState(), mDp, taskViewSimulator.recentsViewScale, AnimatedFloat.VALUE, taskViewSimulator.recentsViewSecondaryTranslation, AnimatedFloat.VALUE));
    }
}
Also used : RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskViewSimulator(com.android.quickstep.util.TaskViewSimulator) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 28 with RemoteTargetHandle

use of com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle in project android_packages_apps_Launcher3 by ProtonAOSP.

the class TaskView method onClick.

private void onClick(View view) {
    if (getTask() == null) {
        return;
    }
    if (confirmSecondSplitSelectApp()) {
        return;
    }
    RecentsView recentsView = getRecentsView();
    RemoteTargetHandle[] remoteTargetHandles = recentsView.mRemoteTargetHandles;
    if (ENABLE_QUICKSTEP_LIVE_TILE.get() && isRunningTask() && remoteTargetHandles != null) {
        if (!mIsClickableAsLiveTile) {
            return;
        }
        // Reset the minimized state since we force-toggled the minimized state when entering
        // overview, but never actually finished the recents animation
        SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
        if (p != null) {
            p.setSplitScreenMinimized(false);
        }
        mIsClickableAsLiveTile = false;
        RemoteAnimationTargets targets;
        if (remoteTargetHandles.length == 1) {
            targets = remoteTargetHandles[0].getTransformParams().getTargetSet();
        } else {
            TransformParams topLeftParams = remoteTargetHandles[0].getTransformParams();
            TransformParams rightBottomParams = remoteTargetHandles[1].getTransformParams();
            RemoteAnimationTargetCompat[] apps = Stream.concat(Arrays.stream(topLeftParams.getTargetSet().apps), Arrays.stream(rightBottomParams.getTargetSet().apps)).toArray(RemoteAnimationTargetCompat[]::new);
            RemoteAnimationTargetCompat[] wallpapers = Stream.concat(Arrays.stream(topLeftParams.getTargetSet().wallpapers), Arrays.stream(rightBottomParams.getTargetSet().wallpapers)).toArray(RemoteAnimationTargetCompat[]::new);
            targets = new RemoteAnimationTargets(apps, wallpapers, topLeftParams.getTargetSet().nonApps, topLeftParams.getTargetSet().targetMode);
        }
        if (targets == null) {
            // If the recents animation is cancelled somehow between the parent if block and
            // here, try to launch the task as a non live tile task.
            launchTaskAnimated();
            return;
        }
        AnimatorSet anim = new AnimatorSet();
        TaskViewUtils.composeRecentsLaunchAnimator(anim, this, targets.apps, targets.wallpapers, targets.nonApps, true, /* launcherClosing */
        mActivity.getStateManager(), recentsView, recentsView.getDepthController());
        anim.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationStart(Animator animation) {
                recentsView.runActionOnRemoteHandles((Consumer<RemoteTargetHandle>) remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator().setDrawsBelowRecents(false));
            }

            @Override
            public void onAnimationEnd(Animator animator) {
                mIsClickableAsLiveTile = true;
            }
        });
        anim.start();
        recentsView.onTaskLaunchedInLiveTileMode();
    } else {
        launchTaskAnimated();
    }
    mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo()).log(LAUNCHER_TASK_LAUNCH_TAP);
}
Also used : RemoteAnimationTargetCompat(com.android.systemui.shared.system.RemoteAnimationTargetCompat) RemoteAnimationTargets(com.android.quickstep.RemoteAnimationTargets) AnimatorSet(android.animation.AnimatorSet) RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) Consumer(java.util.function.Consumer) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) TransformParams(com.android.quickstep.util.TransformParams) SystemUiProxy(com.android.quickstep.SystemUiProxy)

Example 29 with RemoteTargetHandle

use of com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle in project android_packages_apps_Launcher3 by ProtonAOSP.

the class RecentsView method createAdjacentPageAnimForTaskLaunch.

/**
 * Animate adjacent tasks off screen while scaling up.
 *
 * If launching one of the adjacent tasks, parallax the center task and other adjacent task
 * to the right.
 */
public AnimatorSet createAdjacentPageAnimForTaskLaunch(TaskView tv) {
    AnimatorSet anim = new AnimatorSet();
    int taskIndex = indexOfChild(tv);
    int centerTaskIndex = getCurrentPage();
    boolean launchingCenterTask = taskIndex == centerTaskIndex;
    float toScale = getMaxScaleForFullScreen();
    RecentsView recentsView = tv.getRecentsView();
    if (launchingCenterTask) {
        anim.play(ObjectAnimator.ofFloat(recentsView, RECENTS_SCALE_PROPERTY, toScale));
        anim.play(ObjectAnimator.ofFloat(recentsView, FULLSCREEN_PROGRESS, 1));
    } else {
        // We are launching an adjacent task, so parallax the center and other adjacent task.
        float displacementX = tv.getWidth() * (toScale - 1f);
        float primaryTranslation = mIsRtl ? -displacementX : displacementX;
        anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex), mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation));
        int runningTaskIndex = recentsView.getRunningTaskIndex();
        if (ENABLE_QUICKSTEP_LIVE_TILE.get() && runningTaskIndex != -1 && runningTaskIndex != taskIndex) {
            for (RemoteTargetHandle remoteHandle : recentsView.getRemoteTargetHandles()) {
                anim.play(ObjectAnimator.ofFloat(remoteHandle.getTaskViewSimulator().taskPrimaryTranslation, AnimatedFloat.VALUE, primaryTranslation));
            }
        }
        int otherAdjacentTaskIndex = centerTaskIndex + (centerTaskIndex - taskIndex);
        if (otherAdjacentTaskIndex >= 0 && otherAdjacentTaskIndex < getPageCount()) {
            PropertyValuesHolder[] properties = new PropertyValuesHolder[3];
            properties[0] = PropertyValuesHolder.ofFloat(mOrientationHandler.getPrimaryViewTranslate(), primaryTranslation);
            properties[1] = PropertyValuesHolder.ofFloat(View.SCALE_X, 1);
            properties[2] = PropertyValuesHolder.ofFloat(View.SCALE_Y, 1);
            anim.play(ObjectAnimator.ofPropertyValuesHolder(getPageAt(otherAdjacentTaskIndex), properties));
        }
    }
    return anim;
}
Also used : RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) PropertyValuesHolder(android.animation.PropertyValuesHolder) AnimatorSet(android.animation.AnimatorSet) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 30 with RemoteTargetHandle

use of com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle in project android_packages_apps_Launcher3 by ProtonAOSP.

the class SwipeUpAnimationLogic method createWindowAnimationToHome.

/**
 * Creates an animation that transforms the current app window into the home app.
 * @param startProgress The progress of {@link #mCurrentShift} to start the window from.
 * @param homeAnimationFactory The home animation factory.
 */
protected RectFSpringAnim[] createWindowAnimationToHome(float startProgress, HomeAnimationFactory homeAnimationFactory) {
    // TODO(b/195473584) compute separate end targets for different staged split
    final RectF targetRect = homeAnimationFactory.getWindowTargetRect();
    RectFSpringAnim[] out = new RectFSpringAnim[mRemoteTargetHandles.length];
    Matrix[] homeToWindowPositionMap = new Matrix[mRemoteTargetHandles.length];
    RectF[] startRects = updateProgressForStartRect(homeToWindowPositionMap, startProgress);
    for (int i = 0, mRemoteTargetHandlesLength = mRemoteTargetHandles.length; i < mRemoteTargetHandlesLength; i++) {
        RemoteTargetHandle remoteHandle = mRemoteTargetHandles[i];
        out[i] = getWindowAnimationToHomeInternal(homeAnimationFactory, targetRect, remoteHandle.getTransformParams(), remoteHandle.getTaskViewSimulator(), startRects[i], homeToWindowPositionMap[i]);
    }
    return out;
}
Also used : RectF(android.graphics.RectF) RectFSpringAnim(com.android.quickstep.util.RectFSpringAnim) RemoteTargetHandle(com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle) Matrix(android.graphics.Matrix)

Aggregations

RemoteTargetHandle (com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle)32 TaskViewSimulator (com.android.quickstep.util.TaskViewSimulator)20 Matrix (android.graphics.Matrix)16 RectF (android.graphics.RectF)16 Animator (android.animation.Animator)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)12 AnimatorSet (android.animation.AnimatorSet)12 ObjectAnimator (android.animation.ObjectAnimator)12 RemoteAnimationTargetCompat (com.android.systemui.shared.system.RemoteAnimationTargetCompat)12 PropertyValuesHolder (android.animation.PropertyValuesHolder)8 ValueAnimator (android.animation.ValueAnimator)8 Context (android.content.Context)8 Point (android.graphics.Point)8 Rect (android.graphics.Rect)8 TextPaint (android.text.TextPaint)8 DeviceProfile (com.android.launcher3.DeviceProfile)8 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)8 PendingAnimation (com.android.launcher3.anim.PendingAnimation)8 RemoteAnimationTargets (com.android.quickstep.RemoteAnimationTargets)8 SystemUiProxy (com.android.quickstep.SystemUiProxy)8