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

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

Merge "Fade out scrim when swiping to home" into ub-launcher3-qt-dev

parents 0d6856a1 ae087dc9
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -28,13 +28,20 @@ import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils.ViewProgressProperty;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.R;
import com.android.launcher3.ShortcutAndWidgetContainer;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.anim.SpringObjectAnimator;

import java.util.ArrayList;
import java.util.List;

import static com.android.launcher3.LauncherState.BACKGROUND_APP;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.anim.Interpolators.LINEAR;

/**
@@ -56,7 +63,7 @@ public class StaggeredWorkspaceAnim {
    private final float mSpringTransY;
    private final View mViewToIgnore;

    private final List<ValueAnimator> mAnimators = new ArrayList<>();
    private final List<Animator> mAnimators = new ArrayList<>();

    /**
     * @param floatingViewOriginalView The FloatingIconView's original view.
@@ -104,6 +111,9 @@ public class StaggeredWorkspaceAnim {
            View qsb = launcher.findViewById(R.id.search_container_all_apps);
            addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows);
        }

        addWorkspaceScrimAnimationForState(launcher, BACKGROUND_APP, 0);
        addWorkspaceScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS);
    }

    /**
@@ -150,4 +160,14 @@ public class StaggeredWorkspaceAnim {
        alpha.setStartDelay(startDelay);
        mAnimators.add(alpha);
    }

    private void addWorkspaceScrimAnimationForState(Launcher launcher, LauncherState state,
            long duration) {
        AnimatorSetBuilder scrimAnimBuilder = new AnimatorSetBuilder();
        AnimationConfig scrimAnimConfig = new AnimationConfig();
        scrimAnimConfig.duration = duration;
        PropertySetter scrimPropertySetter = scrimAnimConfig.getPropertySetter(scrimAnimBuilder);
        launcher.getWorkspace().getStateTransitionAnimation().setScrim(scrimPropertySetter, state);
        mAnimators.add(scrimAnimBuilder.build());
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -1394,6 +1394,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
        builder.play(stepAnimator);
    }

    public WorkspaceStateTransitionAnimation getStateTransitionAnimation() {
        return mStateTransitionAnimation;
    }

    public void updateAccessibilityFlags() {
        // TODO: Update the accessibility flags appropriately when dragging.
        int accessibilityFlag = mLauncher.getStateManager().getState().workspaceAccessibilityFlag;
+4 −1
Original line number Diff line number Diff line
@@ -130,7 +130,10 @@ public class WorkspaceStateTransitionAnimation {
        propertySetter.setFloat(mWorkspace.getPageIndicator(), View.TRANSLATION_Y,
                hotseatScaleAndTranslation.translationY, translationInterpolator);

        // Set scrim
        setScrim(propertySetter, state);
    }

    public void setScrim(PropertySetter propertySetter, LauncherState state) {
        WorkspaceAndHotseatScrim scrim = mLauncher.getDragLayer().getScrim();
        propertySetter.setFloat(scrim, SCRIM_PROGRESS, state.getWorkspaceScrimAlpha(mLauncher),
                LINEAR);