am e85d7145: Fixing getItemCount in FolderPagedView
* commit 'e85d7145222ba1311cd9280726d8419b84f2f94b':
Fixing getItemCount in FolderPagedView
diff --git a/src/com/android/launcher3/FolderPagedView.java b/src/com/android/launcher3/FolderPagedView.java
index 9f3126c..6a13a13 100644
--- a/src/com/android/launcher3/FolderPagedView.java
+++ b/src/com/android/launcher3/FolderPagedView.java
@@ -511,13 +511,13 @@
@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