Translating QS during LS -> Shade transition

This resolves the last inconsistency during the drag down,
as quick settings wasn't translated before. Future work
inclused spreading and squeezing the qs panel itself
to get to the finalized spec.

Fixes: 184946919
Test: drag down lon lockscreen, observe qs translating
Change-Id: I92fc12d383ec7495892703cffe5548f333ae62be
This commit is contained in:
Selim Cinek
2021-07-02 15:18:41 +02:00
parent 39ee79bd8a
commit db79bf61d1

View File

@@ -180,6 +180,11 @@ public class NotificationPanelViewController extends PanelViewController {
private static final boolean DEBUG = false;
/**
* The parallax amount of the quick settings translation when dragging down the panel
*/
private static final float QS_PARALLAX_AMOUNT = 0.175f;
/**
* Fling expanding QS.
*/
@@ -543,6 +548,11 @@ public class NotificationPanelViewController extends PanelViewController {
*/
private int mDistanceForQSFullShadeTransition;
/**
* The translation amount for QS for the full shade transition
*/
private float mQsTranslationForFullShadeTransition;
/**
* The maximum overshoot allowed for the top padding for the full shade transition
*/
@@ -589,6 +599,11 @@ public class NotificationPanelViewController extends PanelViewController {
* The animator for the qs clipping bounds.
*/
private ValueAnimator mQsClippingAnimation = null;
/**
* Is the current animator resetting the qs translation.
*/
private boolean mIsQsTranslationResetAnimator;
private final Rect mKeyguardStatusAreaClipBounds = new Rect();
private final Region mQsInterceptRegion = new Region();
@@ -2326,6 +2341,7 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public void onAnimationEnd(Animator animation) {
mQsClippingAnimation = null;
mIsQsTranslationResetAnimator = false;
}
});
mQsClippingAnimation.start();
@@ -2349,7 +2365,18 @@ public class NotificationPanelViewController extends PanelViewController {
statusBarClipTop = top - mKeyguardStatusBar.getTop();
}
if (mQs != null) {
mQs.setFancyClipping(top, bottom, radius, qsVisible
float qsTranslation = 0;
if (mTransitioningToFullShadeProgress > 0.0f || (mQsClippingAnimation != null
&& mIsQsTranslationResetAnimator)) {
qsTranslation = (top - mQs.getHeader().getHeight()) * QS_PARALLAX_AMOUNT;
}
mQsTranslationForFullShadeTransition = qsTranslation;
updateQsFrameTranslation();
float currentTranslation = mQsFrame.getTranslationY();
mQs.setFancyClipping((
int) (top - currentTranslation),
(int) (bottom - currentTranslation),
radius, qsVisible
&& !mShouldUseSplitNotificationShade);
}
mKeyguardStatusViewController.setClipBounds(
@@ -2486,6 +2513,7 @@ public class NotificationPanelViewController extends PanelViewController {
if (animate && !mShouldUseSplitNotificationShade) {
animateNextNotificationBounds(StackStateAnimator.ANIMATION_DURATION_GO_TO_FULL_SHADE,
delay);
mIsQsTranslationResetAnimator = mQsTranslationForFullShadeTransition > 0.0f;
}
float endPosition = 0;
@@ -2885,7 +2913,7 @@ public class NotificationPanelViewController extends PanelViewController {
float startHeight = -mQsExpansionHeight;
if (!mShouldUseSplitNotificationShade && mBarState == StatusBarState.SHADE) {
// Small parallax as we pull down and clip QS
startHeight = -mQsExpansionHeight * 0.2f;
startHeight = -mQsExpansionHeight * QS_PARALLAX_AMOUNT;
}
if (mKeyguardBypassController.getBypassEnabled() && isOnKeyguard()) {
if (mNotificationStackScrollLayoutController.isPulseExpanding()) {
@@ -3067,10 +3095,15 @@ public class NotificationPanelViewController extends PanelViewController {
super.setOverExpansion(overExpansion);
// Translating the quick settings by half the overexpansion to center it in the background
// frame
mQsFrame.setTranslationY(overExpansion / 2f);
updateQsFrameTranslation();
mNotificationStackScrollLayoutController.setOverExpansion(overExpansion);
}
private void updateQsFrameTranslation() {
float translation = mOverExpansion / 2.0f + mQsTranslationForFullShadeTransition;
mQsFrame.setTranslationY(translation);
}
@Override
protected void onTrackingStarted() {
mFalsingCollector.onTrackingStarted(!mKeyguardStateController.canDismissLockScreen());