summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-07-08 21:24:06 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-07-08 21:24:06 +0000
commitfa42e774bc48c3172023c8c49610baa469c19e39 (patch)
tree4cb6206bc042b10dd1c1c4442f9e7ef11704fd74
parent538bd4d8f2ff80d33e26f951c834c8d3680b8420 (diff)
parent4fc2fa65805c57cad2902b4707caa84578752002 (diff)
downloadbase-fa42e774bc48c3172023c8c49610baa469c19e39.tar.gz
Merge "FastScroller: Fix to use appropriate index"
-rw-r--r--core/java/android/widget/FastScroller.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index d2139af22ea1..2dac2c468789 100644
--- a/core/java/android/widget/FastScroller.java
+++ b/core/java/android/widget/FastScroller.java
@@ -646,8 +646,13 @@ class FastScroller {
final int section = mSectionIndexer.getSectionForPosition(firstVisibleItem);
final int sectionPos = mSectionIndexer.getPositionForSection(section);
- final int nextSectionPos = mSectionIndexer.getPositionForSection(section + 1);
+ final int nextSectionPos;
final int sectionCount = mSections.length;
+ if (section + 1 < sectionCount) {
+ nextSectionPos = mSectionIndexer.getPositionForSection(section + 1);
+ } else {
+ nextSectionPos = totalItemCount - 1;
+ }
final int positionsInSection = nextSectionPos - sectionPos;
final View child = mList.getChildAt(0);