Further improved NotificationStackScroller
The top card is now collapsed during the pulldown of
the notification shade and expanded during the transition.
The scrollstate is also reset once the shade is closed.
Change-Id: Ibf17eef1f338d674c545e5bf55261e60db62b2ce
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 20fb225..6922ca5 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -216,6 +216,7 @@
mTimeAnimator.end();
mRubberbanding = false;
mClosing = false;
+ onExpandingFinished();
}
}
};
@@ -230,6 +231,12 @@
mRubberbandingEnabled = enable;
}
+ protected void onExpandingFinished() {
+ }
+
+ protected void onExpandingStarted() {
+ }
+
private void runPeekAnimation() {
if (DEBUG) logf("peek to height=%.1f", mPeekHeight);
if (mTimeAnimator.isStarted()) {
@@ -398,7 +405,7 @@
initVelocityTracker();
trackMovement(event);
mTimeAnimator.cancel(); // end any outstanding animations
- mBar.onTrackingStarted(PanelView.this);
+ onTrackingStarted();
mInitialOffsetOnTouch = mExpandedHeight;
if (mExpandedHeight == 0) {
mJustPeeked = true;
@@ -443,7 +450,7 @@
mHandleView.setPressed(false);
postInvalidate(); // catch the press state change
}
- mBar.onTrackingStopped(PanelView.this);
+ onTrackingStopped();
trackMovement(event);
float vel = getCurrentVelocity();
@@ -458,6 +465,15 @@
return true;
}
+ protected void onTrackingStopped() {
+ mBar.onTrackingStopped(PanelView.this);
+ }
+
+ protected void onTrackingStarted() {
+ mBar.onTrackingStarted(PanelView.this);
+ onExpandingStarted();
+ }
+
private float getCurrentVelocity() {
float vel = 0;
float yVel = 0, xVel = 0;
@@ -561,6 +577,7 @@
mInitialOffsetOnTouch = mExpandedHeight;
mInitialTouchY = y;
mTracking = true;
+ onTrackingStarted();
return true;
}
}
@@ -598,6 +615,8 @@
if (always||mVel != 0) {
animationTick(0); // begin the animation
+ } else {
+ onExpandingFinished();
}
}
@@ -770,6 +789,7 @@
if (!isFullyCollapsed()) {
mTimeAnimator.cancel();
mClosing = true;
+ onExpandingStarted();
// collapse() should never be a rubberband, even if an animation is already running
mRubberbanding = false;
fling(-mSelfCollapseVelocityPx, /*always=*/ true);
@@ -780,6 +800,7 @@
if (DEBUG) logf("expand: " + this);
if (isFullyCollapsed()) {
mBar.startOpeningPanel(this);
+ onExpandingStarted();
fling(mSelfExpandVelocityPx, /*always=*/ true);
} else if (DEBUG) {
if (DEBUG) logf("skipping expansion: is expanded");