OSDN Git Service

Limit translation of bottom panel snapping to not overshoot.
authorMichael Kwan <mkwan@google.com>
Tue, 13 Sep 2016 05:48:34 +0000 (22:48 -0700)
committerMichael Kwan <mkwan@google.com>
Tue, 13 Sep 2016 05:48:34 +0000 (22:48 -0700)
Bug: 31444693
Change-Id: I84ff0d90eb67c6672dbf81985057bdf844c50cee

core/java/com/android/internal/widget/WatchListDecorLayout.java

index 538ceca..5b49611 100644 (file)
@@ -306,8 +306,9 @@ public class WatchListDecorLayout extends FrameLayout
             if (mListView.getChildCount() > 0) {
                 if (mListView.getLastVisiblePosition() >= mListView.getCount() - 1) {
                     View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
-                    setScrolling(mBottomPanel,
-                            lastChild.getY() + lastChild.getHeight() - mBottomPanel.getTop());
+                    setScrolling(mBottomPanel, Math.max(
+                            0,
+                            lastChild.getY() + lastChild.getHeight() - mBottomPanel.getTop()));
                 } else {
                     // shift to hide the frame, last child is not the last position
                     setScrolling(mBottomPanel, mBottomPanel.getHeight());