Search in sources :

Example 91 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_404Launcher by P-404.

the class AnimatorControllerWithResistance method createForRecents.

/**
 * Applies resistance to recents when swiping up past its target position.
 * @param normalController The controller to run from 0 to 1 before this resistance applies.
 * @param context Used to compute start and end values.
 * @param recentsOrientedState Used to compute start and end values.
 * @param dp Used to compute start and end values.
 * @param scaleTarget The target for the scaleProperty.
 * @param scaleProperty Animate the value to change the scale of the window/recents view.
 * @param translationTarget The target for the translationProperty.
 * @param translationProperty Animate the value to change the translation of the recents view.
 */
public static <SCALE, TRANSLATION> AnimatorControllerWithResistance createForRecents(AnimatorPlaybackController normalController, Context context, RecentsOrientedState recentsOrientedState, DeviceProfile dp, SCALE scaleTarget, FloatProperty<SCALE> scaleProperty, TRANSLATION translationTarget, FloatProperty<TRANSLATION> translationProperty) {
    RecentsParams params = new RecentsParams(context, recentsOrientedState, dp, scaleTarget, scaleProperty, translationTarget, translationProperty);
    PendingAnimation resistAnim = createRecentsResistanceAnim(params);
    AnimatorPlaybackController resistanceController = resistAnim.createPlaybackController();
    return new AnimatorControllerWithResistance(normalController, resistanceController);
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 92 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_404Launcher by P-404.

the class FallbackRecentsView method onPrepareGestureEndAnimation.

/**
 * When the gesture ends and we're going to recents view, we also remove the temporary
 * invisible tile added for the home task. This also pushes the remaining tiles back
 * to the center.
 */
@Override
public void onPrepareGestureEndAnimation(@Nullable AnimatorSet animatorSet, GestureState.GestureEndTarget endTarget, TaskViewSimulator[] taskViewSimulators) {
    super.onPrepareGestureEndAnimation(animatorSet, endTarget, taskViewSimulators);
    if (mHomeTaskInfo != null && endTarget == RECENTS && animatorSet != null) {
        TaskView tv = getTaskViewByTaskId(mHomeTaskInfo.taskId);
        if (tv != null) {
            PendingAnimation pa = createTaskDismissAnimation(tv, true, false, 150, false);
            pa.addEndListener(e -> setCurrentTask(-1));
            AnimatorPlaybackController controller = pa.createPlaybackController();
            controller.dispatchOnStart();
            animatorSet.play(controller.getAnimationPlayer());
        }
    }
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskView(com.android.quickstep.views.TaskView) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 93 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_404Launcher by P-404.

the class NoButtonQuickSwitchTouchController method setupOverviewAnimators.

private void setupOverviewAnimators() {
    final LauncherState fromState = QUICK_SWITCH;
    final LauncherState toState = OVERVIEW;
    // Set RecentView's initial properties.
    RECENTS_SCALE_PROPERTY.set(mRecentsView, fromState.getOverviewScaleAndOffset(mLauncher)[0]);
    ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, 1f);
    mRecentsView.setContentAlpha(1);
    mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress());
    mLauncher.getActionsView().getVisibilityAlpha().setValue((fromState.getVisibleElements(mLauncher) & OVERVIEW_ACTIONS) != 0 ? 1f : 0f);
    float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher);
    // As we drag right, animate the following properties:
    // - RecentsView translationX
    // - OverviewScrim
    // - RecentsView fade (if it's empty)
    PendingAnimation xAnim = new PendingAnimation((long) (mXRange * 2));
    xAnim.setFloat(mRecentsView, ADJACENT_PAGE_HORIZONTAL_OFFSET, scaleAndOffset[1], LINEAR);
    // Use QuickSwitchState instead of OverviewState to determine scrim color,
    // since we need to take potential taskbar into account.
    xAnim.setViewBackgroundColor(mLauncher.getScrimView(), QUICK_SWITCH.getWorkspaceScrimColor(mLauncher), LINEAR);
    if (mRecentsView.getTaskViewCount() == 0) {
        xAnim.addFloat(mRecentsView, CONTENT_ALPHA, 0f, 1f, LINEAR);
    }
    mXOverviewAnim = xAnim.createPlaybackController();
    mXOverviewAnim.dispatchOnStart();
    // As we drag up, animate the following properties:
    // - RecentsView scale
    // - RecentsView fullscreenProgress
    PendingAnimation yAnim = new PendingAnimation((long) (mYRange * 2));
    yAnim.setFloat(mRecentsView, RECENTS_SCALE_PROPERTY, scaleAndOffset[0], SCALE_DOWN_INTERPOLATOR);
    yAnim.setFloat(mRecentsView, FULLSCREEN_PROGRESS, toState.getOverviewFullscreenProgress(), SCALE_DOWN_INTERPOLATOR);
    AnimatorPlaybackController yNormalController = yAnim.createPlaybackController();
    AnimatorControllerWithResistance yAnimWithResistance = AnimatorControllerWithResistance.createForRecents(yNormalController, mLauncher, mRecentsView.getPagedViewOrientedState(), mLauncher.getDeviceProfile(), mRecentsView, RECENTS_SCALE_PROPERTY, mRecentsView, TASK_SECONDARY_TRANSLATION);
    mYOverviewAnim = new AnimatedFloat(() -> {
        if (mYOverviewAnim != null) {
            yAnimWithResistance.setProgress(mYOverviewAnim.value, mMaxYProgress);
        }
    });
    yNormalController.dispatchOnStart();
}
Also used : AnimatedFloat(com.android.quickstep.AnimatedFloat) LauncherState(com.android.launcher3.LauncherState) PendingAnimation(com.android.launcher3.anim.PendingAnimation) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController) AnimatorControllerWithResistance(com.android.quickstep.util.AnimatorControllerWithResistance)

Example 94 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_404Launcher by P-404.

the class RecentsViewStateController method handleSplitSelectionState.

/**
 * Create or dismiss split screen select animations.
 * @param builder if null then this will run the split select animations right away, otherwise
 *                will add animations to builder.
 */
private void handleSplitSelectionState(@NonNull LauncherState toState, @Nullable PendingAnimation builder) {
    LauncherState currentState = mLauncher.getStateManager().getState();
    boolean animate = builder != null;
    PagedOrientationHandler orientationHandler = ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler();
    Pair<FloatProperty, FloatProperty> taskViewsFloat = orientationHandler.getSplitSelectTaskOffset(TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, mLauncher.getDeviceProfile());
    if (isSplitSelectionState(currentState, toState)) {
        // Animation to "dismiss" selected taskView
        PendingAnimation splitSelectInitAnimation = mRecentsView.createSplitSelectInitAnimation();
        // Add properties to shift remaining taskViews to get out of placeholder view
        splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.first, toState.getSplitSelectTranslation(mLauncher), LINEAR);
        splitSelectInitAnimation.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR);
        if (!animate && isSplitSelectionState(currentState, toState)) {
            splitSelectInitAnimation.buildAnim().start();
        } else if (animate && isSplitSelectionState(currentState, toState)) {
            builder.add(splitSelectInitAnimation.buildAnim());
        }
    }
    if (isSplitSelectionState(currentState, toState)) {
        mRecentsView.applySplitPrimaryScrollOffset();
    } else {
        mRecentsView.resetSplitPrimaryScrollOffset();
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) PendingAnimation(com.android.launcher3.anim.PendingAnimation) PagedOrientationHandler(com.android.launcher3.touch.PagedOrientationHandler) LauncherRecentsView(com.android.quickstep.views.LauncherRecentsView) RecentsView(com.android.quickstep.views.RecentsView) FloatProperty(android.util.FloatProperty)

Example 95 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_404Launcher by P-404.

the class LauncherActivityInterface method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(RecentsAnimationDeviceState deviceState, boolean activityVisible, Consumer<AnimatorControllerWithResistance> callback) {
    notifyRecentsOfOrientation(deviceState.getRotationTouchHelper());
    DefaultAnimationFactory factory = new DefaultAnimationFactory(callback) {

        @Override
        protected void createBackgroundToOverviewAnim(BaseQuickstepLauncher activity, PendingAnimation pa) {
            super.createBackgroundToOverviewAnim(activity, pa);
            // Animate the blur and wallpaper zoom
            float fromDepthRatio = BACKGROUND_APP.getDepth(activity);
            float toDepthRatio = OVERVIEW.getDepth(activity);
            pa.addFloat(getDepthController(), new ClampedDepthProperty(fromDepthRatio, toDepthRatio), fromDepthRatio, toDepthRatio, LINEAR);
        }
    };
    BaseQuickstepLauncher launcher = factory.initUI();
    // Since all apps is not visible, we can safely reset the scroll position.
    // This ensures then the next swipe up to all-apps starts from scroll 0.
    launcher.getAppsView().reset(false);
    return factory;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) ClampedDepthProperty(com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty)

Aggregations

PendingAnimation (com.android.launcher3.anim.PendingAnimation)145 AnimatorPlaybackController (com.android.launcher3.anim.AnimatorPlaybackController)58 Animator (android.animation.Animator)46 AnimatorSet (android.animation.AnimatorSet)45 Rect (android.graphics.Rect)36 ValueAnimator (android.animation.ValueAnimator)34 Point (android.graphics.Point)32 TextPaint (android.text.TextPaint)32 ObjectAnimator (android.animation.ObjectAnimator)31 Context (android.content.Context)31 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)29 View (android.view.View)29 RecentsView (com.android.quickstep.views.RecentsView)29 DeviceProfile (com.android.launcher3.DeviceProfile)27 RectF (android.graphics.RectF)26 Interpolator (android.view.animation.Interpolator)26 PagedOrientationHandler (com.android.launcher3.touch.PagedOrientationHandler)25 FloatProperty (android.util.FloatProperty)23 Matrix (android.graphics.Matrix)21 SpringProperty (com.android.launcher3.anim.SpringProperty)21