From ca656e3c69266234486c6669fc63244330cb0549 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 18 Dec 2015 13:13:48 -0800 Subject: [PATCH] Fix item count check in Folder#replaceFolderWithFinalItem() Instead of checking the item count (number of views), check the number of items in the model, since that is where the item is being removed. This way, mInfo.contents.remove(0) will never be out of bounds. Bug: 25666490 Change-Id: I0eb880b366157bddb5a8c342d538737722b7f0cd --- src/com/android/launcher3/Folder.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index c5639c43f..9cc94ae75 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -902,7 +902,6 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList // Show the animation, next time something is added to the folder. mInfo.setOption(FolderInfo.FLAG_MULTI_PAGE_ANIMATION, false, mLauncher); } - } @Override @@ -1122,7 +1121,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList Runnable onCompleteRunnable = new Runnable() { @Override public void run() { - int itemCount = getItemCount(); + int itemCount = mInfo.contents.size(); if (itemCount <= 1) { View newIcon = null; -- 2.11.0