Search in sources :

Example 81 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_404Launcher by P-404.

the class AllAppsTransitionController method setState.

/**
 * Sets the vertical transition progress to {@param state} and updates all the dependent UI
 * accordingly.
 */
@Override
public void setState(LauncherState state) {
    setProgress(state.getVerticalProgress(mLauncher));
    setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
    onProgressAnimationEnd();
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig)

Example 82 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_404Launcher by P-404.

the class WorkspaceStateTransitionAnimation method setWorkspaceProperty.

/**
 * Starts a transition animation for the workspace.
 */
private void setWorkspaceProperty(LauncherState state, PropertySetter propertySetter, StateAnimationConfig config) {
    ScaleAndTranslation scaleAndTranslation = state.getWorkspaceScaleAndTranslation(mLauncher);
    ScaleAndTranslation hotseatScaleAndTranslation = state.getHotseatScaleAndTranslation(mLauncher);
    mNewScale = scaleAndTranslation.scale;
    PageAlphaProvider pageAlphaProvider = state.getWorkspacePageAlphaProvider(mLauncher);
    final int childCount = mWorkspace.getChildCount();
    for (int i = 0; i < childCount; i++) {
        applyChildState(state, (CellLayout) mWorkspace.getChildAt(i), i, pageAlphaProvider, propertySetter, config);
    }
    int elements = state.getVisibleElements(mLauncher);
    Interpolator fadeInterpolator = config.getInterpolator(ANIM_WORKSPACE_FADE, pageAlphaProvider.interpolator);
    Hotseat hotseat = mWorkspace.getHotseat();
    Interpolator scaleInterpolator = config.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
    LauncherState fromState = mLauncher.getStateManager().getState();
    boolean shouldSpring = propertySetter instanceof PendingAnimation && fromState == HINT_STATE && state == NORMAL;
    if (shouldSpring) {
        ((PendingAnimation) propertySetter).add(getSpringScaleAnimator(mLauncher, mWorkspace, mNewScale));
    } else {
        propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
    }
    mWorkspace.setPivotToScaleWithSelf(hotseat);
    float hotseatScale = hotseatScaleAndTranslation.scale;
    if (shouldSpring) {
        PendingAnimation pa = (PendingAnimation) propertySetter;
        pa.add(getSpringScaleAnimator(mLauncher, hotseat, hotseatScale));
    } else {
        Interpolator hotseatScaleInterpolator = config.getInterpolator(ANIM_HOTSEAT_SCALE, scaleInterpolator);
        propertySetter.setFloat(hotseat, SCALE_PROPERTY, hotseatScale, hotseatScaleInterpolator);
    }
    float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
    propertySetter.setViewAlpha(hotseat, hotseatIconsAlpha, fadeInterpolator);
    float workspacePageIndicatorAlpha = (elements & WORKSPACE_PAGE_INDICATOR) != 0 ? 1 : 0;
    propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(), workspacePageIndicatorAlpha, fadeInterpolator);
    Interpolator translationInterpolator = config.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
    propertySetter.setFloat(mWorkspace, VIEW_TRANSLATE_X, scaleAndTranslation.translationX, translationInterpolator);
    propertySetter.setFloat(mWorkspace, VIEW_TRANSLATE_Y, scaleAndTranslation.translationY, translationInterpolator);
    Interpolator hotseatTranslationInterpolator = config.getInterpolator(ANIM_HOTSEAT_TRANSLATE, translationInterpolator);
    propertySetter.setFloat(hotseat, VIEW_TRANSLATE_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
    propertySetter.setFloat(mWorkspace.getPageIndicator(), VIEW_TRANSLATE_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
    if (!config.hasAnimationFlag(SKIP_SCRIM)) {
        setScrim(propertySetter, state, config);
    }
}
Also used : ScaleAndTranslation(com.android.launcher3.LauncherState.ScaleAndTranslation) PendingAnimation(com.android.launcher3.anim.PendingAnimation) PageAlphaProvider(com.android.launcher3.LauncherState.PageAlphaProvider) Interpolator(android.view.animation.Interpolator)

Example 83 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_404Launcher by P-404.

the class WorkspaceRevealAnim method prepareToAnimate.

/**
 * Setup workspace with 0 duration.
 */
private void prepareToAnimate(Launcher launcher, boolean animateOverviewScrim) {
    StateAnimationConfig config = new StateAnimationConfig();
    config.animFlags = SKIP_OVERVIEW | SKIP_DEPTH_CONTROLLER | SKIP_SCRIM;
    config.duration = 0;
    // setRecentsAttachedToAppWindow() will animate recents out.
    launcher.getStateManager().createAtomicAnimation(BACKGROUND_APP, NORMAL, config).start();
    // Stop scrolling so that it doesn't interfere with the translation offscreen.
    launcher.<RecentsView>getOverviewPanel().forceFinishScroller();
    if (animateOverviewScrim) {
        launcher.getWorkspace().getStateTransitionAnimation().setScrim(NO_ANIM_PROPERTY_SETTER, BACKGROUND_APP, config);
    }
}
Also used : StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig)

Example 84 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_404Launcher by P-404.

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 85 with StateAnimationConfig

use of com.android.launcher3.states.StateAnimationConfig in project android_packages_apps_404Launcher by P-404.

the class OverviewToHomeAnim method animateWithVelocity.

/**
 * Starts the animation. If velocity < 0 (i.e. upwards), also plays a
 * {@link WorkspaceRevealAnim}.
 */
public void animateWithVelocity(float velocity) {
    StateManager<LauncherState> stateManager = mLauncher.getStateManager();
    LauncherState startState = stateManager.getState();
    if (startState != OVERVIEW) {
        Log.e(TAG, "animateFromOverviewToHome: unexpected start state " + startState);
    }
    AnimatorSet anim = new AnimatorSet();
    boolean playWorkspaceRevealAnim = velocity < 0;
    if (playWorkspaceRevealAnim) {
        WorkspaceRevealAnim workspaceRevealAnim = new WorkspaceRevealAnim(mLauncher, false);
        workspaceRevealAnim.addAnimatorListener(new AnimationSuccessListener() {

            @Override
            public void onAnimationSuccess(Animator animator) {
                mIsHomeStaggeredAnimFinished = true;
                maybeOverviewToHomeAnimComplete();
            }
        });
        anim.play(workspaceRevealAnim.getAnimators());
    } else {
        mIsHomeStaggeredAnimFinished = true;
    }
    StateAnimationConfig config = new StateAnimationConfig();
    if (playWorkspaceRevealAnim) {
        // WorkspaceRevealAnim handles the depth, so don't interfere.
        config.animFlags |= StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
    }
    config.duration = startState.getTransitionDuration(mLauncher);
    AnimatorSet stateAnim = stateManager.createAtomicAnimation(startState, NORMAL, config);
    stateAnim.addListener(new AnimationSuccessListener() {

        @Override
        public void onAnimationSuccess(Animator animator) {
            mIsOverviewHidden = true;
            maybeOverviewToHomeAnimComplete();
        }
    });
    anim.play(stateAnim);
    stateManager.setCurrentAnimation(anim, NORMAL);
    anim.start();
}
Also used : LauncherState(com.android.launcher3.LauncherState) Animator(android.animation.Animator) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) AnimatorSet(android.animation.AnimatorSet) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener)

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