Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f49971ec authored by Adam Powell's avatar Adam Powell
Browse files

Make FastScroller behave kinder and gentler when an app decides to

return null from SectionIndexer#getSections()

Change-Id: I9132073f149e13051db13d2e563bd7c1a316046e
parent c04c457e
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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);