OSDN Git Service

Adding a utility method to iterate over folder contents
authorSunny Goyal <sunnygoyal@google.com>
Thu, 18 Feb 2016 17:10:19 +0000 (09:10 -0800)
committerSunny Goyal <sunnygoyal@google.com>
Thu, 18 Feb 2016 17:10:19 +0000 (09:10 -0800)
Change-Id: I9f17ade7dc06819587290387b811d828da57b2fb

src/com/android/launcher3/Launcher.java

index fc2b5f4..edb7c14 100644 (file)
@@ -120,6 +120,7 @@ import java.io.PrintWriter;
 import java.text.DateFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -4878,6 +4879,14 @@ public class Launcher extends Activity
             }.executeOnExecutor(Utilities.THREAD_POOL_EXECUTOR);
         }
     }
+
+    public static List<View> getFolderContents(View icon) {
+        if (icon instanceof FolderIcon) {
+            return ((FolderIcon) icon).getFolder().getItemsInReadingOrder();
+        } else {
+            return Collections.EMPTY_LIST;
+        }
+    }
 }
 
 interface DebugIntents {