diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/AppDrawerListAdapter.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/AppDrawerScrubber.java | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/com/android/launcher3/AppDrawerListAdapter.java b/src/com/android/launcher3/AppDrawerListAdapter.java index 81c489e45..50242c3e3 100644 --- a/src/com/android/launcher3/AppDrawerListAdapter.java +++ b/src/com/android/launcher3/AppDrawerListAdapter.java @@ -860,6 +860,9 @@ public class AppDrawerListAdapter extends RecyclerView.Adapter<AppDrawerListAdap @Override public int getPositionForSection(int sectionIndex) { + if (mSectionHeaders.isEmpty()) { + return 0; + } return mSectionHeaders.get(getSections()[sectionIndex]).mItemIndex; } diff --git a/src/com/android/launcher3/AppDrawerScrubber.java b/src/com/android/launcher3/AppDrawerScrubber.java index de63955b4..687c164ad 100644 --- a/src/com/android/launcher3/AppDrawerScrubber.java +++ b/src/com/android/launcher3/AppDrawerScrubber.java @@ -266,6 +266,9 @@ public class AppDrawerScrubber extends LinearLayout { } public String getHeader(int idx) { + if (size() == 0) { + return null; + } return showLetters() ? mSections.get(idx).getText() : mHeaders[idx]; } @@ -277,7 +280,7 @@ public class AppDrawerScrubber extends LinearLayout { * @return the mHeaders index (aka the underlying adapter index). */ public int getAdapterIndex(int prevIdx, int curIdx) { - if (!showLetters()) { + if (!showLetters() || size() == 0) { return curIdx; } @@ -291,7 +294,7 @@ public class AppDrawerScrubber extends LinearLayout { * highlighted index */ public int getDirectionalIndex(int prevIdx, int curIdx) { - if (!showLetters() || mSections.get(curIdx).getHighlight()) { + if (!showLetters() || size() == 0 || mSections.get(curIdx).getHighlight()) { return curIdx; } |