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

Commit b6bc08ad authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Invert playNonAtomicComponent() as onlyPlayAtomicComponent()" into ub-launcher3-master

parents 6aa63d9f 984c01cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler
    @Override
    public void setStateWithAnimation(LauncherState toState,
            AnimatorSetBuilder builder, LauncherStateManager.AnimationConfig config) {
        if (!config.playNonAtomicComponent()) {
        if (config.onlyPlayAtomicComponent()) {
            return;
        }

+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;

import android.util.IntProperty;
import android.view.View;

import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
@@ -134,7 +135,7 @@ public class BackgroundBlurController implements LauncherStateManager.StateHandl
    @Override
    public void setStateWithAnimation(LauncherState toState, AnimatorSetBuilder builder,
            LauncherStateManager.AnimationConfig config) {
        if (mSurface == null || !config.playNonAtomicComponent()) {
        if (mSurface == null || config.onlyPlayAtomicComponent()) {
            return;
        }

+2 −2
Original line number Diff line number Diff line
@@ -88,11 +88,11 @@ public abstract class BaseRecentsViewStateController<T extends View>
    @Override
    public final void setStateWithAnimation(@NonNull final LauncherState toState,
            @NonNull AnimatorSetBuilder builder, @NonNull AnimationConfig config) {
        if (!config.hasAnimationComponent(PLAY_ATOMIC_OVERVIEW_PEEK | PLAY_ATOMIC_OVERVIEW_SCALE)) {
        if (!config.hasAnimationFlag(PLAY_ATOMIC_OVERVIEW_PEEK | PLAY_ATOMIC_OVERVIEW_SCALE)) {
            // The entire recents animation is played atomically.
            return;
        }
        if (config.hasAnimationComponent(SKIP_OVERVIEW)) {
        if (config.hasAnimationFlag(SKIP_OVERVIEW)) {
            return;
        }
        setStateWithAnimationInternal(toState, builder, config);
+30 −10
Original line number Diff line number Diff line
@@ -313,10 +313,10 @@ public class LauncherStateManager {
    }

    public AnimatorSet createAtomicAnimation(LauncherState fromState, LauncherState toState,
            AnimatorSetBuilder builder, @AnimationFlags int atomicComponent, long duration) {
            AnimatorSetBuilder builder, @AnimationFlags int animFlags, long duration) {
        prepareForAtomicAnimation(fromState, toState, builder);
        AnimationConfig config = new AnimationConfig();
        config.animComponents = atomicComponent;
        config.mAnimFlags = animFlags;
        config.duration = duration;
        for (StateHandler handler : mLauncher.getStateManager().getStateHandlers()) {
            handler.setStateWithAnimation(toState, builder, config);
@@ -371,7 +371,7 @@ public class LauncherStateManager {
            @AnimationFlags int animComponents) {
        mConfig.reset();
        mConfig.userControlled = true;
        mConfig.animComponents = animComponents;
        mConfig.mAnimFlags = animComponents;
        mConfig.duration = duration;
        mConfig.playbackController = AnimatorPlaybackController.wrap(
                createAnimationToNewWorkspaceInternal(state, builder, null), duration)
@@ -585,7 +585,7 @@ public class LauncherStateManager {
        public long duration;
        public boolean userControlled;
        public AnimatorPlaybackController playbackController;
        public @AnimationFlags int animComponents = ANIM_ALL_COMPONENTS;
        private @AnimationFlags int mAnimFlags = ANIM_ALL_COMPONENTS;
        private PropertySetter mPropertySetter;

        private AnimatorSet mCurrentAnimation;
@@ -599,7 +599,7 @@ public class LauncherStateManager {
        public void reset() {
            duration = 0;
            userControlled = false;
            animComponents = ANIM_ALL_COMPONENTS;
            mAnimFlags = ANIM_ALL_COMPONENTS;
            mPropertySetter = null;
            mTargetState = null;

@@ -640,19 +640,39 @@ public class LauncherStateManager {
            mCurrentAnimation.addListener(this);
        }

        /**
         * @return Whether Overview is scaling as part of this animation. If this is the only
         * component (i.e. NON_ATOMIC_COMPONENT isn't included), then this scaling is happening
         * atomically, rather than being part of a normal state animation. StateHandlers can use
         * this to designate part of their animation that should scale with Overview.
         */
        public boolean playAtomicOverviewScaleComponent() {
            return hasAnimationComponent(PLAY_ATOMIC_OVERVIEW_SCALE);
            return hasAnimationFlag(PLAY_ATOMIC_OVERVIEW_SCALE);
        }

        public boolean playNonAtomicComponent() {
            return hasAnimationComponent(PLAY_NON_ATOMIC);
        /**
         * @return Whether this animation will play atomically at the same time as a different,
         * user-controlled state transition. StateHandlers, which contribute to both animations, can
         * use this to avoid animating the same properties in both animations, since they'd conflict
         * with one another.
         */
        public boolean onlyPlayAtomicComponent() {
            return getAnimComponents() == PLAY_ATOMIC_OVERVIEW_SCALE
                    || getAnimComponents() == PLAY_ATOMIC_OVERVIEW_PEEK;
        }

        /**
         * Returns true if the config and any of the provided component flags
         */
        public boolean hasAnimationComponent(@AnimationFlags int a) {
            return (animComponents & a) != 0;
        public boolean hasAnimationFlag(@AnimationFlags int a) {
            return (mAnimFlags & a) != 0;
        }

        /**
         * @return Only the flags that determine which animation components to play.
         */
        public @AnimationFlags int getAnimComponents() {
            return mAnimFlags & ANIM_ALL_COMPONENTS;
        }
    }

+3 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public class WorkspaceStateTransitionAnimation {
                    hotseatIconsAlpha, fadeInterpolator);
        }

        if (!config.playNonAtomicComponent()) {
        if (config.onlyPlayAtomicComponent()) {
            // Only the alpha and scale, handled above, are included in the atomic animation.
            return;
        }
@@ -175,7 +175,8 @@ public class WorkspaceStateTransitionAnimation {
        float pageAlpha = pageAlphaProvider.getPageAlpha(childIndex);
        int drawableAlpha = Math.round(pageAlpha * (state.hasWorkspacePageBackground ? 255 : 0));

        if (config.playNonAtomicComponent()) {
        if (!config.onlyPlayAtomicComponent()) {
            // Don't update the scrim during the atomic animation.
            propertySetter.setInt(cl.getScrimBackground(),
                    DRAWABLE_ALPHA, drawableAlpha, ZOOM_OUT);
        }
Loading