Loading quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class FastOverviewState extends OverviewState { | FLAG_OVERVIEW_UI | FLAG_HIDE_BACK_BUTTON | FLAG_DISABLE_ACCESSIBILITY; public FastOverviewState(int id) { super(id, QuickScrubController.QUICK_SCRUB_START_DURATION, STATE_FLAGS); super(id, QuickScrubController.QUICK_SCRUB_FROM_HOME_START_DURATION, STATE_FLAGS); } @Override Loading quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +11 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_INTERPOLATOR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_TRANSLATION_Y_FACTOR; import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR; import static com.android.quickstep.views.RecentsView.ADJACENT_SCALE; import static com.android.quickstep.views.RecentsViewContainer.CONTENT_ALPHA; Loading @@ -24,12 +26,14 @@ import static com.android.quickstep.views.RecentsViewContainer.CONTENT_ALPHA; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.os.Build; import android.view.animation.Interpolator; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PropertySetter; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsViewContainer; Loading Loading @@ -69,7 +73,13 @@ public class RecentsViewStateController implements StateHandler { PropertySetter setter = config.getPropertySetter(builder); float[] scaleTranslationYFactor = toState.getOverviewScaleAndTranslationYFactor(mLauncher); setter.setFloat(mRecentsView, ADJACENT_SCALE, scaleTranslationYFactor[0], LINEAR); setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR, scaleTranslationYFactor[1], LINEAR); Interpolator transYInterpolator = LINEAR; if (toState == LauncherState.FAST_OVERVIEW) { transYInterpolator = Interpolators.clampToProgress(QUICK_SCRUB_START_INTERPOLATOR, 0, QUICK_SCRUB_TRANSLATION_Y_FACTOR); } setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR, scaleTranslationYFactor[1], transYInterpolator); setter.setFloat(mRecentsViewContainer, CONTENT_ALPHA, toState.overviewUi ? 1 : 0, AGGRESSIVE_EASE_IN_OUT); Loading quickstep/src/com/android/quickstep/QuickScrubController.java +16 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.quickstep; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.animation.Interpolator; import com.android.launcher3.Alarm; import com.android.launcher3.BaseActivity; Loading @@ -37,7 +40,11 @@ import com.android.quickstep.views.TaskView; */ public class QuickScrubController implements OnAlarmListener { public static final int QUICK_SCRUB_START_DURATION = 210; public static final int QUICK_SCRUB_FROM_APP_START_DURATION = 240; public static final int QUICK_SCRUB_FROM_HOME_START_DURATION = 150; // We want the translation y to finish faster than the rest of the animation. public static final float QUICK_SCRUB_TRANSLATION_Y_FACTOR = 5f / 6; public static final Interpolator QUICK_SCRUB_START_INTERPOLATOR = FAST_OUT_SLOW_IN; /** * Snap to a new page when crossing these thresholds. The first and last auto-advance. Loading Loading @@ -168,23 +175,27 @@ public class QuickScrubController implements OnAlarmListener { public void snapToNextTaskIfAvailable() { if (mInQuickScrub && mRecentsView.getChildCount() > 0) { int duration = mStartedFromHome ? QUICK_SCRUB_FROM_HOME_START_DURATION : QUICK_SCRUB_FROM_APP_START_DURATION; int pageToGoTo = mStartedFromHome ? 0 : mRecentsView.getNextPage() + 1; goToPageWithHaptic(pageToGoTo, QUICK_SCRUB_START_DURATION, true /* forceHaptic */); goToPageWithHaptic(pageToGoTo, duration, true /* forceHaptic */, QUICK_SCRUB_START_INTERPOLATOR); } } private void goToPageWithHaptic(int pageToGoTo) { goToPageWithHaptic(pageToGoTo, -1 /* overrideDuration */, false /* forceHaptic */); goToPageWithHaptic(pageToGoTo, -1 /* overrideDuration */, false /* forceHaptic */, null); } private void goToPageWithHaptic(int pageToGoTo, int overrideDuration, boolean forceHaptic) { private void goToPageWithHaptic(int pageToGoTo, int overrideDuration, boolean forceHaptic, Interpolator interpolator) { pageToGoTo = Utilities.boundToRange(pageToGoTo, 0, mRecentsView.getPageCount() - 1); boolean snappingToPage = pageToGoTo != mRecentsView.getNextPage(); if (snappingToPage) { int duration = overrideDuration > -1 ? overrideDuration : Math.abs(pageToGoTo - mRecentsView.getNextPage()) * QUICKSCRUB_SNAP_DURATION_PER_PAGE; mRecentsView.snapToPage(pageToGoTo, duration); mRecentsView.snapToPage(pageToGoTo, duration, interpolator); } if (snappingToPage || forceHaptic) { mRecentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, Loading quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +5 −9 Original line number Diff line number Diff line Loading @@ -17,11 +17,9 @@ package com.android.quickstep; import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.Utilities.postAsyncCallback; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_DURATION; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_FROM_APP_START_DURATION; import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL; import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB; Loading Loading @@ -454,7 +452,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { setStateOnUiThread(STATE_QUICK_SCRUB_START | STATE_GESTURE_COMPLETED); // Start the window animation without waiting for launcher. animateToProgress(1f, QUICK_SCRUB_START_DURATION, TOUCH_RESPONSE_INTERPOLATOR); animateToProgress(1f, QUICK_SCRUB_FROM_APP_START_DURATION, LINEAR); } @WorkerThread Loading Loading @@ -501,10 +499,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { Interpolator interpolator = mInteractionType == INTERACTION_QUICK_SCRUB ? ACCEL_2 : LINEAR; float interpolated = interpolator.getInterpolation(shift); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, interpolated); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, shift); // TODO: This logic is spartanic! boolean passedThreshold = shift > 0.12f; Loading Loading @@ -792,7 +787,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } mClipAnimationHelper.offsetTarget( firstTask.getCurveScaleForInterpolation(interpolation), offsetFromFirstTask, mActivityControlHelper.getTranslationYForQuickScrub(mActivity)); mActivityControlHelper.getTranslationYForQuickScrub(mActivity), QuickScrubController.QUICK_SCRUB_START_INTERPOLATOR); } } Loading quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java +14 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.quickstep.util; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.SCROLL; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_TRANSLATION_Y_FACTOR; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING; Loading @@ -30,11 +30,13 @@ import android.graphics.RectF; import android.os.Build; import android.os.RemoteException; import android.support.annotation.Nullable; import android.view.animation.Interpolator; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.RecentsModel; import com.android.quickstep.views.RecentsView; Loading Loading @@ -78,6 +80,9 @@ public class ClipAnimationHelper { private final RectF mTmpRectF = new RectF(); private float mTargetScale = 1f; private Interpolator mInterpolator = LINEAR; // We translate y slightly faster than the rest of the animation for quick scrub. private Interpolator mOffsetYInterpolator = LINEAR; // Whether to boost the opening animation target layers, or the closing private int mBoostModeTargetLayers = -1; Loading Loading @@ -134,12 +139,13 @@ public class ClipAnimationHelper { RectF currentRect; mTmpRectF.set(mTargetRect); Utilities.scaleRectFAboutCenter(mTmpRectF, mTargetScale); float offsetYProgress = mOffsetYInterpolator.getInterpolation(progress); progress = mInterpolator.getInterpolation(progress); currentRect = mRectFEvaluator.evaluate(progress, mSourceRect, mTmpRectF); synchronized (mTargetOffset) { // Stay lined up with the center of the target, since it moves for quick scrub. currentRect.offset(mTargetOffset.x * SCROLL.getInterpolation(progress), mTargetOffset.y * LINEAR.getInterpolation(progress)); currentRect.offset(mTargetOffset.x * progress, mTargetOffset.y * offsetYProgress); } mClipRect.left = (int) (mSourceWindowClipInsets.left * progress); Loading Loading @@ -180,11 +186,14 @@ public class ClipAnimationHelper { mTaskTransformCallback = callback; } public void offsetTarget(float scale, float offsetX, float offsetY) { public void offsetTarget(float scale, float offsetX, float offsetY, Interpolator interpolator) { synchronized (mTargetOffset) { mTargetScale = scale; mTargetOffset.set(offsetX, offsetY); } mTargetScale = scale; mInterpolator = interpolator; mOffsetYInterpolator = Interpolators.clampToProgress(mInterpolator, 0, QUICK_SCRUB_TRANSLATION_Y_FACTOR); } public void fromTaskThumbnailView(TaskThumbnailView ttv, RecentsView rv) { Loading Loading
quickstep/src/com/android/launcher3/uioverrides/FastOverviewState.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ public class FastOverviewState extends OverviewState { | FLAG_OVERVIEW_UI | FLAG_HIDE_BACK_BUTTON | FLAG_DISABLE_ACCESSIBILITY; public FastOverviewState(int id) { super(id, QuickScrubController.QUICK_SCRUB_START_DURATION, STATE_FLAGS); super(id, QuickScrubController.QUICK_SCRUB_FROM_HOME_START_DURATION, STATE_FLAGS); } @Override Loading
quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +11 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_INTERPOLATOR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_TRANSLATION_Y_FACTOR; import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR; import static com.android.quickstep.views.RecentsView.ADJACENT_SCALE; import static com.android.quickstep.views.RecentsViewContainer.CONTENT_ALPHA; Loading @@ -24,12 +26,14 @@ import static com.android.quickstep.views.RecentsViewContainer.CONTENT_ALPHA; import android.animation.ValueAnimator; import android.annotation.TargetApi; import android.os.Build; import android.view.animation.Interpolator; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PropertySetter; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsViewContainer; Loading Loading @@ -69,7 +73,13 @@ public class RecentsViewStateController implements StateHandler { PropertySetter setter = config.getPropertySetter(builder); float[] scaleTranslationYFactor = toState.getOverviewScaleAndTranslationYFactor(mLauncher); setter.setFloat(mRecentsView, ADJACENT_SCALE, scaleTranslationYFactor[0], LINEAR); setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR, scaleTranslationYFactor[1], LINEAR); Interpolator transYInterpolator = LINEAR; if (toState == LauncherState.FAST_OVERVIEW) { transYInterpolator = Interpolators.clampToProgress(QUICK_SCRUB_START_INTERPOLATOR, 0, QUICK_SCRUB_TRANSLATION_Y_FACTOR); } setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR, scaleTranslationYFactor[1], transYInterpolator); setter.setFloat(mRecentsViewContainer, CONTENT_ALPHA, toState.overviewUi ? 1 : 0, AGGRESSIVE_EASE_IN_OUT); Loading
quickstep/src/com/android/quickstep/QuickScrubController.java +16 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,11 @@ package com.android.quickstep; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.animation.Interpolator; import com.android.launcher3.Alarm; import com.android.launcher3.BaseActivity; Loading @@ -37,7 +40,11 @@ import com.android.quickstep.views.TaskView; */ public class QuickScrubController implements OnAlarmListener { public static final int QUICK_SCRUB_START_DURATION = 210; public static final int QUICK_SCRUB_FROM_APP_START_DURATION = 240; public static final int QUICK_SCRUB_FROM_HOME_START_DURATION = 150; // We want the translation y to finish faster than the rest of the animation. public static final float QUICK_SCRUB_TRANSLATION_Y_FACTOR = 5f / 6; public static final Interpolator QUICK_SCRUB_START_INTERPOLATOR = FAST_OUT_SLOW_IN; /** * Snap to a new page when crossing these thresholds. The first and last auto-advance. Loading Loading @@ -168,23 +175,27 @@ public class QuickScrubController implements OnAlarmListener { public void snapToNextTaskIfAvailable() { if (mInQuickScrub && mRecentsView.getChildCount() > 0) { int duration = mStartedFromHome ? QUICK_SCRUB_FROM_HOME_START_DURATION : QUICK_SCRUB_FROM_APP_START_DURATION; int pageToGoTo = mStartedFromHome ? 0 : mRecentsView.getNextPage() + 1; goToPageWithHaptic(pageToGoTo, QUICK_SCRUB_START_DURATION, true /* forceHaptic */); goToPageWithHaptic(pageToGoTo, duration, true /* forceHaptic */, QUICK_SCRUB_START_INTERPOLATOR); } } private void goToPageWithHaptic(int pageToGoTo) { goToPageWithHaptic(pageToGoTo, -1 /* overrideDuration */, false /* forceHaptic */); goToPageWithHaptic(pageToGoTo, -1 /* overrideDuration */, false /* forceHaptic */, null); } private void goToPageWithHaptic(int pageToGoTo, int overrideDuration, boolean forceHaptic) { private void goToPageWithHaptic(int pageToGoTo, int overrideDuration, boolean forceHaptic, Interpolator interpolator) { pageToGoTo = Utilities.boundToRange(pageToGoTo, 0, mRecentsView.getPageCount() - 1); boolean snappingToPage = pageToGoTo != mRecentsView.getNextPage(); if (snappingToPage) { int duration = overrideDuration > -1 ? overrideDuration : Math.abs(pageToGoTo - mRecentsView.getNextPage()) * QUICKSCRUB_SNAP_DURATION_PER_PAGE; mRecentsView.snapToPage(pageToGoTo, duration); mRecentsView.snapToPage(pageToGoTo, duration, interpolator); } if (snappingToPage || forceHaptic) { mRecentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, Loading
quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java +5 −9 Original line number Diff line number Diff line Loading @@ -17,11 +17,9 @@ package com.android.quickstep; import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER; import static com.android.launcher3.Utilities.postAsyncCallback; import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.DEACCEL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_START_DURATION; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_FROM_APP_START_DURATION; import static com.android.quickstep.TouchConsumer.INTERACTION_NORMAL; import static com.android.quickstep.TouchConsumer.INTERACTION_QUICK_SCRUB; Loading Loading @@ -454,7 +452,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { setStateOnUiThread(STATE_QUICK_SCRUB_START | STATE_GESTURE_COMPLETED); // Start the window animation without waiting for launcher. animateToProgress(1f, QUICK_SCRUB_START_DURATION, TOUCH_RESPONSE_INTERPOLATOR); animateToProgress(1f, QUICK_SCRUB_FROM_APP_START_DURATION, LINEAR); } @WorkerThread Loading Loading @@ -501,10 +499,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { RecentsAnimationControllerCompat controller = mRecentsAnimationWrapper.getController(); if (controller != null) { Interpolator interpolator = mInteractionType == INTERACTION_QUICK_SCRUB ? ACCEL_2 : LINEAR; float interpolated = interpolator.getInterpolation(shift); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, interpolated); mClipAnimationHelper.applyTransform(mRecentsAnimationWrapper.targetSet, shift); // TODO: This logic is spartanic! boolean passedThreshold = shift > 0.12f; Loading Loading @@ -792,7 +787,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> { } mClipAnimationHelper.offsetTarget( firstTask.getCurveScaleForInterpolation(interpolation), offsetFromFirstTask, mActivityControlHelper.getTranslationYForQuickScrub(mActivity)); mActivityControlHelper.getTranslationYForQuickScrub(mActivity), QuickScrubController.QUICK_SCRUB_START_INTERPOLATOR); } } Loading
quickstep/src/com/android/quickstep/util/ClipAnimationHelper.java +14 −5 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.quickstep.util; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.SCROLL; import static com.android.quickstep.QuickScrubController.QUICK_SCRUB_TRANSLATION_Y_FACTOR; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING; Loading @@ -30,11 +30,13 @@ import android.graphics.RectF; import android.os.Build; import android.os.RemoteException; import android.support.annotation.Nullable; import android.view.animation.Interpolator; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.RecentsModel; import com.android.quickstep.views.RecentsView; Loading Loading @@ -78,6 +80,9 @@ public class ClipAnimationHelper { private final RectF mTmpRectF = new RectF(); private float mTargetScale = 1f; private Interpolator mInterpolator = LINEAR; // We translate y slightly faster than the rest of the animation for quick scrub. private Interpolator mOffsetYInterpolator = LINEAR; // Whether to boost the opening animation target layers, or the closing private int mBoostModeTargetLayers = -1; Loading Loading @@ -134,12 +139,13 @@ public class ClipAnimationHelper { RectF currentRect; mTmpRectF.set(mTargetRect); Utilities.scaleRectFAboutCenter(mTmpRectF, mTargetScale); float offsetYProgress = mOffsetYInterpolator.getInterpolation(progress); progress = mInterpolator.getInterpolation(progress); currentRect = mRectFEvaluator.evaluate(progress, mSourceRect, mTmpRectF); synchronized (mTargetOffset) { // Stay lined up with the center of the target, since it moves for quick scrub. currentRect.offset(mTargetOffset.x * SCROLL.getInterpolation(progress), mTargetOffset.y * LINEAR.getInterpolation(progress)); currentRect.offset(mTargetOffset.x * progress, mTargetOffset.y * offsetYProgress); } mClipRect.left = (int) (mSourceWindowClipInsets.left * progress); Loading Loading @@ -180,11 +186,14 @@ public class ClipAnimationHelper { mTaskTransformCallback = callback; } public void offsetTarget(float scale, float offsetX, float offsetY) { public void offsetTarget(float scale, float offsetX, float offsetY, Interpolator interpolator) { synchronized (mTargetOffset) { mTargetScale = scale; mTargetOffset.set(offsetX, offsetY); } mTargetScale = scale; mInterpolator = interpolator; mOffsetYInterpolator = Interpolators.clampToProgress(mInterpolator, 0, QUICK_SCRUB_TRANSLATION_Y_FACTOR); } public void fromTaskThumbnailView(TaskThumbnailView ttv, RecentsView rv) { Loading