Search in sources :

Example 1 with AnimationConfig

use of com.android.launcher3.LauncherStateManager.AnimationConfig in project Neo-Launcher by NeoApplications.

the class RecentsViewStateController method setStateWithAnimationInternal.

@Override
void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull AnimatorSetBuilder builder, @NonNull AnimationConfig config) {
    super.setStateWithAnimationInternal(toState, builder, config);
    if (!toState.overviewUi) {
        builder.addOnFinishRunnable(mRecentsView::resetTaskVisuals);
    }
    if (toState.overviewUi) {
        ValueAnimator updateAnim = ValueAnimator.ofFloat(0, 1);
        updateAnim.addUpdateListener(valueAnimator -> {
            // While animating into recents, update the visible task data as needed
            mRecentsView.loadVisibleTaskData();
        });
        updateAnim.setDuration(config.duration);
        builder.play(updateAnim);
        mRecentsView.updateEmptyMessage();
    }
    PropertySetter propertySetter = config.getPropertySetter(builder);
    setAlphas(propertySetter, toState.getVisibleElements(mLauncher));
    float fullscreenProgress = toState.getOverviewFullscreenProgress();
    propertySetter.setFloat(mRecentsView, FULLSCREEN_PROGRESS, fullscreenProgress, LINEAR);
}
Also used : PropertySetter(com.android.launcher3.anim.PropertySetter) ValueAnimator(android.animation.ValueAnimator)

Example 2 with AnimationConfig

use of com.android.launcher3.LauncherStateManager.AnimationConfig in project Neo-Launcher by NeoApplications.

the class NavBarToHomeTouchController method initCurrentAnimation.

private void initCurrentAnimation() {
    long accuracy = (long) (getShiftRange() * 2);
    final AnimatorSet anim = new AnimatorSet();
    if (mStartState == OVERVIEW) {
        RecentsView recentsView = mLauncher.getOverviewPanel();
        float pullbackDist = mPullbackDistance;
        if (!recentsView.isRtl()) {
            pullbackDist = -pullbackDist;
        }
        Animator pullback = ObjectAnimator.ofFloat(recentsView, TRANSLATION_X, pullbackDist);
        pullback.setInterpolator(PULLBACK_INTERPOLATOR);
        anim.play(pullback);
    } else if (mStartState == ALL_APPS) {
        AnimatorSetBuilder builder = new AnimatorSetBuilder();
        AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
        Animator allAppsProgress = ObjectAnimator.ofFloat(allAppsController, ALL_APPS_PROGRESS, -mPullbackDistance / allAppsController.getShiftRange());
        allAppsProgress.setInterpolator(PULLBACK_INTERPOLATOR);
        builder.play(allAppsProgress);
        // Slightly fade out all apps content to further distinguish from scrolling.
        builder.setInterpolator(AnimatorSetBuilder.ANIM_ALL_APPS_FADE, Interpolators.mapToProgress(PULLBACK_INTERPOLATOR, 0, 0.5f));
        AnimationConfig config = new AnimationConfig();
        config.duration = accuracy;
        allAppsController.setAlphas(mEndState.getVisibleElements(mLauncher), config, builder);
        anim.play(builder.build());
    }
    AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mLauncher);
    if (topView != null) {
        Animator hintCloseAnim = topView.createHintCloseAnim(mPullbackDistance);
        if (hintCloseAnim != null) {
            hintCloseAnim.setInterpolator(PULLBACK_INTERPOLATOR);
            anim.play(hintCloseAnim);
        }
    }
    anim.setDuration(accuracy);
    mCurrentAnimation = AnimatorPlaybackController.wrap(anim, accuracy, this::clearState);
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) RecentsView(com.android.quickstep.views.RecentsView) AnimatorSet(android.animation.AnimatorSet) AnimationConfig(com.android.launcher3.LauncherStateManager.AnimationConfig) AbstractFloatingView(com.android.launcher3.AbstractFloatingView)

Example 3 with AnimationConfig

use of com.android.launcher3.LauncherStateManager.AnimationConfig in project Neo-Launcher by NeoApplications.

the class NoButtonQuickSwitchTouchController method onMotionPauseChanged.

@Override
public void onMotionPauseChanged(boolean isPaused) {
    ShelfAnimState shelfState = isPaused ? PEEK : HIDE;
    if (shelfState == PEEK) {
        // Some shelf elements (e.g. qsb) were hidden, but we need them visible when peeking.
        AnimatorSetBuilder builder = new AnimatorSetBuilder();
        AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
        allAppsController.setAlphas(NORMAL.getVisibleElements(mLauncher), new AnimationConfig(), builder);
        builder.build().setDuration(0).start();
        if ((OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0) {
            // Hotseat was hidden, but we need it visible when peeking.
            mLauncher.getHotseat().setAlpha(1);
        }
    }
    mShelfPeekAnim.setShelfState(shelfState, ShelfPeekAnim.INTERPOLATOR, ShelfPeekAnim.DURATION);
    VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) ShelfAnimState(com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState) AnimationConfig(com.android.launcher3.LauncherStateManager.AnimationConfig)

Example 4 with AnimationConfig

use of com.android.launcher3.LauncherStateManager.AnimationConfig 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 5 with AnimationConfig

use of com.android.launcher3.LauncherStateManager.AnimationConfig 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

Interpolator (android.view.animation.Interpolator)4 PropertySetter (com.android.launcher3.anim.PropertySetter)4 Animator (android.animation.Animator)3 AnimationConfig (com.android.launcher3.LauncherStateManager.AnimationConfig)3 AnimatorSetBuilder (com.android.launcher3.anim.AnimatorSetBuilder)3 ObjectAnimator (android.animation.ObjectAnimator)2 ValueAnimator (android.animation.ValueAnimator)2 ScaleAndTranslation (com.android.launcher3.LauncherState.ScaleAndTranslation)2 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)2 SpringObjectAnimator (com.android.launcher3.anim.SpringObjectAnimator)2 AnimatorSet (android.animation.AnimatorSet)1 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)1 PageAlphaProvider (com.android.launcher3.LauncherState.PageAlphaProvider)1 DragLayer (com.android.launcher3.dragndrop.DragLayer)1 OverviewScrim (com.android.launcher3.graphics.OverviewScrim)1 ShelfAnimState (com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState)1 RecentsView (com.android.quickstep.views.RecentsView)1 OptionsPanel (com.saggitt.omega.views.OptionsPanel)1