OSDN Git Service

Fix edge effect not showing up on first scroll
authorVu Thanh Cong <vuthanhcong.ict@gmail.com>
Thu, 10 Nov 2016 13:40:24 +0000 (22:40 +0900)
committerVu Thanh Cong <vuthanhcong.ict@gmail.com>
Thu, 10 Nov 2016 14:20:59 +0000 (23:20 +0900)
This CL fixes a bug in AbsListView when it was not invalidating
mEdgeGlowTop and mEdgeGlowBottom region since the bound of these
EdgeEffect were not set. This was triggering a bug that no edge effect
(overscroll animation) show up on the 1st scroll in ListView.

Bug: N/A
Test: manual - check 1st overscroll animation on a ListView activity

Change-Id: Ic76b894f8e21f9b16651d246bc73ebeaef08fa21
Signed-off-by: Vu Thanh Cong <vuthanhcong.ict@gmail.com>
core/java/android/widget/AbsListView.java

index b331be7..de4c97d 100644 (file)
@@ -4321,13 +4321,14 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                 translateX = 0;
                 translateY = 0;
             }
+            mEdgeGlowTop.setSize(width, height);
+            mEdgeGlowBottom.setSize(width, height);
             if (!mEdgeGlowTop.isFinished()) {
                 final int restoreCount = canvas.save();
                 canvas.clipRect(translateX, translateY,
                          translateX + width ,translateY + mEdgeGlowTop.getMaxHeight());
                 final int edgeY = Math.min(0, scrollY + mFirstPositionDistanceGuess) + translateY;
                 canvas.translate(translateX, edgeY);
-                mEdgeGlowTop.setSize(width, height);
                 if (mEdgeGlowTop.draw(canvas)) {
                     invalidateTopGlow();
                 }
@@ -4342,7 +4343,6 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                         - (clipToPadding ? mPaddingBottom : 0);
                 canvas.translate(edgeX, edgeY);
                 canvas.rotate(180, width, 0);
-                mEdgeGlowBottom.setSize(width, height);
                 if (mEdgeGlowBottom.draw(canvas)) {
                     invalidateBottomGlow();
                 }