summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Birg <roman@cyngn.com>2015-05-06 15:55:00 -0700
committerRajesh Yengisetty <rajesh@cyngn.com>2015-05-12 20:42:25 +0000
commitf07fdf8bb5ff4729a8707f360f301bbc9d9dfcbd (patch)
tree61cb66fd20fd6c6243b0e968eaf2da08f26fe32c
parentb7e4a9200b0a2b2b5a66036b409ca19049c439b7 (diff)
downloadandroid_packages_apps_Trebuchet-f07fdf8bb5ff4729a8707f360f301bbc9d9dfcbd.tar.gz
android_packages_apps_Trebuchet-f07fdf8bb5ff4729a8707f360f301bbc9d9dfcbd.tar.bz2
android_packages_apps_Trebuchet-f07fdf8bb5ff4729a8707f360f301bbc9d9dfcbd.zip
Trebuchet: don't crash when protecting all apps
Change-Id: Iba37f386574a6ebf19bfd2dc0e35262ec0540914 Signed-off-by: Roman Birg <roman@cyngn.com> (cherry picked from commit f5c40426c637813e9e22bff0c2efd09833510bdf)
-rw-r--r--src/com/android/launcher3/AppDrawerListAdapter.java3
-rw-r--r--src/com/android/launcher3/AppDrawerScrubber.java7
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;
}