diff options
author | Adam Powell <adamp@google.com> | 2011-06-14 22:00:01 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2011-06-14 22:00:01 -0700 |
commit | f49971ec06e65ee2a0f0fd48a615b89c677086e7 (patch) | |
tree | 070400725e9b440a06360f8dbc9ecc5ec8cfc5ba /core/java/android/widget/FastScroller.java | |
parent | c04c457eb7783a98fa452449484a818dbb7e0b45 (diff) | |
download | frameworks_base-f49971ec06e65ee2a0f0fd48a615b89c677086e7.zip frameworks_base-f49971ec06e65ee2a0f0fd48a615b89c677086e7.tar.gz frameworks_base-f49971ec06e65ee2a0f0fd48a615b89c677086e7.tar.bz2 |
Make FastScroller behave kinder and gentler when an app decides to
return null from SectionIndexer#getSections()
Change-Id: I9132073f149e13051db13d2e563bd7c1a316046e
Diffstat (limited to 'core/java/android/widget/FastScroller.java')
-rw-r--r-- | core/java/android/widget/FastScroller.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index fb57ce0..00ebe0d 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -468,7 +468,9 @@ class FastScroller { mListAdapter = (BaseAdapter) adapter; mSectionIndexer = (SectionIndexer) adapter; mSections = mSectionIndexer.getSections(); - + if (mSections == null) { + mSections = new String[] { " " }; + } } else { mListAdapter = (BaseAdapter) adapter; mSections = new String[] { " " }; @@ -609,7 +611,7 @@ class FastScroller { final int section = mSectionIndexer.getSectionForPosition(firstVisibleItem); final int sectionPos = mSectionIndexer.getPositionForSection(section); final int nextSectionPos = mSectionIndexer.getPositionForSection(section + 1); - final int sectionCount = mSectionIndexer.getSections().length; + final int sectionCount = mSections.length; final int positionsInSection = nextSectionPos - sectionPos; final View child = mList.getChildAt(0); |