Search in sources :

Example 41 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Trebuchet by LineageOS.

the class StaggeredWorkspaceAnim method addDepthAnimationForState.

private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
    if (!(launcher instanceof BaseQuickstepLauncher)) {
        return;
    }
    PendingAnimation builder = new PendingAnimation(duration);
    DepthController depthController = ((BaseQuickstepLauncher) launcher).getDepthController();
    depthController.setStateWithAnimation(state, new StateAnimationConfig(), builder);
    mAnimators.play(builder.buildAnim());
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) DepthController(com.android.launcher3.statehandlers.DepthController)

Example 42 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Trebuchet by LineageOS.

the class SwipeUpAnimationLogic method initTransitionEndpoints.

protected void initTransitionEndpoints(DeviceProfile dp) {
    mDp = dp;
    mTaskViewSimulator.setDp(dp);
    mTransitionDragLength = mGestureState.getActivityInterface().getSwipeUpDestinationAndLength(dp, mContext, TEMP_RECT, mTaskViewSimulator.getOrientationState().getOrientationHandler());
    if (mDeviceState.isFullyGesturalNavMode()) {
        // We can drag all the way to the top of the screen.
        mDragLengthFactor = (float) dp.heightPx / mTransitionDragLength;
    } else {
        mDragLengthFactor = 1 + AnimatorControllerWithResistance.TWO_BUTTON_EXTRA_DRAG_FACTOR;
    }
    PendingAnimation pa = new PendingAnimation(mTransitionDragLength * 2);
    mTaskViewSimulator.addAppToOverviewAnim(pa, LINEAR);
    AnimatorPlaybackController normalController = pa.createPlaybackController();
    mWindowTransitionController = AnimatorControllerWithResistance.createForRecents(normalController, mContext, mTaskViewSimulator.getOrientationState(), mDp, mTaskViewSimulator.recentsViewScale, AnimatedFloat.VALUE, mTaskViewSimulator.recentsViewSecondaryTranslation, AnimatedFloat.VALUE);
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) AnimatorPlaybackController(com.android.launcher3.anim.AnimatorPlaybackController)

Example 43 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Trebuchet by LineageOS.

the class FallbackRecentsView method onGestureAnimationEnd.

/**
 * When the gesture ends and recents view become interactive, 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 onGestureAnimationEnd() {
    super.onGestureAnimationEnd();
    if (mHomeTaskInfo != null) {
        TaskView tv = getTaskView(mHomeTaskInfo.taskId);
        if (tv != null) {
            PendingAnimation pa = createTaskDismissAnimation(tv, true, false, 150);
            pa.addEndListener(e -> setCurrentTask(-1));
            runDismissAnimation(pa);
        }
    }
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) TaskView(com.android.quickstep.views.TaskView)

Example 44 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Trebuchet by LineageOS.

the class StateManager method createAtomicAnimation.

/**
 * Creates an animation representing atomic transitions between the provided states
 */
public AnimatorSet createAtomicAnimation(STATE_TYPE fromState, STATE_TYPE toState, StateAnimationConfig config) {
    PendingAnimation builder = new PendingAnimation(config.duration);
    prepareForAtomicAnimation(fromState, toState, config);
    for (StateHandler handler : mActivity.getStateManager().getStateHandlers()) {
        handler.setStateWithAnimation(toState, config, builder);
    }
    return builder.buildAnim();
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation)

Example 45 with PendingAnimation

use of com.android.launcher3.util.PendingAnimation in project android_packages_apps_Trebuchet by LineageOS.

the class NavBarToHomeTouchController method initCurrentAnimation.

private void initCurrentAnimation() {
    long accuracy = (long) (getShiftRange() * 2);
    final PendingAnimation builder = new PendingAnimation(accuracy);
    if (mStartState.overviewUi) {
        RecentsView recentsView = mLauncher.getOverviewPanel();
        AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder);
        builder.setFloat(mLauncher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_MULTIPLIER, OVERVIEW_TO_HOME_SCRIM_MULTIPLIER, PULLBACK_INTERPOLATOR);
        if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
            builder.addOnFrameCallback(() -> recentsView.redrawLiveTile(false));
        }
    } else if (mStartState == ALL_APPS) {
        AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
        builder.setFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange(), PULLBACK_INTERPOLATOR);
        // Slightly fade out all apps content to further distinguish from scrolling.
        StateAnimationConfig config = new StateAnimationConfig();
        config.duration = accuracy;
        config.setInterpolator(StateAnimationConfig.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
        allAppsController.setAlphas(mEndState, config, builder);
    }
    AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
    if (topView != null) {
        topView.addHintCloseAnim(mPullbackDistance, PULLBACK_INTERPOLATOR, builder);
    }
    mCurrentAnimation = builder.createPlaybackController().setOnCancelRunnable(this::clearState);
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) RecentsView(com.android.quickstep.views.RecentsView) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

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