diff options
Diffstat (limited to 'src/com/android/gallery3d/data/SnailSource.java')
-rw-r--r-- | src/com/android/gallery3d/data/SnailSource.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/data/SnailSource.java b/src/com/android/gallery3d/data/SnailSource.java index 17b899dba..e74a8bb94 100644 --- a/src/com/android/gallery3d/data/SnailSource.java +++ b/src/com/android/gallery3d/data/SnailSource.java @@ -55,14 +55,23 @@ public class SnailSource extends MediaSource { return null; } - // Register a ScreenNail. Returns the Path of the MediaSet - // containing the MediaItem associated with the ScreenNail. - public static synchronized Path registerScreenNail(ScreenNail s) { + // Registers a ScreenNail and returns the id of it. You can obtain the Path + // of the MediaItem associated with the ScreenNail by getItemPath(), and the + // Path of the MediaSet containing that MediaItem by getSetPath(). + public static synchronized int registerScreenNail(ScreenNail s) { int id = sNextId++; sRegistry.put(id, s); + return id; + } + + public static Path getSetPath(int id) { return Path.fromString("/snail/set").getChild(id); } + public static Path getItemPath(int id) { + return Path.fromString("/snail/item").getChild(id); + } + public static synchronized void unregisterScreenNail(ScreenNail s) { int index = sRegistry.indexOfValue(s); sRegistry.removeAt(index); |