summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2012-10-04 18:49:01 +0800
committerHung-ying Tyan <tyanh@google.com>2012-10-04 18:49:01 +0800
commita70201c33d3a8796ac30fd8ec86e2bec41f9820a (patch)
tree8442b7d7cf290363f5f7a0e4615733ff8f890ed4
parentd37dc7f6660d2d01768f93113cbe6efba2448ad0 (diff)
downloadandroid_packages_apps_Snap-a70201c33d3a8796ac30fd8ec86e2bec41f9820a.tar.gz
android_packages_apps_Snap-a70201c33d3a8796ac30fd8ec86e2bec41f9820a.tar.bz2
android_packages_apps_Snap-a70201c33d3a8796ac30fd8ec86e2bec41f9820a.zip
Open album in filmstrip only if the item exists.
Metadata of picasa photos may not be available when user taps to view a picasa album. Cannot enter PhotoPage directly in such a case. Bug: 7213464 Change-Id: Ife2e8768fc9b8d8757235610a02f029f40205b5b
-rw-r--r--src/com/android/gallery3d/app/AlbumSetPage.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java
index 7af1d445e..c8c351496 100644
--- a/src/com/android/gallery3d/app/AlbumSetPage.java
+++ b/src/com/android/gallery3d/app/AlbumSetPage.java
@@ -37,6 +37,7 @@ import com.android.gallery3d.R;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.DataManager;
import com.android.gallery3d.data.MediaDetails;
+import com.android.gallery3d.data.MediaItem;
import com.android.gallery3d.data.MediaObject;
import com.android.gallery3d.data.MediaSet;
import com.android.gallery3d.data.Path;
@@ -60,6 +61,7 @@ import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.HelpUtils;
import java.lang.ref.WeakReference;
+import java.util.ArrayList;
public class AlbumSetPage extends ActivityState implements
SelectionManager.SelectionListener, GalleryActionBar.ClusterRunner,
@@ -211,7 +213,10 @@ public class AlbumSetPage extends ActivityState implements
private static boolean albumShouldOpenInFilmstrip(MediaSet album) {
int itemCount = album.getMediaItemCount();
- return (album.isCameraRoll() && itemCount > 0) || itemCount == 1;
+ ArrayList<MediaItem> list = (itemCount == 1) ? album.getMediaItem(0, 1) : null;
+ return (album.isCameraRoll() && itemCount > 0)
+ // open in film strip only if there's one item in the album and the item exists
+ || (list != null && !list.isEmpty());
}
WeakReference<Toast> mEmptyAlbumToast = null;