Search in sources :

Example 6 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.

the class PortraitStatesTouchController method getAllAppsToNormalAnimation.

private StateAnimationConfig getAllAppsToNormalAnimation() {
    StateAnimationConfig builder = new StateAnimationConfig();
    builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(DEACCEL, 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD));
    builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(DEACCEL, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD));
    return builder;
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig)

Example 7 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.

the class PortraitStatesTouchController method getNormalToAllAppsAnimation.

private StateAnimationConfig getNormalToAllAppsAnimation() {
    StateAnimationConfig builder = new StateAnimationConfig();
    builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(ACCEL, ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD));
    builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(ACCEL, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD));
    return builder;
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig)

Example 8 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.

the class PortraitStatesTouchController method initCurrentAnimation.

@Override
protected float initCurrentAnimation() {
    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 StateAnimationConfig config = totalShift == 0 ? new StateAnimationConfig() : getConfigForStates(mFromState, mToState);
    config.duration = maxAccuracy;
    if (mCurrentAnimation != null) {
        mCurrentAnimation.getTarget().removeListener(mClearStateOnCancelListener);
        mCurrentAnimation.dispatchOnCancel();
    }
    mGoingBetweenStates = true;
    if (mFromState == OVERVIEW && mToState == NORMAL && mOverviewPortraitStateTouchHelper.shouldSwipeDownReturnToApp()) {
        // Reset the state manager, when changing the interaction mode
        mLauncher.getStateManager().goToState(OVERVIEW, false);
        mGoingBetweenStates = false;
        mCurrentAnimation = mOverviewPortraitStateTouchHelper.createSwipeDownToTaskAppAnimation(maxAccuracy, Interpolators.LINEAR).createPlaybackController();
        mLauncher.getStateManager().setCurrentUserControlledAnimation(mCurrentAnimation);
        RecentsView recentsView = mLauncher.getOverviewPanel();
        totalShift = LayoutUtils.getShelfTrackingDistance(mLauncher, mLauncher.getDeviceProfile(), recentsView.getPagedOrientationHandler());
    } else {
        mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, config);
    }
    mCurrentAnimation.getTarget().addListener(mClearStateOnCancelListener);
    if (totalShift == 0) {
        totalShift = Math.signum(mFromState.ordinal - mToState.ordinal) * OverviewState.getDefaultSwipeHeight(mLauncher);
    }
    return 1 / totalShift;
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) RecentsView(com.android.quickstep.views.RecentsView)

Example 9 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickSwitchTouchController method initCurrentAnimation.

@Override
protected float initCurrentAnimation() {
    StateAnimationConfig config = new StateAnimationConfig();
    setupInterpolators(config);
    config.duration = (long) (getShiftRange() * 2);
    // Set RecentView's initial properties for coming in from the side.
    RECENTS_SCALE_PROPERTY.set(mOverviewPanel, QUICK_SWITCH.getOverviewScaleAndOffset(mLauncher)[0] * 0.85f);
    ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mOverviewPanel, 1f);
    mOverviewPanel.setContentAlpha(1);
    mCurrentAnimation = mLauncher.getStateManager().createAnimationToNewWorkspace(mToState, config);
    mCurrentAnimation.getTarget().addListener(mClearStateOnCancelListener);
    mCurrentAnimation.getAnimationPlayer().addUpdateListener(valueAnimator -> updateFullscreenProgress((Float) valueAnimator.getAnimatedValue()));
    return 1 / getShiftRange();
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig)

Example 10 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherTaskbarUIController method createAnimToLauncher.

/**
 * Create Taskbar animation when going from an app to Launcher.
 * @param toState If known, the state we will end up in when reaching Launcher.
 */
public Animator createAnimToLauncher(@Nullable LauncherState toState, long duration) {
    PendingAnimation anim = new PendingAnimation(duration);
    anim.add(mTaskbarAnimationController.createAnimToBackgroundAlpha(0, duration));
    if (toState != null) {
        mTaskbarStateHandler.setStateWithAnimation(toState, new StateAnimationConfig(), anim);
    }
    anim.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationStart(Animator animation) {
            mIsAnimatingToLauncher = true;
            mTaskbarView.setHolesAllowedInLayout(true);
            mTaskbarView.updateHotseatItemsVisibility();
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            mIsAnimatingToLauncher = false;
            setTaskbarViewVisible(false);
        }
    });
    return anim.buildAnim();
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) Animator(android.animation.Animator) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter)

Aggregations

StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)108 PendingAnimation (com.android.launcher3.anim.PendingAnimation)26 LauncherState (com.android.launcher3.LauncherState)25 RecentsView (com.android.quickstep.views.RecentsView)24 Animator (android.animation.Animator)16 ValueAnimator (android.animation.ValueAnimator)13 Interpolator (android.view.animation.Interpolator)12 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)9 AnimatorSet (android.animation.AnimatorSet)8 AllAppsTransitionController (com.android.launcher3.allapps.AllAppsTransitionController)8 AnimationSuccessListener (com.android.launcher3.anim.AnimationSuccessListener)7 AbstractFloatingView (com.android.launcher3.AbstractFloatingView)6 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)6 CellLayout (com.android.launcher3.CellLayout)6 Hotseat (com.android.launcher3.Hotseat)6 Workspace (com.android.launcher3.Workspace)6 DepthController (com.android.launcher3.statehandlers.DepthController)6 VISIBLE (android.view.View.VISIBLE)5 HINT_STATE (com.android.launcher3.LauncherState.HINT_STATE)5 HINT_STATE_TWO_BUTTON (com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON)5