Search in sources :

Example 6 with AnimationConfig

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

the class AllAppsTransitionController method setAlphas.

public void setAlphas(int visibleElements, AnimationConfig config, AnimatorSetBuilder builder) {
    PropertySetter setter = config == null ? NO_ANIM_PROPERTY_SETTER : config.getPropertySetter(builder);
    boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0;
    boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0;
    Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
    Interpolator headerFade = builder.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade);
    setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade);
    setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade);
    mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasAllAppsContent, setter, headerFade, allAppsFade);
    mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade);
    setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA, (visibleElements & VERTICAL_SWIPE_INDICATOR) != 0 ? 255 : 0, allAppsFade);
}
Also used : PropertySetter(com.android.launcher3.anim.PropertySetter) Interpolator(android.view.animation.Interpolator)

Example 7 with AnimationConfig

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

the class WorkspaceStateTransitionAnimation method setWorkspaceProperty.

/**
 * Starts a transition animation for the workspace.
 */
private void setWorkspaceProperty(LauncherState state, PropertySetter propertySetter, AnimatorSetBuilder builder, AnimationConfig 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, builder, config);
    }
    int elements = state.getVisibleElements(mLauncher);
    Interpolator fadeInterpolator = builder.getInterpolator(ANIM_WORKSPACE_FADE, pageAlphaProvider.interpolator);
    boolean playAtomicComponent = config.playAtomicOverviewScaleComponent();
    Hotseat hotseat = mWorkspace.getHotseat();
    if (playAtomicComponent) {
        Interpolator scaleInterpolator = builder.getInterpolator(ANIM_WORKSPACE_SCALE, ZOOM_OUT);
        propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
        if (!hotseat.getRotationMode().isTransposed) {
            // Set the hotseat's pivot point to match the workspace's, so that it scales
            // together. Since both hotseat and workspace can move, transform the point
            // manually instead of using dragLayer.getDescendantCoordRelativeToSelf and
            // related methods.
            /*hotseat.setPivotY(mWorkspace.getPivotY() + mWorkspace.getTop() - hotseat.getTop());
                hotseat.setPivotX(mWorkspace.getPivotX()
                        + mWorkspace.getLeft() - hotseat.getLeft());*/
            DragLayer dragLayer = mLauncher.getDragLayer();
            float[] workspacePivot = new float[] { mWorkspace.getPivotX(), mWorkspace.getPivotY() };
            dragLayer.getDescendantCoordRelativeToSelf(mWorkspace, workspacePivot);
            dragLayer.mapCoordInSelfToDescendant(hotseat, workspacePivot);
            hotseat.setPivotX(workspacePivot[0]);
            hotseat.setPivotY(workspacePivot[1]);
        }
        float hotseatScale = hotseatScaleAndTranslation.scale;
        Interpolator hotseatScaleInterpolator = builder.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);
        propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(), hotseatIconsAlpha, fadeInterpolator);
    }
    // Set options view
    OptionsPanel optionsPanel = OmegaLauncher.getLauncher(mLauncher).getOptionsView();
    propertySetter.setViewAlpha(optionsPanel, (elements & OPTIONS_VIEW) != 0 ? 1 : 0, fadeInterpolator);
    if (!config.playNonAtomicComponent()) {
        // Only the alpha and scale, handled above, are included in the atomic animation.
        return;
    }
    Interpolator translationInterpolator = !playAtomicComponent ? LINEAR : builder.getInterpolator(ANIM_WORKSPACE_TRANSLATE, ZOOM_OUT);
    propertySetter.setFloat(mWorkspace, View.TRANSLATION_X, scaleAndTranslation.translationX, translationInterpolator);
    propertySetter.setFloat(mWorkspace, View.TRANSLATION_Y, scaleAndTranslation.translationY, translationInterpolator);
    Interpolator hotseatTranslationInterpolator = builder.getInterpolator(ANIM_HOTSEAT_TRANSLATE, translationInterpolator);
    propertySetter.setFloat(hotseat, View.TRANSLATION_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
    propertySetter.setFloat(mWorkspace.getPageIndicator(), View.TRANSLATION_Y, hotseatScaleAndTranslation.translationY, hotseatTranslationInterpolator);
    setScrim(propertySetter, state);
}
Also used : ScaleAndTranslation(com.android.launcher3.LauncherState.ScaleAndTranslation) DragLayer(com.android.launcher3.dragndrop.DragLayer) PageAlphaProvider(com.android.launcher3.LauncherState.PageAlphaProvider) Interpolator(android.view.animation.Interpolator) OptionsPanel(com.saggitt.omega.views.OptionsPanel)

Example 8 with AnimationConfig

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

the class AllAppsTransitionController method setStateWithAnimation.

/**
 * Creates an animation which updates the vertical transition progress and updates all the
 * dependent UI using various animation events
 */
@Override
public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder, AnimationConfig config) {
    float targetProgress = toState.getVerticalProgress(mLauncher);
    if (Float.compare(mProgress, targetProgress) == 0) {
        setAlphas(toState, config, builder);
        // Fail fast
        onProgressAnimationEnd();
        return;
    }
    if (!config.playNonAtomicComponent()) {
        // There is no atomic component for the all apps transition, so just return early.
        return;
    }
    Interpolator interpolator = config.userControlled ? LINEAR : toState == OVERVIEW ? builder.getInterpolator(ANIM_OVERVIEW_SCALE, FAST_OUT_SLOW_IN) : FAST_OUT_SLOW_IN;
    Animator anim = createSpringAnimation(mProgress, targetProgress);
    anim.setDuration(config.duration);
    anim.setInterpolator(builder.getInterpolator(ANIM_VERTICAL_PROGRESS, interpolator));
    anim.addListener(getProgressAnimatorListener());
    builder.play(anim);
    setAlphas(toState, config, builder);
}
Also used : Animator(android.animation.Animator) SpringObjectAnimator(com.android.launcher3.anim.SpringObjectAnimator) Interpolator(android.view.animation.Interpolator)

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