summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-03-20 14:48:18 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-03-20 18:12:53 -0700
commite85d7145222ba1311cd9280726d8419b84f2f94b (patch)
tree5f0e26d15a31fc4b27c4215837d8cf301e8fd3df /src
parent71c3baf5ebc520d5146946e0d7907a5dc12366db (diff)
downloadandroid_packages_apps_Trebuchet-e85d7145222ba1311cd9280726d8419b84f2f94b.tar.gz
android_packages_apps_Trebuchet-e85d7145222ba1311cd9280726d8419b84f2f94b.tar.bz2
android_packages_apps_Trebuchet-e85d7145222ba1311cd9280726d8419b84f2f94b.zip
Fixing getItemCount in FolderPagedView
> When a folder is created, it initially has no item, and then two shortcut info are added to it. Initial logic assumed that the folder it created with on item already present Bug: 19868273 Change-Id: I8850b71d2bace835f94e3cd791c173d40752d2e6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/FolderPagedView.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 9f3126c27..6a13a1385 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -511,13 +511,13 @@ public class FolderPagedView extends PagedView implements Folder.FolderContent {
@Override
public int getItemCount() {
- int lastPage = getChildCount() - 1;
- if (lastPage < 0) {
- // If there are no pages, there must be only one icon in the folder.
- return 1;
+ int lastPageIndex = getChildCount() - 1;
+ if (lastPageIndex < 0) {
+ // If there are no pages, nothing has yet been added to the folder.
+ return 0;
}
- return getPageAt(lastPage).getShortcutsAndWidgets().getChildCount()
- + lastPage * mMaxItemsPerPage;
+ return getPageAt(lastPageIndex).getShortcutsAndWidgets().getChildCount()
+ + lastPageIndex * mMaxItemsPerPage;
}
@Override