summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQi Ling <qling@sta.samsung.com>2011-04-21 18:36:31 -0700
committermadan ankapura <mankapur@sta.samsung.com>2011-04-21 19:54:18 -0700
commit02d95354cee9d83531e9648ce5144a785c2f85d8 (patch)
treec3dd6fe445539d8b10a43a2eb54e809351e5a3d7
parent5a084ed36e1b1211b650e7815d8a4dbf9d7d6081 (diff)
downloadGallery3D-02d95354cee9d83531e9648ce5144a785c2f85d8.tar.gz
Fixed the issue that the same album gets duplicated in Gallery3D
If we take a photo in camera and then go directly into Gallery album view by touching the folder icon twice (located in the upper left corner of image review screen), the same "Camera" Album is being displayed twice. In this case, the addMediaSet() is called twice with the same setid and datasource, which refers to the same "Camera" album. We avoid the same album being added into mMediaSets. Change-Id: I19fe227c6a036de262825ba11bbbf13c25271471 Signed-off-by: madan ankapura <mankapur@sta.samsung.com>
-rw-r--r--src/com/cooliris/media/MediaFeed.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/com/cooliris/media/MediaFeed.java b/src/com/cooliris/media/MediaFeed.java
index c190ef9..d99c08f 100644
--- a/src/com/cooliris/media/MediaFeed.java
+++ b/src/com/cooliris/media/MediaFeed.java
@@ -191,6 +191,18 @@ public final class MediaFeed implements Runnable {
}
public MediaSet addMediaSet(final long setId, DataSource dataSource) {
+ int numSets = mMediaSets.size();
+ for (int i = 0; i < numSets; i++) {
+ MediaSet set = mMediaSets.get(i);
+ if ((set.mId == setId) && (set.mDataSource == dataSource)) {
+ // The mediaset already exists, but might be out-dated.
+ // To avoid the same mediaset being added twice, we delete
+ // the old one first, then add the new one below.
+ mMediaSets.remove(i);
+ break;
+ }
+ }
+
MediaSet mediaSet = new MediaSet(dataSource);
mediaSet.mId = setId;
mMediaSets.add(mediaSet);