Merge "Scale recents during quick switch for large screens." into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
eb894b577a
@@ -70,6 +70,8 @@
|
|||||||
<item name="content_scale" format="float" type="dimen">0.97</item>
|
<item name="content_scale" format="float" type="dimen">0.97</item>
|
||||||
<dimen name="closing_window_trans_y">115dp</dimen>
|
<dimen name="closing_window_trans_y">115dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="quick_switch_scaling_scroll_threshold">100dp</dimen>
|
||||||
|
|
||||||
<dimen name="recents_empty_message_text_size">16sp</dimen>
|
<dimen name="recents_empty_message_text_size">16sp</dimen>
|
||||||
<dimen name="recents_empty_message_text_padding">16dp</dimen>
|
<dimen name="recents_empty_message_text_padding">16dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|
|
||||||
public static final long RECENTS_ATTACH_DURATION = 300;
|
public static final long RECENTS_ATTACH_DURATION = 300;
|
||||||
|
|
||||||
|
private static final float MAX_QUICK_SWITCH_RECENTS_SCALE_PROGRESS = 0.07f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used as the page index for logging when we return to the last task at the end of the gesture.
|
* Used as the page index for logging when we return to the last task at the end of the gesture.
|
||||||
*/
|
*/
|
||||||
@@ -252,6 +254,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private SwipePipToHomeAnimator mSwipePipToHomeAnimator;
|
private SwipePipToHomeAnimator mSwipePipToHomeAnimator;
|
||||||
protected boolean mIsSwipingPipToHome;
|
protected boolean mIsSwipingPipToHome;
|
||||||
|
|
||||||
|
// Interpolate RecentsView scale from start of quick switch scroll until this scroll threshold
|
||||||
|
private final float mQuickSwitchScaleScrollThreshold;
|
||||||
|
|
||||||
public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
|
public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState,
|
||||||
TaskAnimationManager taskAnimationManager, GestureState gestureState,
|
TaskAnimationManager taskAnimationManager, GestureState gestureState,
|
||||||
long touchTimeMs, boolean continuingLastGesture,
|
long touchTimeMs, boolean continuingLastGesture,
|
||||||
@@ -267,6 +272,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
mTaskAnimationManager = taskAnimationManager;
|
mTaskAnimationManager = taskAnimationManager;
|
||||||
mTouchTimeMs = touchTimeMs;
|
mTouchTimeMs = touchTimeMs;
|
||||||
mContinuingLastGesture = continuingLastGesture;
|
mContinuingLastGesture = continuingLastGesture;
|
||||||
|
mQuickSwitchScaleScrollThreshold = context.getResources().getDimension(
|
||||||
|
R.dimen.quick_switch_scaling_scroll_threshold);
|
||||||
|
|
||||||
initAfterSubclassConstructor();
|
initAfterSubclassConstructor();
|
||||||
initStateCallbacks();
|
initStateCallbacks();
|
||||||
@@ -681,7 +688,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|| !canCreateNewOrUpdateExistingLauncherTransitionController()) {
|
|| !canCreateNewOrUpdateExistingLauncherTransitionController()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mLauncherTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor);
|
mLauncherTransitionController.setProgress(
|
||||||
|
Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1796,7 +1804,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
*/
|
*/
|
||||||
protected void applyWindowTransform() {
|
protected void applyWindowTransform() {
|
||||||
if (mWindowTransitionController != null) {
|
if (mWindowTransitionController != null) {
|
||||||
mWindowTransitionController.setProgress(mCurrentShift.value, mDragLengthFactor);
|
mWindowTransitionController.setProgress(
|
||||||
|
Math.max(mCurrentShift.value, getScaleProgressDueToScroll()),
|
||||||
|
mDragLengthFactor);
|
||||||
}
|
}
|
||||||
// No need to apply any transform if there is ongoing swipe-pip-to-home animator since
|
// No need to apply any transform if there is ongoing swipe-pip-to-home animator since
|
||||||
// that animator handles the leash solely.
|
// that animator handles the leash solely.
|
||||||
@@ -1809,6 +1819,35 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate();
|
ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scaling of RecentsView during quick switch based on amount of recents scroll
|
||||||
|
private float getScaleProgressDueToScroll() {
|
||||||
|
if (!mActivity.getDeviceProfile().isTablet || mRecentsView == null
|
||||||
|
|| !mRecentsViewScrollLinked) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float scrollOffset = Math.abs(mRecentsView.getScrollOffset(mRecentsView.getCurrentPage()));
|
||||||
|
int maxScrollOffset = mRecentsView.getPagedOrientationHandler().getPrimaryValue(
|
||||||
|
mRecentsView.getLastComputedTaskSize().width(),
|
||||||
|
mRecentsView.getLastComputedTaskSize().height());
|
||||||
|
maxScrollOffset += mRecentsView.getPageSpacing();
|
||||||
|
|
||||||
|
float maxScaleProgress =
|
||||||
|
MAX_QUICK_SWITCH_RECENTS_SCALE_PROGRESS * mRecentsView.getMaxScaleForFullScreen();
|
||||||
|
float scaleProgress = maxScaleProgress;
|
||||||
|
|
||||||
|
if (scrollOffset < mQuickSwitchScaleScrollThreshold) {
|
||||||
|
scaleProgress = Utilities.mapToRange(scrollOffset, 0, mQuickSwitchScaleScrollThreshold,
|
||||||
|
0, maxScaleProgress, ACCEL_DEACCEL);
|
||||||
|
} else if (scrollOffset > (maxScrollOffset - mQuickSwitchScaleScrollThreshold)) {
|
||||||
|
scaleProgress = Utilities.mapToRange(scrollOffset,
|
||||||
|
(maxScrollOffset - mQuickSwitchScaleScrollThreshold), maxScrollOffset,
|
||||||
|
maxScaleProgress, 0, ACCEL_DEACCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
return scaleProgress;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for winscope tracing, see launcher_trace.proto
|
* Used for winscope tracing, see launcher_trace.proto
|
||||||
* @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto
|
* @see com.android.systemui.shared.tracing.ProtoTraceable#writeToProto
|
||||||
|
|||||||
Reference in New Issue
Block a user