Search in sources :

Example 1 with AnimatorSetBuilder

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

the class QuickSwitchTouchController method initCurrentAnimation.

@Override
protected float initCurrentAnimation(int animComponents) {
    AnimatorSetBuilder animatorSetBuilder = new AnimatorSetBuilder();
    setupInterpolators(animatorSetBuilder);
    long accuracy = (long) (getShiftRange() * 2);
    mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, animatorSetBuilder, accuracy, this::clearState, LauncherStateManager.ANIM_ALL);
    mCurrentAnimation.getAnimationPlayer().addUpdateListener(valueAnimator -> {
        updateFullscreenProgress((Float) valueAnimator.getAnimatedValue());
    });
    return 1 / getShiftRange();
}
Also used : AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder)

Example 2 with AnimatorSetBuilder

use of com.android.launcher3.anim.AnimatorSetBuilder 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 3 with AnimatorSetBuilder

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

the class FlingAndHoldTouchController method onDragStart.

@Override
public void onDragStart(boolean start) {
    mMotionPauseDetector.clear();
    super.onDragStart(start);
    mGoingHome = mFromNavBar && mStartState == NORMAL;
    if (handlingOverviewAnim()) {
        mMotionPauseDetector.setOnMotionPauseListener(isPaused -> {
            RecentsView recentsView = mLauncher.getOverviewPanel();
            recentsView.setOverviewStateEnabled(isPaused);
            if (mPeekAnim != null) {
                mPeekAnim.cancel();
            }
            LauncherState fromState = isPaused ? NORMAL : OVERVIEW_PEEK;
            LauncherState toState = isPaused ? OVERVIEW_PEEK : NORMAL;
            long peekDuration = isPaused ? PEEK_IN_ANIM_DURATION : PEEK_OUT_ANIM_DURATION;
            mPeekAnim = mLauncher.getStateManager().createAtomicAnimation(fromState, toState, new AnimatorSetBuilder(), ATOMIC_OVERVIEW_PEEK_COMPONENT, peekDuration);
            mPeekAnim.addListener(new AnimatorListenerAdapter() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    mPeekAnim = null;
                }
            });
            mPeekAnim.start();
            // VibratorWrapper.INSTANCE.get(mLauncher).vibrate(OVERVIEW_HAPTIC);
            recentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
            mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(isPaused ? 0 : 1, peekDuration, 0);
        });
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) AnimatorSetBuilder(com.android.launcher3.anim.AnimatorSetBuilder) Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) RecentsView(com.android.quickstep.views.RecentsView)

Example 4 with AnimatorSetBuilder

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

use of com.android.launcher3.anim.AnimatorSetBuilder 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)

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