Fade out scrim when swiping to home
Bug: 134517106
Change-Id: Ica725e3a327c1c069e3859732ea6a878d361a3d8
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 837c2dc..9eda2f9 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -28,13 +28,20 @@
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 @@
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 @@
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 @@
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());
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index f784226..9f846bb 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1394,6 +1394,10 @@
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;
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 8d0259d..065d065 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -130,7 +130,10 @@
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);