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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user