Creaet separate pull back animation for AllApps
- In tablet, only animate recyclerView on pullback to be consistent with widget bottom sheet, and avoid showing a gap below mAppsView
Fix: 220345008
Test: manual on small and large screen
Change-Id: I1f7d03b6bd16af7a91a51a0985ef163d9e365261
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index 86c42ca..4d3b057 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -21,7 +21,7 @@
import static com.android.launcher3.LauncherAnimUtils.newCancelListener;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
-import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
+import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PULL_BACK_PROGRESS;
import static com.android.launcher3.anim.AnimatorListeners.forSuccessCallback;
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_EDU;
@@ -147,7 +147,7 @@
AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU);
} else if (mStartState == ALL_APPS) {
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
- builder.setFloat(allAppsController, ALL_APPS_PROGRESS,
+ builder.setFloat(allAppsController, ALL_APPS_PULL_BACK_PROGRESS,
-mPullbackDistance / allAppsController.getShiftRange(), PULLBACK_INTERPOLATOR);
// Slightly fade out all apps content to further distinguish from scrolling.
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index 14c67de..8662d00 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -76,6 +76,21 @@
}
};
+ public static final FloatProperty<AllAppsTransitionController> ALL_APPS_PULL_BACK_PROGRESS =
+ new FloatProperty<AllAppsTransitionController>("allAppsPullBackProgress") {
+
+ @Override
+ public Float get(AllAppsTransitionController controller) {
+ return controller.mPullBackProgress;
+ }
+
+ @Override
+ public void setValue(AllAppsTransitionController controller, float progress) {
+ controller.setPullBackProgress(progress);
+ }
+ };
+
+
private ActivityAllAppsContainerView<Launcher> mAppsView;
private final Launcher mLauncher;
@@ -89,15 +104,17 @@
// When {@link mProgress} is 1, all apps container is pulled down.
private float mShiftRange; // changes depending on the orientation
private float mProgress; // [0, 1], mShiftRange * mProgress = shiftCurrent
+ private float mPullBackProgress; // [0, 1], mShiftRange * mPullBackProgress = shiftCurrent
private ScrimView mScrimView;
+ private View mPullBackView;
public AllAppsTransitionController(Launcher l) {
mLauncher = l;
DeviceProfile dp = mLauncher.getDeviceProfile();
setShiftRange(dp.allAppsShiftRange);
mProgress = 1f;
-
+ mPullBackProgress = 1f;
mIsVerticalLayout = dp.isVerticalBarLayout();
mLauncher.addOnDeviceProfileChangeListener(this);
}
@@ -115,6 +132,8 @@
mLauncher.getHotseat().setTranslationY(0);
mLauncher.getWorkspace().getPageIndicator().setTranslationY(0);
}
+
+ mPullBackView = dp.isTablet ? mAppsView.getRecyclerViewContainer() : mAppsView;
}
/**
@@ -134,12 +153,19 @@
return mProgress;
}
+ private void setPullBackProgress(float progress) {
+ mPullBackProgress = progress;
+ mPullBackView.setTranslationY(mPullBackProgress * mShiftRange);
+ }
+
/**
* Sets the vertical transition progress to {@param state} and updates all the dependent UI
* accordingly.
*/
@Override
public void setState(LauncherState state) {
+ // Always reset pull back progress when switching states.
+ setPullBackProgress(0f);
setProgress(state.getVerticalProgress(mLauncher));
setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
onProgressAnimationEnd();
@@ -156,6 +182,8 @@
UiThreadHelper.hideKeyboardAsync(mLauncher, mLauncher.getAppsView().getWindowToken());
}
+ // Always reset pull back progress when switching states.
+ setPullBackProgress(0f);
float targetProgress = toState.getVerticalProgress(mLauncher);
if (Float.compare(mProgress, targetProgress) == 0) {
setAlphas(toState, config, builder);
@@ -217,6 +245,8 @@
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
}
mAppsView.setScrimView(scrimView);
+ mPullBackView = mLauncher.getDeviceProfile().isTablet
+ ? mAppsView.getRecyclerViewContainer() : mAppsView;
}
/**