Search in sources :

Example 6 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder in project Neo-Launcher by NeoApplications.

the class NoButtonQuickSwitchTouchController method setupAnimators.

private void setupAnimators() {
    // Animate the non-overview components (e.g. workspace, shelf) out of the way.
    AnimatorSetBuilder nonOverviewBuilder = new AnimatorSetBuilder();
    nonOverviewBuilder.setInterpolator(ANIM_WORKSPACE_FADE, FADE_OUT_INTERPOLATOR);
    nonOverviewBuilder.setInterpolator(ANIM_ALL_APPS_FADE, FADE_OUT_INTERPOLATOR);
    nonOverviewBuilder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, TRANSLATE_OUT_INTERPOLATOR);
    nonOverviewBuilder.setInterpolator(ANIM_VERTICAL_PROGRESS, TRANSLATE_OUT_INTERPOLATOR);
    updateNonOverviewAnim(QUICK_SWITCH, nonOverviewBuilder, ANIM_ALL);
    mNonOverviewAnim.dispatchOnStart();
    setupOverviewAnimators();
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder)

Example 7 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder in project Neo-Launcher by NeoApplications.

the class BaseRecentsViewStateController method setStateWithAnimationInternal.

/**
 * Core logic for animating the recents view UI.
 *
 * @param toState state to animate to
 * @param builder animator set builder
 * @param config current animation config
 */
void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull AnimatorSetBuilder builder, @NonNull AnimationConfig config) {
    PropertySetter setter = config.getPropertySetter(builder);
    ScaleAndTranslation scaleAndTranslation = toState.getOverviewScaleAndTranslation(mLauncher);
    Interpolator scaleInterpolator = builder.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR);
    setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleAndTranslation.scale, scaleInterpolator);
    Interpolator translateXInterpolator = builder.getInterpolator(ANIM_OVERVIEW_TRANSLATE_X, LINEAR);
    Interpolator translateYInterpolator = builder.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR);
    float translationX = scaleAndTranslation.translationX;
    if (mRecentsView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
        translationX = -translationX;
    }
    setter.setFloat(mRecentsView, View.TRANSLATION_X, translationX, translateXInterpolator);
    setter.setFloat(mRecentsView, View.TRANSLATION_Y, scaleAndTranslation.translationY, translateYInterpolator);
    setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, builder.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT));
    OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim();
    setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher), builder.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR));
}
Also used : ScaleAndTranslation(com.android.launcher3.LauncherState.ScaleAndTranslation) OverviewScrim(com.android.launcher3.graphics.OverviewScrim) PropertySetter(com.android.launcher3.anim.PropertySetter) Interpolator(android.view.animation.Interpolator)

Example 8 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder in project Neo-Launcher by NeoApplications.

the class PortraitStatesTouchController method getOverviewToAllAppsAnimation.

public static AnimatorSetBuilder getOverviewToAllAppsAnimation() {
    AnimatorSetBuilder builder = new AnimatorSetBuilder();
    builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL, 0, ALL_APPS_CONTENT_FADE_THRESHOLD));
    builder.setInterpolator(ANIM_OVERVIEW_FADE, Interpolators.clampToProgress(DEACCEL, RECENTS_FADE_THRESHOLD, 1));
    return builder;
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder)

Example 9 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder in project Neo-Launcher by NeoApplications.

the class PortraitStatesTouchController method initCurrentAnimation.

@Override
protected float initCurrentAnimation(@AnimationComponents int animComponents) {
    float range = getShiftRange();
    long maxAccuracy = (long) (2 * range);
    float startVerticalShift = mFromState.getVerticalProgress(mLauncher) * range;
    float endVerticalShift = mToState.getVerticalProgress(mLauncher) * range;
    float totalShift = endVerticalShift - startVerticalShift;
    final AnimatorSetBuilder builder = totalShift == 0 ? new AnimatorSetBuilder() : getAnimatorSetBuilderForStates(mFromState, mToState);
    updateAnimatorBuilderOnReinit(builder);
    cancelPendingAnim();
    if (mFromState == OVERVIEW && mToState == NORMAL && mOverviewPortraitStateTouchHelper.shouldSwipeDownReturnToApp()) {
        // Reset the state manager, when changing the interaction mode
        mLauncher.getStateManager().goToState(OVERVIEW, false);
        mPendingAnimation = mOverviewPortraitStateTouchHelper.createSwipeDownToTaskAppAnimation(maxAccuracy);
        mPendingAnimation.anim.setInterpolator(Interpolators.LINEAR);
        Runnable onCancelRunnable = () -> {
            cancelPendingAnim();
            clearState();
        };
        mCurrentAnimation = AnimatorPlaybackController.wrap(mPendingAnimation.anim, maxAccuracy, onCancelRunnable);
        mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation);
        totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher, mLauncher.getDeviceProfile());
    } else {
        mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, builder, maxAccuracy, this::clearState, animComponents);
    }
    if (totalShift == 0) {
        totalShift = Math.signum(mFromState.ordinal - mToState.ordinal) * OverviewState.getDefaultSwipeHeight(mLauncher);
    }
    return 1 / totalShift;
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder)

Example 10 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder in project Neo-Launcher by NeoApplications.

the class StaggeredWorkspaceAnim method addScrimAnimationForState.

private void addScrimAnimationForState(Launcher launcher, LauncherState state, long duration) {
    AnimatorSetBuilder scrimAnimBuilder = new AnimatorSetBuilder();
    AnimationConfig scrimAnimConfig = new AnimationConfig();
    scrimAnimConfig.duration = duration;
    PropertySetter scrimPropertySetter = scrimAnimConfig.getPropertySetter(scrimAnimBuilder);
    launcher.getWorkspace().getStateTransitionAnimation().setScrim(scrimPropertySetter, state);
    mAnimators.add(scrimAnimBuilder.build());
    Animator fadeOverviewScrim = ObjectAnimator.ofFloat(launcher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, state.getOverviewScrimAlpha(launcher));
    fadeOverviewScrim.setDuration(duration);
    mAnimators.add(fadeOverviewScrim);
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder) Animator(android.animation.Animator) SpringObjectAnimator(com.android.launcher3.anim.SpringObjectAnimator) ObjectAnimator(android.animation.ObjectAnimator) PropertySetter(com.android.launcher3.anim.PropertySetter) AnimationConfig(com.android.launcher3.LauncherStateManager.AnimationConfig)

Aggregations

AnimatorSetBuilder (com.android.launcher3.anim.AnimatorSetBuilder)16 Animator (android.animation.Animator)7 AnimatorSet (android.animation.AnimatorSet)4 Interpolator (android.view.animation.Interpolator)4 PropertySetter (com.android.launcher3.anim.PropertySetter)4 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)3 ObjectAnimator (android.animation.ObjectAnimator)3 ValueAnimator (android.animation.ValueAnimator)3 AnimationConfig (com.android.launcher3.LauncherStateManager.AnimationConfig)3 RecentsView (com.android.quickstep.views.RecentsView)3 LauncherState (com.android.launcher3.LauncherState)2 ScaleAndTranslation (com.android.launcher3.LauncherState.ScaleAndTranslation)2 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)2 SpringObjectAnimator (com.android.launcher3.anim.SpringObjectAnimator)2 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)1 PageAlphaProvider (com.android.launcher3.LauncherState.PageAlphaProvider)1 LauncherStateManager (com.android.launcher3.LauncherStateManager)1 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)1 DragLayer (com.android.launcher3.dragndrop.DragLayer)1 OverviewScrim (com.android.launcher3.graphics.OverviewScrim)1