Merge "Fix some notifications animation issues" into rvc-qpr-dev
This commit is contained in:
@@ -91,7 +91,6 @@ public class NotificationPanelViewController extends OverlayPanelViewController
|
||||
private RecyclerView mNotificationList;
|
||||
private NotificationViewController mNotificationViewController;
|
||||
|
||||
private boolean mIsTracking;
|
||||
private boolean mNotificationListAtEnd;
|
||||
private float mFirstTouchDownOnGlassPane;
|
||||
private boolean mNotificationListAtEndAtTimeOfTouch;
|
||||
@@ -306,7 +305,7 @@ public class NotificationPanelViewController extends OverlayPanelViewController
|
||||
mFirstTouchDownOnGlassPane = event.getRawX();
|
||||
mNotificationListAtEndAtTimeOfTouch = mNotificationListAtEnd;
|
||||
// Reset the tracker when there is a touch down on the glass pane.
|
||||
mIsTracking = false;
|
||||
setIsTracking(false);
|
||||
// Pass the down event to gesture detector so that it knows where the touch event
|
||||
// started.
|
||||
closeGestureDetector.onTouchEvent(event);
|
||||
@@ -341,15 +340,15 @@ public class NotificationPanelViewController extends OverlayPanelViewController
|
||||
|
||||
// If the card is swiping we should not allow the notification shade to close.
|
||||
// Hence setting mNotificationListAtEndAtTimeOfTouch to false will stop that
|
||||
// for us. We are also checking for mIsTracking because while swiping the
|
||||
// for us. We are also checking for isTracking() because while swiping the
|
||||
// notification shade to close if the user goes a bit horizontal while swiping
|
||||
// upwards then also this should close.
|
||||
if (mIsNotificationCardSwiping && !mIsTracking) {
|
||||
if (mIsNotificationCardSwiping && !isTracking()) {
|
||||
mNotificationListAtEndAtTimeOfTouch = false;
|
||||
}
|
||||
|
||||
boolean handled = closeGestureDetector.onTouchEvent(event);
|
||||
boolean isTracking = mIsTracking;
|
||||
boolean isTracking = isTracking();
|
||||
Rect rect = getLayout().getClipBounds();
|
||||
float clippedHeight = 0;
|
||||
if (rect != null) {
|
||||
|
||||
@@ -266,14 +266,17 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
|
||||
float from = getCurrentStartPosition(rect);
|
||||
if (from != to) {
|
||||
animate(from, to, velocity, isClosing);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we swipe down the notification panel all the way to the bottom of the screen
|
||||
// (i.e. from == to), then we have finished animating the panel.
|
||||
return;
|
||||
}
|
||||
|
||||
// We will only be here if the shade is being opened programmatically or via button when
|
||||
// height of the layout was not calculated.
|
||||
ViewTreeObserver notificationTreeObserver = getLayout().getViewTreeObserver();
|
||||
notificationTreeObserver.addOnGlobalLayoutListener(
|
||||
ViewTreeObserver panelTreeObserver = getLayout().getViewTreeObserver();
|
||||
panelTreeObserver.addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
@@ -476,6 +479,11 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
|
||||
return mIsTracking;
|
||||
}
|
||||
|
||||
/** Sets whether the panel is currently tracking or not. */
|
||||
protected final void setIsTracking(boolean isTracking) {
|
||||
mIsTracking = isTracking;
|
||||
}
|
||||
|
||||
/** Returns {@code true} if the panel is currently animating. */
|
||||
protected final boolean isAnimating() {
|
||||
return mIsAnimating;
|
||||
@@ -514,7 +522,7 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
|
||||
}
|
||||
setPanelVisible(true);
|
||||
|
||||
// clips the view for the notification shade when the user scrolls to open.
|
||||
// clips the view for the panel when the user scrolls to open.
|
||||
setViewClipBounds((int) event2.getRawY());
|
||||
|
||||
// Initially the scroll starts with height being zero. This checks protects from divide
|
||||
@@ -569,11 +577,11 @@ public abstract class OverlayPanelViewController extends OverlayViewController {
|
||||
boolean isInClosingDirection = mAnimateDirection * distanceY > 0;
|
||||
|
||||
// This check is to figure out if onScroll was called while swiping the card at
|
||||
// bottom of the list. At that time we should not allow notification shade to
|
||||
// bottom of the panel. At that time we should not allow panel to
|
||||
// close. We are also checking for the upwards swipe gesture here because it is
|
||||
// possible if a user is closing the notification shade and while swiping starts
|
||||
// possible if a user is closing the panel and while swiping starts
|
||||
// to open again but does not fling. At that time we should allow the
|
||||
// notification shade to close fully or else it would stuck in between.
|
||||
// panel to close fully or else it would stuck in between.
|
||||
if (Math.abs(getLayout().getHeight() - y)
|
||||
> SWIPE_DOWN_MIN_DISTANCE && isInClosingDirection) {
|
||||
setViewClipBounds((int) y);
|
||||
|
||||
Reference in New Issue
Block a user