diff options
author | Yorke Lee <yorkelee@google.com> | 2014-06-06 11:58:39 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2014-06-06 12:28:46 -0700 |
commit | 40ed60dab29e90e28f95a0d8a9c612fed7a253ce (patch) | |
tree | 95b8bfe7453c4c08bd1548b369b43bf3083b95d1 | |
parent | 97c57ccec07ac91bacb71699b10dcdd24b750c3c (diff) |
Fix for scrolling flicker in OverlappingPaneLayout
If a very fast downward swipe is detected while in the middle of
scrolling down search box it is possible to get to a weird intermediate
state where the list jumps up and down - this tweak guards against that
from happening.
Bug: 15407905
Change-Id: I7c72a09278d0051eae7b0f34be27261e7544ed4b
-rw-r--r-- | src/com/android/dialer/widget/OverlappingPaneLayout.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java index e28bcc578..b513cd207 100644 --- a/src/com/android/dialer/widget/OverlappingPaneLayout.java +++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java @@ -116,10 +116,18 @@ public class OverlappingPaneLayout extends ViewGroup { /** * Indicates that the layout is currently in the process of a nested pre-scroll operation where - * the child is being dragged downwards. If so, we should open the pane up to the maximum - * offset defined in {@link #mIntermediateOffset}, and no further. + * the child scrolling view is being dragged downwards, and still has the ability to consume + * scroll events itself. If so, we should open the pane up to the maximum offset defined in + * {@link #mIntermediateOffset}, and no further, so that the child view can continue performing + * its own scroll. */ - boolean mInNestedPreScrollDownwards = false; + private boolean mInNestedPreScrollDownwards = false; + + /** + * Indicates whether or not a nested scrolling child is able to scroll internally at this point + * in time. + */ + private boolean mChildCannotConsumeScroll; /** * Stores an offset used to represent a point somewhere in between the panel's fully closed @@ -889,6 +897,7 @@ public class OverlappingPaneLayout extends ViewGroup { final boolean startNestedScroll = (nestedScrollAxes & SCROLL_AXIS_VERTICAL) != 0; if (startNestedScroll) { mIsInNestedScroll = true; + mChildCannotConsumeScroll = true; mDragHelper.startNestedScroll(mSlideableView); } if (DEBUG) { @@ -906,7 +915,8 @@ public class OverlappingPaneLayout extends ViewGroup { if (DEBUG) { Log.d(TAG, "onNestedPreScroll: " + dy); } - mInNestedPreScrollDownwards = (dy > 0 && mSlideOffsetPx <= mIntermediateOffset); + mInNestedPreScrollDownwards = + mChildCannotConsumeScroll && dy > 0 && mSlideOffsetPx <= mIntermediateOffset; mDragHelper.processNestedScroll(mSlideableView, 0, dy, consumed); } @@ -916,6 +926,7 @@ public class OverlappingPaneLayout extends ViewGroup { if (DEBUG) { Log.d(TAG, "onNestedScroll: " + dyUnconsumed); } + mChildCannotConsumeScroll = false; mInNestedPreScrollDownwards = false; // We need to flip dyUnconsumed here, because its magnitude is reversed. b/14585990 mDragHelper.processNestedScroll(mSlideableView, 0, -dyUnconsumed, null); |