diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 73cd800ca9159f7bf807325d4732c83f67764135..0571787c8bab03992930290a3645a0dd2535941c 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3128,7 +3128,15 @@ public class Launcher extends Activity * @return The open shortcuts container, or null if there is none */ public DeepShortcutsContainer getOpenShortcutsContainer() { - return (DeepShortcutsContainer) mDragLayer.findViewById(R.id.deep_shortcuts_container); + // Iterate in reverse order. Shortcuts container is added later to the dragLayer, + // and will be one of the last views. + for (int i = mDragLayer.getChildCount() - 1; i >= 0; i--) { + View child = mDragLayer.getChildAt(i); + if (child instanceof DeepShortcutsContainer) { + return (DeepShortcutsContainer) child; + } + } + return null; } @Override diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 75d4a8d3d59c0e62e01ac7be1829864893b82dc0..7d7324d0b4e8a8e5890a07ac9d4d8fbd834ae544 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -532,8 +532,9 @@ public class Workspace extends PagedView */ public Folder getOpenFolder() { DragLayer dragLayer = mLauncher.getDragLayer(); - int count = dragLayer.getChildCount(); - for (int i = 0; i < count; i++) { + // Iterate in reverse order. Folder is added later to the dragLayer, + // and will be one of the last views. + for (int i = dragLayer.getChildCount() - 1; i >= 0; i--) { View child = dragLayer.getChildAt(i); if (child instanceof Folder) { Folder folder = (Folder) child;