Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c585ddb authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Removing view layer support during state animation.

View layer was only being used when fading in/out hotseat in overview.
From API 21+, android automatically create layers when animating alpha

The current support for view layers does not work properly when cancelling
animations and controlling partial animations

Change-Id: I2d5785471af9819575beefe65f1f2bdd28c76bd5
parent 47f59140
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.LauncherStateManager.StateHandler;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
@@ -54,7 +53,7 @@ public class RecentsViewStateController implements StateHandler {
    }

    @Override
    public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
    public void setStateWithAnimation(LauncherState toState,
            AnimatorSetBuilder builder, AnimationConfig config) {
        ObjectAnimator progressAnim =
                mTransitionProgress.animateToValue(toState == LauncherState.OVERVIEW ? 1 : 0);
+2 −6
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.os.Handler;
import android.os.Looper;
import android.view.View;

import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.AnimatorSetBuilder;
@@ -212,15 +211,12 @@ public class LauncherStateManager {

    protected AnimatorSet createAnimationToNewWorkspaceInternal(final LauncherState state,
            AnimatorSetBuilder builder, final Runnable onCompleteRunnable) {
        final AnimationLayerSet layerViews = new AnimationLayerSet();

        for (StateHandler handler : getStateHandlers()) {
            builder.startTag(handler);
            handler.setStateWithAnimation(state, layerViews, builder, mConfig);
            handler.setStateWithAnimation(state, builder, mConfig);
        }

        final AnimatorSet animation = builder.build();
        animation.addListener(layerViews);
        animation.addListener(new AnimationSuccessListener() {

            @Override
@@ -339,7 +335,7 @@ public class LauncherStateManager {
        /**
         * Sets the UI to {@param state} by animating any changes.
         */
        void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
        void setStateWithAnimation(LauncherState toState,
                AnimatorSetBuilder builder, AnimationConfig config);
    }

+2 −3
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.accessibility.AccessibleDragListenerAdapter;
import com.android.launcher3.accessibility.OverviewScreenAccessibilityDelegate;
import com.android.launcher3.accessibility.WorkspaceAccessibilityHelper;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.badge.FolderBadgeInfo;
@@ -1547,10 +1546,10 @@ public class Workspace extends PagedView
     * Sets the current workspace {@link LauncherState}, then animates the UI
     */
    @Override
    public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
    public void setStateWithAnimation(LauncherState toState,
            AnimatorSetBuilder builder, AnimationConfig config) {
        StateTransitionListener listener = new StateTransitionListener(toState);
        mStateTransitionAnimation.setStateWithAnimation(toState, builder, layerViews, config);
        mStateTransitionAnimation.setStateWithAnimation(toState, builder, config);

        // Invalidate the pages now, so that we have the visible pages before the
        // animation is started
+3 −9
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
@@ -32,7 +31,6 @@ import android.view.accessibility.AccessibilityManager;

import com.android.launcher3.LauncherState.PageAlphaProvider;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;

@@ -112,9 +110,9 @@ public class WorkspaceStateTransitionAnimation {
    }

    public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder,
            AnimationLayerSet layerViews, AnimationConfig config) {
            AnimationConfig config) {
        AnimatedPropertySetter propertySetter =
                new AnimatedPropertySetter(config.duration, layerViews, builder);
                new AnimatedPropertySetter(config.duration, builder);
        setWorkspaceProperty(toState, propertySetter);
    }

@@ -190,13 +188,10 @@ public class WorkspaceStateTransitionAnimation {
    public static class AnimatedPropertySetter extends PropertySetter {

        private final long mDuration;
        private final AnimationLayerSet mLayerViews;
        private final AnimatorSetBuilder mStateAnimator;

        public AnimatedPropertySetter(
                long duration, AnimationLayerSet layerView, AnimatorSetBuilder builder) {
        public AnimatedPropertySetter(long duration, AnimatorSetBuilder builder) {
            mDuration = duration;
            mLayerViews = layerView;
            mStateAnimator = builder;
        }

@@ -211,7 +206,6 @@ public class WorkspaceStateTransitionAnimation {
            }

            anim.setDuration(mDuration).setInterpolator(getFadeInterpolator(alpha));
            mLayerViews.addView(view);
            mStateAnimator.play(anim);
        }

+2 −3
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.AnimationLayerSet;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.Interpolators;
@@ -122,7 +121,7 @@ public class AllAppsTransitionController
     * @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace
     *
     * @see #setState(LauncherState)
     * @see #setStateWithAnimation(LauncherState, AnimationLayerSet, AnimatorSetBuilder, AnimationConfig)
     * @see #setStateWithAnimation(LauncherState, AnimatorSetBuilder, AnimationConfig)
     */
    public void setProgress(float progress) {
        mProgress = progress;
@@ -167,7 +166,7 @@ public class AllAppsTransitionController
     * dependent UI using various animation events
     */
    @Override
    public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
    public void setStateWithAnimation(LauncherState toState,
            AnimatorSetBuilder builder, AnimationConfig config) {
        if (Float.compare(mProgress, toState.verticalProgress) == 0) {
            // Fail fast
Loading