Search in sources :

Example 1 with ACCEL_2

use of com.android.launcher3.anim.Interpolators.ACCEL_2 in project android_packages_apps_Launcher3 by AOSPA.

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 2 with ACCEL_2

use of com.android.launcher3.anim.Interpolators.ACCEL_2 in project android_packages_apps_Trebuchet by LineageOS.

the class RecentsView method addDismissedTaskAnimations.

private void addDismissedTaskAnimations(View taskView, long duration, PendingAnimation anim) {
    // Use setFloat instead of setViewAlpha as we want to keep the view visible even when it's
    // alpha is set to 0 so that it can be recycled in the view pool properly
    anim.setFloat(taskView, VIEW_ALPHA, 0, ACCEL_2);
    FloatProperty<View> secondaryViewTranslate = mOrientationHandler.getSecondaryViewTranslate();
    int secondaryTaskDimension = mOrientationHandler.getSecondaryDimension(taskView);
    int verticalFactor = mOrientationHandler.getSecondaryTranslationDirectionFactor();
    ResourceProvider rp = DynamicResource.provider(mActivity);
    SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_START).setDampingRatio(rp.getFloat(R.dimen.dismiss_task_trans_y_damping_ratio)).setStiffness(rp.getFloat(R.dimen.dismiss_task_trans_y_stiffness));
    anim.add(ObjectAnimator.ofFloat(taskView, secondaryViewTranslate, verticalFactor * secondaryTaskDimension).setDuration(duration), LINEAR, sp);
}
Also used : SpringProperty(com.android.launcher3.anim.SpringProperty) ResourceProvider(com.android.systemui.plugins.ResourceProvider) View(android.view.View) ListView(android.widget.ListView) PagedView(com.android.launcher3.PagedView) TextPaint(android.text.TextPaint) Point(android.graphics.Point)

Example 3 with ACCEL_2

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

the class LauncherActivityControllerHelper method prepareRecentsUI.

@Override
public AnimationFactory prepareRecentsUI(Launcher activity, boolean activityVisible, boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
    final LauncherState startState = activity.getStateManager().getState();
    LauncherState resetState = startState;
    if (startState.disableRestore) {
        resetState = activity.getStateManager().getRestState();
    }
    activity.getStateManager().setRestState(resetState);
    final LauncherState fromState = animateActivity ? BACKGROUND_APP : OVERVIEW;
    activity.getStateManager().goToState(fromState, false);
    // Since all apps is not visible, we can safely reset the scroll position.
    // This ensures then the next swipe up to all-apps starts from scroll 0.
    activity.getAppsView().reset(false);
    return new AnimationFactory() {

        private final ShelfPeekAnim mShelfAnim = ((QuickstepAppTransitionManagerImpl) activity.getAppTransitionManager()).getShelfPeekAnim();

        private boolean mIsAttachedToWindow;

        @Override
        public void createActivityController(long transitionLength) {
            createActivityControllerInternal(activity, fromState, transitionLength, callback);
            // attached state here as well to ensure recents is shown/hidden appropriately.
            if (SysUINavigationMode.getMode(activity) == Mode.NO_BUTTON) {
                setRecentsAttachedToAppWindow(mIsAttachedToWindow, false);
            }
        }

        @Override
        public void adjustActivityControllerInterpolators() {
            if (mAdjustInterpolatorsRunnable != null) {
                mAdjustInterpolatorsRunnable.run();
            }
        }

        @Override
        public void onTransitionCancelled() {
            activity.getStateManager().goToState(startState, false);
        }

        @Override
        public void setShelfState(ShelfAnimState shelfState, Interpolator interpolator, long duration) {
            mShelfAnim.setShelfState(shelfState, interpolator, duration);
        }

        @Override
        public void setRecentsAttachedToAppWindow(boolean attached, boolean animate) {
            if (mIsAttachedToWindow == attached && animate) {
                return;
            }
            mIsAttachedToWindow = attached;
            LauncherRecentsView recentsView = activity.getOverviewPanel();
            Animator fadeAnim = activity.getStateManager().createStateElementAnimation(INDEX_RECENTS_FADE_ANIM, attached ? 1 : 0);
            int runningTaskIndex = recentsView.getRunningTaskIndex();
            if (runningTaskIndex == recentsView.getTaskViewStartIndex()) {
                // If we are on the first task (we haven't quick switched), translate recents in
                // from the side. Calculate the start translation based on current scale/scroll.
                float currScale = recentsView.getScaleX();
                float scrollOffsetX = recentsView.getScrollOffset();
                float offscreenX = recentsView.getOffscreenTranslationX(currScale);
                float fromTranslationX = attached ? offscreenX - scrollOffsetX : 0;
                float toTranslationX = attached ? 0 : offscreenX - scrollOffsetX;
                activity.getStateManager().cancelStateElementAnimation(INDEX_RECENTS_TRANSLATE_X_ANIM);
                if (!recentsView.isShown() && animate) {
                    recentsView.setTranslationX(fromTranslationX);
                } else {
                    fromTranslationX = recentsView.getTranslationX();
                }
                if (!animate) {
                    recentsView.setTranslationX(toTranslationX);
                } else {
                    activity.getStateManager().createStateElementAnimation(INDEX_RECENTS_TRANSLATE_X_ANIM, fromTranslationX, toTranslationX).start();
                }
                fadeAnim.setInterpolator(attached ? INSTANT : ACCEL_2);
            } else {
                fadeAnim.setInterpolator(ACCEL_DEACCEL);
            }
            fadeAnim.setDuration(animate ? RECENTS_ATTACH_DURATION : 0).start();
        }
    };
}
Also used : LauncherState(com.android.launcher3.LauncherState) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ShelfPeekAnim(com.android.quickstep.util.ShelfPeekAnim) ShelfAnimState(com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState) Interpolator(android.view.animation.Interpolator) TimeInterpolator(android.animation.TimeInterpolator) LauncherRecentsView(com.android.quickstep.views.LauncherRecentsView)

Example 4 with ACCEL_2

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

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 5 with ACCEL_2

use of com.android.launcher3.anim.Interpolators.ACCEL_2 in project android_packages_apps_Launcher3 by ProtonAOSP.

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)

Aggregations

Scrim (com.android.launcher3.graphics.Scrim)5 SysUiScrim (com.android.launcher3.graphics.SysUiScrim)5 Animator (android.animation.Animator)1 ObjectAnimator (android.animation.ObjectAnimator)1 TimeInterpolator (android.animation.TimeInterpolator)1 Point (android.graphics.Point)1 TextPaint (android.text.TextPaint)1 View (android.view.View)1 Interpolator (android.view.animation.Interpolator)1 ListView (android.widget.ListView)1 LauncherState (com.android.launcher3.LauncherState)1 PagedView (com.android.launcher3.PagedView)1 SpringProperty (com.android.launcher3.anim.SpringProperty)1 ShelfPeekAnim (com.android.quickstep.util.ShelfPeekAnim)1 ShelfAnimState (com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState)1 LauncherRecentsView (com.android.quickstep.views.LauncherRecentsView)1 ResourceProvider (com.android.systemui.plugins.ResourceProvider)1