summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authoryanglv <yanglv@codeaurora.org>2013-11-14 17:13:08 +0800
committerArne Coucheron <arco68@gmail.com>2018-11-10 23:57:58 +0100
commitc5c7b5c1c80f846af041bf94ffb71ecebaea6a35 (patch)
tree1b7fb148eb6f465a5a43d3124c07be14badc2575 /src/com/android/gallery3d/app
parent514f0319054ed8c0445ffb9d3c1a3feb1a3d7cf0 (diff)
downloadandroid_packages_apps_Gallery2-c5c7b5c1c80f846af041bf94ffb71ecebaea6a35.tar.gz
android_packages_apps_Gallery2-c5c7b5c1c80f846af041bf94ffb71ecebaea6a35.tar.bz2
android_packages_apps_Gallery2-c5c7b5c1c80f846af041bf94ffb71ecebaea6a35.zip
Gallery2: Remove slideshow option if there are only videos
Enter Gallery and open folder whose files are all video, press menu key should no slideshow option. Add condition to remove slideshow if the folder are all video files. CRs-Fixed: 574984 Change-Id: Ib1603f1609b6490e44039ab64abefb44f14bd477
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/AlbumPage.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java
index 0ff76e751..a90f70fe2 100644
--- a/src/com/android/gallery3d/app/AlbumPage.java
+++ b/src/com/android/gallery3d/app/AlbumPage.java
@@ -68,6 +68,7 @@ import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.GalleryUtils;
import com.android.gallery3d.util.MediaSetUtils;
+import java.util.ArrayList;
import java.util.Locale;
public class AlbumPage extends ActivityState implements GalleryActionBar.ClusterRunner,
@@ -132,6 +133,8 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
private Handler mHandler;
private static final int MSG_PICK_PHOTO = 0;
+ private Menu mActionMenu;
+
private PhotoFallbackEffect mResumeEffect;
private Config.AlbumPage mConfig;
@@ -635,6 +638,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
@Override
protected boolean onCreateActionBar(Menu menu) {
+ mActionMenu = menu;
//GalleryActionBar actionBar = mActivity.getGalleryActionBar();
MenuInflater inflator = getSupportMenuInflater();
if (mGetContent) {
@@ -658,6 +662,26 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
}
//actionBar.setSubtitle(null);
+ // remove slideshow if all are videos
+ if (allVideoFiles() && !mGetContent){
+ menu.findItem(R.id.action_slideshow).setVisible(false);
+ }
+ return true;
+ }
+
+ private boolean allVideoFiles() {
+ if (mMediaSet == null)
+ return false;
+ int count = mMediaSet.getMediaItemCount();
+ MediaItem item;
+ for (int i = 0; i < count; i++) {
+ item = mMediaSet.getMediaItem(i, 1).get(0);
+ if (item == null) {
+ continue;
+ }
+ if (item.getMimeType().trim().startsWith("image/"))
+ return false;
+ }
return true;
}
@@ -774,6 +798,12 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
}
}
+ private void updateMenuItem() {
+ if (allVideoFiles() && !mGetContent) {
+ mActionMenu.findItem(R.id.action_slideshow).setVisible(false);
+ }
+ }
+
@Override
public void onSelectionModeChange(int mode) {
switch (mode) {
@@ -785,6 +815,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
case SelectionManager.LEAVE_SELECTION_MODE: {
mActionModeHandler.finishActionMode();
mRootPane.invalidate();
+ updateMenuItem();
break;
}
case SelectionManager.SELECT_ALL_MODE: {