am 06a0c3a4: Implement nice transition for unlocking while QS is open
automerge: d604794
* commit 'd6047940cd2c0235c53c02b620910ff59a966618':
Implement nice transition for unlocking while QS is open
This commit is contained in:
@@ -527,13 +527,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
mIntercepting = false;
|
mIntercepting = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
return super.onInterceptTouchEvent(event);
|
||||||
// Allow closing the whole panel when in SHADE state.
|
|
||||||
if (mStatusBarState == StatusBarState.SHADE) {
|
|
||||||
return super.onInterceptTouchEvent(event);
|
|
||||||
} else {
|
|
||||||
return !mQsExpanded && super.onInterceptTouchEvent(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -645,10 +639,9 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInQsArea(float x, float y) {
|
private boolean isInQsArea(float x, float y) {
|
||||||
return mStatusBarState != StatusBarState.SHADE ||
|
return (x >= mScrollView.getLeft() && x <= mScrollView.getRight()) &&
|
||||||
(x >= mScrollView.getLeft() && x <= mScrollView.getRight()) &&
|
(y <= mNotificationStackScroller.getBottomMostNotificationBottom()
|
||||||
(y <= mNotificationStackScroller.getBottomMostNotificationBottom()
|
|| y <= mQsContainer.getY() + mQsContainer.getHeight());
|
||||||
|| y <= mQsContainer.getY() + mQsContainer.getHeight());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleQsDown(MotionEvent event) {
|
private void handleQsDown(MotionEvent event) {
|
||||||
@@ -1119,9 +1112,26 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private float calculateQsTopPadding() {
|
private float calculateQsTopPadding() {
|
||||||
// We can only do the smoother transition on Keyguard when we also are not collapsing from a
|
if (mKeyguardShowing
|
||||||
// scrolled quick settings.
|
&& (mTwoFingerQsExpand || mIsExpanding && mQsExpandedWhenExpandingStarted)) {
|
||||||
if (mKeyguardShowing && mScrollYOverride == -1) {
|
|
||||||
|
// Either QS pushes the notifications down when fully expanded, or QS is fully above the
|
||||||
|
// notifications (mostly on tablets). maxNotifications denotes the normal top padding
|
||||||
|
// on Keyguard, maxQs denotes the top padding from the quick settings panel. We need to
|
||||||
|
// take the maximum and linearly interpolate with the panel expansion for a nice motion.
|
||||||
|
int maxNotifications = mClockPositionResult.stackScrollerPadding
|
||||||
|
- mClockPositionResult.stackScrollerPaddingAdjustment
|
||||||
|
- mNotificationTopPadding;
|
||||||
|
int maxQs = getTempQsMaxExpansion();
|
||||||
|
int max = mStatusBarState == StatusBarState.KEYGUARD
|
||||||
|
? Math.max(maxNotifications, maxQs)
|
||||||
|
: maxQs;
|
||||||
|
return (int) interpolate(getExpandedFraction(),
|
||||||
|
mQsMinExpansionHeight, max);
|
||||||
|
} else if (mKeyguardShowing && mScrollYOverride == -1) {
|
||||||
|
|
||||||
|
// We can only do the smoother transition on Keyguard when we also are not collapsing
|
||||||
|
// from a scrolled quick settings.
|
||||||
return interpolate(getQsExpansionFraction(),
|
return interpolate(getQsExpansionFraction(),
|
||||||
mNotificationStackScroller.getIntrinsicPadding() - mNotificationTopPadding,
|
mNotificationStackScroller.getIntrinsicPadding() - mNotificationTopPadding,
|
||||||
mQsMaxExpansionHeight);
|
mQsMaxExpansionHeight);
|
||||||
@@ -1133,7 +1143,9 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
private void requestScrollerTopPaddingUpdate(boolean animate) {
|
private void requestScrollerTopPaddingUpdate(boolean animate) {
|
||||||
mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(),
|
mNotificationStackScroller.updateTopPadding(calculateQsTopPadding(),
|
||||||
mScrollView.getScrollY(),
|
mScrollView.getScrollY(),
|
||||||
mAnimateNextTopPaddingChange || animate);
|
mAnimateNextTopPaddingChange || animate,
|
||||||
|
mKeyguardShowing
|
||||||
|
&& (mTwoFingerQsExpand || mIsExpanding && mQsExpandedWhenExpandingStarted));
|
||||||
mAnimateNextTopPaddingChange = false;
|
mAnimateNextTopPaddingChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1263,18 +1275,27 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onHeightUpdated(float expandedHeight) {
|
protected void onHeightUpdated(float expandedHeight) {
|
||||||
if (!mQsExpanded) {
|
if (!mQsExpanded || mTwoFingerQsExpand || mIsExpanding && mQsExpandedWhenExpandingStarted) {
|
||||||
positionClockAndNotifications();
|
positionClockAndNotifications();
|
||||||
}
|
}
|
||||||
if (mTwoFingerQsExpand || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null
|
if (mTwoFingerQsExpand || mQsExpanded && !mQsTracking && mQsExpansionAnimator == null
|
||||||
&& !mQsExpansionFromOverscroll) {
|
&& !mQsExpansionFromOverscroll) {
|
||||||
float panelHeightQsCollapsed = mNotificationStackScroller.getIntrinsicPadding()
|
float t;
|
||||||
+ mNotificationStackScroller.getMinStackHeight()
|
if (mKeyguardShowing) {
|
||||||
+ mNotificationStackScroller.getNotificationTopPadding();
|
|
||||||
float panelHeightQsExpanded = calculatePanelHeightQsExpanded();
|
|
||||||
float t = (expandedHeight - panelHeightQsCollapsed)
|
|
||||||
/ (panelHeightQsExpanded - panelHeightQsCollapsed);
|
|
||||||
|
|
||||||
|
// On Keyguard, interpolate the QS expansion linearly to the panel expansion
|
||||||
|
t = expandedHeight / getMaxPanelHeight();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// In Shade, interpolate linearly such that QS is closed whenever panel height is
|
||||||
|
// minimum QS expansion + minStackHeight
|
||||||
|
float panelHeightQsCollapsed = mNotificationStackScroller.getIntrinsicPadding()
|
||||||
|
+ mNotificationStackScroller.getMinStackHeight()
|
||||||
|
+ mNotificationStackScroller.getNotificationTopPadding();
|
||||||
|
float panelHeightQsExpanded = calculatePanelHeightQsExpanded();
|
||||||
|
t = (expandedHeight - panelHeightQsCollapsed)
|
||||||
|
/ (panelHeightQsExpanded - panelHeightQsCollapsed);
|
||||||
|
}
|
||||||
setQsExpansion(mQsMinExpansionHeight
|
setQsExpansion(mQsMinExpansionHeight
|
||||||
+ t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
+ t * (getTempQsMaxExpansion() - mQsMinExpansionHeight));
|
||||||
}
|
}
|
||||||
@@ -1308,8 +1329,10 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
float notificationHeight = mNotificationStackScroller.getHeight()
|
float notificationHeight = mNotificationStackScroller.getHeight()
|
||||||
- mNotificationStackScroller.getEmptyBottomMargin()
|
- mNotificationStackScroller.getEmptyBottomMargin()
|
||||||
- mNotificationStackScroller.getTopPadding();
|
- mNotificationStackScroller.getTopPadding();
|
||||||
float totalHeight = mQsMaxExpansionHeight + notificationHeight
|
float totalHeight = Math.max(
|
||||||
+ mNotificationStackScroller.getNotificationTopPadding();
|
mQsMaxExpansionHeight + mNotificationStackScroller.getNotificationTopPadding(),
|
||||||
|
mClockPositionResult.stackScrollerPadding - mTopPaddingAdjustment)
|
||||||
|
+ notificationHeight;
|
||||||
if (totalHeight > mNotificationStackScroller.getHeight()) {
|
if (totalHeight > mNotificationStackScroller.getHeight()) {
|
||||||
float fullyCollapsedHeight = mQsMaxExpansionHeight
|
float fullyCollapsedHeight = mQsMaxExpansionHeight
|
||||||
+ mNotificationStackScroller.getMinStackHeight()
|
+ mNotificationStackScroller.getMinStackHeight()
|
||||||
@@ -1442,7 +1465,7 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
super.onExpandingStarted();
|
super.onExpandingStarted();
|
||||||
mNotificationStackScroller.onExpansionStarted();
|
mNotificationStackScroller.onExpansionStarted();
|
||||||
mIsExpanding = true;
|
mIsExpanding = true;
|
||||||
mQsExpandedWhenExpandingStarted = mQsExpanded;
|
mQsExpandedWhenExpandingStarted = mQsFullyExpanded;
|
||||||
if (mQsExpanded) {
|
if (mQsExpanded) {
|
||||||
onQsExpansionStarted();
|
onQsExpansionStarted();
|
||||||
}
|
}
|
||||||
@@ -1496,11 +1519,12 @@ public class NotificationPanelView extends PanelView implements
|
|||||||
@Override
|
@Override
|
||||||
protected void onTrackingStarted() {
|
protected void onTrackingStarted() {
|
||||||
super.onTrackingStarted();
|
super.onTrackingStarted();
|
||||||
|
if (mQsFullyExpanded) {
|
||||||
|
mTwoFingerQsExpand = true;
|
||||||
|
}
|
||||||
if (mStatusBar.getBarState() == StatusBarState.KEYGUARD
|
if (mStatusBar.getBarState() == StatusBarState.KEYGUARD
|
||||||
|| mStatusBar.getBarState() == StatusBarState.SHADE_LOCKED) {
|
|| mStatusBar.getBarState() == StatusBarState.SHADE_LOCKED) {
|
||||||
mAfforanceHelper.animateHideLeftRightIcon();
|
mAfforanceHelper.animateHideLeftRightIcon();
|
||||||
} else if (mQsExpanded) {
|
|
||||||
mTwoFingerQsExpand = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -639,10 +639,10 @@ public abstract class PanelView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mExpandedHeight = Math.max(0, mExpandedHeight);
|
mExpandedHeight = Math.max(0, mExpandedHeight);
|
||||||
onHeightUpdated(mExpandedHeight);
|
|
||||||
mExpandedFraction = Math.min(1f, fhWithoutOverExpansion == 0
|
mExpandedFraction = Math.min(1f, fhWithoutOverExpansion == 0
|
||||||
? 0
|
? 0
|
||||||
: mExpandedHeight / fhWithoutOverExpansion);
|
: mExpandedHeight / fhWithoutOverExpansion);
|
||||||
|
onHeightUpdated(mExpandedHeight);
|
||||||
notifyBarPanelExpansionChanged();
|
notifyBarPanelExpansionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
private SwipeHelper mSwipeHelper;
|
private SwipeHelper mSwipeHelper;
|
||||||
private boolean mSwipingInProgress;
|
private boolean mSwipingInProgress;
|
||||||
private int mCurrentStackHeight = Integer.MAX_VALUE;
|
private int mCurrentStackHeight = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mCurrentStackHeight is the actual stack height, mLastSetStackHeight is the stack height set
|
||||||
|
* externally from {@link #setStackHeight}
|
||||||
|
*/
|
||||||
|
private float mLastSetStackHeight;
|
||||||
private int mOwnScrollY;
|
private int mOwnScrollY;
|
||||||
private int mMaxLayoutHeight;
|
private int mMaxLayoutHeight;
|
||||||
|
|
||||||
@@ -453,6 +459,7 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
* @param height the new height of the stack
|
* @param height the new height of the stack
|
||||||
*/
|
*/
|
||||||
public void setStackHeight(float height) {
|
public void setStackHeight(float height) {
|
||||||
|
mLastSetStackHeight = height;
|
||||||
setIsExpanded(height > 0.0f);
|
setIsExpanded(height > 0.0f);
|
||||||
int newStackHeight = (int) height;
|
int newStackHeight = (int) height;
|
||||||
int minStackHeight = getMinStackHeight();
|
int minStackHeight = getMinStackHeight();
|
||||||
@@ -1349,7 +1356,19 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
&& initialVelocity > 0;
|
&& initialVelocity > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTopPadding(float qsHeight, int scrollY, boolean animate) {
|
/**
|
||||||
|
* Updates the top padding of the notifications, taking {@link #getIntrinsicPadding()} into
|
||||||
|
* account.
|
||||||
|
*
|
||||||
|
* @param qsHeight the top padding imposed by the quick settings panel
|
||||||
|
* @param scrollY how much the notifications are scrolled inside the QS/notifications scroll
|
||||||
|
* container
|
||||||
|
* @param animate whether to animate the change
|
||||||
|
* @param ignoreIntrinsicPadding if true, {@link #getIntrinsicPadding()} is ignored and
|
||||||
|
* {@code qsHeight} is the final top padding
|
||||||
|
*/
|
||||||
|
public void updateTopPadding(float qsHeight, int scrollY, boolean animate,
|
||||||
|
boolean ignoreIntrinsicPadding) {
|
||||||
float start = qsHeight - scrollY + mNotificationTopPadding;
|
float start = qsHeight - scrollY + mNotificationTopPadding;
|
||||||
float stackHeight = getHeight() - start;
|
float stackHeight = getHeight() - start;
|
||||||
int minStackHeight = getMinStackHeight();
|
int minStackHeight = getMinStackHeight();
|
||||||
@@ -1357,13 +1376,13 @@ public class NotificationStackScrollLayout extends ViewGroup
|
|||||||
float overflow = minStackHeight - stackHeight;
|
float overflow = minStackHeight - stackHeight;
|
||||||
stackHeight = minStackHeight;
|
stackHeight = minStackHeight;
|
||||||
start = getHeight() - stackHeight;
|
start = getHeight() - stackHeight;
|
||||||
setTranslationY(overflow);
|
|
||||||
mTopPaddingOverflow = overflow;
|
mTopPaddingOverflow = overflow;
|
||||||
} else {
|
} else {
|
||||||
setTranslationY(0);
|
|
||||||
mTopPaddingOverflow = 0;
|
mTopPaddingOverflow = 0;
|
||||||
}
|
}
|
||||||
setTopPadding(clampPadding((int) start), animate);
|
setTopPadding(ignoreIntrinsicPadding ? (int) start : clampPadding((int) start),
|
||||||
|
animate);
|
||||||
|
setStackHeight(mLastSetStackHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNotificationTopPadding() {
|
public int getNotificationTopPadding() {
|
||||||
|
|||||||
Reference in New Issue
Block a user