Search in sources :

Example 21 with PropertySetter

use of com.android.launcher3.anim.PropertySetter in project android_packages_apps_Launcher3 by crdroidandroid.

the class WorkspaceStateTransitionAnimation method setScrim.

public void setScrim(PropertySetter propertySetter, LauncherState state, StateAnimationConfig config) {
    Scrim workspaceDragScrim = mLauncher.getDragLayer().getWorkspaceDragScrim();
    propertySetter.setFloat(workspaceDragScrim, SCRIM_PROGRESS, state.getWorkspaceBackgroundAlpha(mLauncher), LINEAR);
    SysUiScrim sysUiScrim = mLauncher.getRootView().getSysUiScrim();
    propertySetter.setFloat(sysUiScrim, SYSUI_PROGRESS, state.hasFlag(FLAG_HAS_SYS_UI_SCRIM) ? 1 : 0, LINEAR);
    propertySetter.setViewBackgroundColor(mLauncher.getScrimView(), state.getWorkspaceScrimColor(mLauncher), config.getInterpolator(ANIM_SCRIM_FADE, ACCEL_2));
}
Also used : SysUiScrim(com.android.launcher3.graphics.SysUiScrim) Scrim(com.android.launcher3.graphics.Scrim) SysUiScrim(com.android.launcher3.graphics.SysUiScrim)

Example 22 with PropertySetter

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

the class WorkspaceStateTransitionAnimation method setScrim.

public void setScrim(PropertySetter propertySetter, LauncherState state) {
    WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
    propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher), LINEAR);
    propertySetter.setFloat(scrim, SYSUI_PROGRESS, state.hasSysUiScrim ? 1 : 0, LINEAR);
    OmegaBackgroundView background = OmegaLauncher.getLauncher(mLauncher).getBackground();
    propertySetter.setFloat(background.getBlurAlphas().getProperty(ALPHA_INDEX_STATE), InvertedMultiValueAlpha.VALUE, state.getWorkspaceBlurAlpha(mLauncher), LINEAR);
}
Also used : OmegaBackgroundView(com.saggitt.omega.views.OmegaBackgroundView) WorkspaceAndHotseatScrim(com.android.launcher3.graphics.WorkspaceAndHotseatScrim)

Example 23 with PropertySetter

use of com.android.launcher3.anim.PropertySetter in project android_packages_apps_Launcher3 by ArrowOS.

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)

Aggregations

Interpolator (android.view.animation.Interpolator)14 ScaleAndTranslation (com.android.launcher3.LauncherState.ScaleAndTranslation)8 PageAlphaProvider (com.android.launcher3.LauncherState.PageAlphaProvider)7 PendingAnimation (com.android.launcher3.anim.PendingAnimation)6 Scrim (com.android.launcher3.graphics.Scrim)5 SysUiScrim (com.android.launcher3.graphics.SysUiScrim)5 SpringLoadedState (com.android.launcher3.states.SpringLoadedState)5 PropertySetter (com.android.launcher3.anim.PropertySetter)4 WorkspaceAndHotseatScrim (com.android.launcher3.graphics.WorkspaceAndHotseatScrim)2 Animator (android.animation.Animator)1 ObjectAnimator (android.animation.ObjectAnimator)1 ValueAnimator (android.animation.ValueAnimator)1 View (android.view.View)1 AnimationConfig (com.android.launcher3.LauncherStateManager.AnimationConfig)1 AllAppsContainerView (com.android.launcher3.allapps.AllAppsContainerView)1 AnimatorSetBuilder (com.android.launcher3.anim.AnimatorSetBuilder)1 SpringObjectAnimator (com.android.launcher3.anim.SpringObjectAnimator)1 DragLayer (com.android.launcher3.dragndrop.DragLayer)1 OverviewScrim (com.android.launcher3.graphics.OverviewScrim)1 OmegaBackgroundView (com.saggitt.omega.views.OmegaBackgroundView)1