summaryrefslogtreecommitdiffstats
path: root/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
diff options
context:
space:
mode:
authorTony <twickham@google.com>2019-05-20 21:35:59 -0400
committerTony Wickham <twickham@google.com>2019-05-28 21:41:43 +0000
commitbef6a44e7b8869a4f311db778b9ebfe2f3d40428 (patch)
treeb443479953bbd4b3b59a16c65476b873aeaeda04 /quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
parentebd5e88164ef3a59cfe5f75a9eaeb95222ded7fa (diff)
downloadandroid_packages_apps_Trebuchet-bef6a44e7b8869a4f311db778b9ebfe2f3d40428.tar.gz
android_packages_apps_Trebuchet-bef6a44e7b8869a4f311db778b9ebfe2f3d40428.tar.bz2
android_packages_apps_Trebuchet-bef6a44e7b8869a4f311db778b9ebfe2f3d40428.zip
Continue scaling down recents past final position in 0 button mode
- Previously, we clamped the progress to 1 when reaching mTransitionDragLength. Now, we allow dragging all the way to the top of the screen, and store this new top progress in mDragLengthFactor (> 1f). - Because the launcher animation controller is inherently bound to a progress between 0 and 1, we have to do a bit of trickery involving interpolators. Specifically, we normalize the progress to 0 to 1 by dividing by mDragLengthFactor, but then we set the interpolators to multiply their progress by mDragLengthFactor. The result is that the animation progress appears to go from 0 to mDragLengthFactor, just like the window progress. - To avoid scaling too small, we start interpolating the progress at a certain point, ending at a specified max progress when reaching the top of the screen. Bug: 131741395 Change-Id: Ie8b4b56d37249cd1456f93c110c26c78fe052dc0
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java38
1 files changed, 33 insertions, 5 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 4b2e487da..00e4a9d5a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -30,6 +30,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
+import android.animation.TimeInterpolator;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -68,6 +69,8 @@ import java.util.function.Consumer;
*/
public final class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher> {
+ private Runnable mAdjustInterpolatorsRunnable;
+
@Override
public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context, Rect outRect) {
LayoutUtils.calculateLauncherTaskSize(context, dp, outRect);
@@ -194,6 +197,13 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
}
@Override
+ public void adjustActivityControllerInterpolators() {
+ if (mAdjustInterpolatorsRunnable != null) {
+ mAdjustInterpolatorsRunnable.run();
+ }
+ }
+
+ @Override
public void onTransitionCancelled() {
activity.getStateManager().goToState(startState, false /* animate */);
}
@@ -275,6 +285,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
playScaleDownAnim(anim, activity, fromState, endState);
anim.setDuration(transitionLength * 2);
+ anim.setInterpolator(LINEAR);
AnimatorPlaybackController controller =
AnimatorPlaybackController.wrap(anim, transitionLength * 2);
activity.getStateManager().setCurrentUserControlledAnimation(controller);
@@ -291,7 +302,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
Animator shiftAnim = new SpringObjectAnimator<>(activity.getAllAppsController(),
"allAppsSpringFromACH", activity.getAllAppsController().getShiftRange(),
SPRING_DAMPING_RATIO, SPRING_STIFFNESS, progressValues);
- shiftAnim.setInterpolator(LINEAR);
return shiftAnim;
}
@@ -310,19 +320,37 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
= fromState.getOverviewScaleAndTranslation(launcher);
LauncherState.ScaleAndTranslation endScaleAndTranslation
= endState.getOverviewScaleAndTranslation(launcher);
+ float fromTranslationY = fromScaleAndTranslation.translationY;
+ float endTranslationY = endScaleAndTranslation.translationY;
float fromFullscreenProgress = fromState.getOverviewFullscreenProgress();
float endFullscreenProgress = endState.getOverviewFullscreenProgress();
Animator scale = ObjectAnimator.ofFloat(recentsView, SCALE_PROPERTY,
fromScaleAndTranslation.scale, endScaleAndTranslation.scale);
Animator translateY = ObjectAnimator.ofFloat(recentsView, TRANSLATION_Y,
- fromScaleAndTranslation.translationY, endScaleAndTranslation.translationY);
+ fromTranslationY, endTranslationY);
Animator applyFullscreenProgress = ObjectAnimator.ofFloat(recentsView,
RecentsView.FULLSCREEN_PROGRESS, fromFullscreenProgress, endFullscreenProgress);
- scale.setInterpolator(LINEAR);
- translateY.setInterpolator(LINEAR);
- applyFullscreenProgress.setInterpolator(LINEAR);
anim.playTogether(scale, translateY, applyFullscreenProgress);
+
+ mAdjustInterpolatorsRunnable = () -> {
+ // Adjust the translateY interpolator to account for the running task's top inset.
+ // When progress <= 1, this is handled by each task view as they set their fullscreen
+ // progress. However, once we go to progress > 1, fullscreen progress stays at 0, so
+ // recents as a whole needs to translate further to keep up with the app window.
+ TaskView runningTaskView = recentsView.getRunningTaskView();
+ if (runningTaskView == null) {
+ runningTaskView = recentsView.getTaskViewAt(recentsView.getCurrentPage());
+ }
+ TimeInterpolator oldInterpolator = translateY.getInterpolator();
+ Rect fallbackInsets = launcher.getDeviceProfile().getInsets();
+ float extraTranslationY = runningTaskView.getThumbnail().getInsets(fallbackInsets).top;
+ float normalizedTranslationY = extraTranslationY / (fromTranslationY - endTranslationY);
+ translateY.setInterpolator(t -> {
+ float newT = oldInterpolator.getInterpolation(t);
+ return newT <= 1f ? newT : newT + normalizedTranslationY * (newT - 1);
+ });
+ };
}
@Override