OSDN Git Service

Fix issue 5905210, AdapterViewAnimator sending negative index to Adapter
authorAdam Cohen <adamcohen@google.com>
Tue, 24 Jan 2012 03:12:22 +0000 (19:12 -0800)
committerAdam Cohen <adamcohen@google.com>
Tue, 24 Jan 2012 03:12:22 +0000 (19:12 -0800)
Change-Id: I6c1a3c17f1009d9512328f5844e17025f95a216c

core/java/android/widget/AdapterViewAnimator.java

index e226d37..bb00049 100644 (file)
@@ -558,7 +558,9 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter>
             mCurrentWindowEnd = newWindowEnd;
             mCurrentWindowStartUnbounded = newWindowStartUnbounded;
             if (mRemoteViewsAdapter != null) {
-                mRemoteViewsAdapter.setVisibleRangeHint(mCurrentWindowStart, mCurrentWindowEnd);
+                int adapterStart = modulo(mCurrentWindowStart, adapterCount);
+                int adapterEnd = modulo(mCurrentWindowEnd, adapterCount);
+                mRemoteViewsAdapter.setVisibleRangeHint(adapterStart, adapterEnd);
             }
         }
         requestLayout();