summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-03-05 16:56:12 -0800
committerSunny Goyal <sunnygoyal@google.com>2015-03-05 18:03:08 -0800
commit1c0e633bd59e0f14f799cbb6aee33266032998fa (patch)
treef5711bdbba9949647044580bac4a6065ebcdffe2 /src/com/android
parentee995106d8a50b691e65988f5b3df5d2d83ca69a (diff)
downloadandroid_packages_apps_Trebuchet-1c0e633bd59e0f14f799cbb6aee33266032998fa.tar.gz
android_packages_apps_Trebuchet-1c0e633bd59e0f14f799cbb6aee33266032998fa.tar.bz2
android_packages_apps_Trebuchet-1c0e633bd59e0f14f799cbb6aee33266032998fa.zip
Handling getLastItem when the folder is closed
Change-Id: I6afebd7c0a92edb25e3658e7f860244d7457c852
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/FolderCellLayout.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/launcher3/FolderCellLayout.java b/src/com/android/launcher3/FolderCellLayout.java
index e6e9199e8..b354ec74e 100644
--- a/src/com/android/launcher3/FolderCellLayout.java
+++ b/src/com/android/launcher3/FolderCellLayout.java
@@ -245,7 +245,13 @@ public class FolderCellLayout extends CellLayout implements Folder.FolderContent
@Override
public View getLastItem() {
int lastRank = getShortcutsAndWidgets().getChildCount() - 1;
- return getShortcutsAndWidgets().getChildAt(lastRank % getCountX(), lastRank / getCountX());
+ // count can be zero if the folder is not yet laid out.
+ int count = getCountX();
+ if (count > 0) {
+ return getShortcutsAndWidgets().getChildAt(lastRank % count, lastRank / count);
+ } else {
+ return getShortcutsAndWidgets().getChildAt(lastRank);
+ }
}
@Override