diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2016-03-24 02:55:16 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-03-24 02:55:16 -0700 |
| commit | c55a1178ab9447c931e5c1b908239725681f37e6 (patch) | |
| tree | 7e9223ea4562620ce38c4b9da6807ac42f28f35e /src | |
| parent | d18fac1915e2de0878ef2056533495865144eb3d (diff) | |
| parent | ecd50c1cecb8baec1d705354551776393ab25622 (diff) | |
| download | android_packages_apps_Gallery2-c55a1178ab9447c931e5c1b908239725681f37e6.tar.gz android_packages_apps_Gallery2-c55a1178ab9447c931e5c1b908239725681f37e6.tar.bz2 android_packages_apps_Gallery2-c55a1178ab9447c931e5c1b908239725681f37e6.zip | |
Merge "Gallery2: fix no prompt when select a album which include 300 photos." into android_ui.lnx.1.2-dev
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/ui/ActionModeHandler.java | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java index 19a7c5885..226dcea10 100644 --- a/src/com/android/gallery3d/ui/ActionModeHandler.java +++ b/src/com/android/gallery3d/ui/ActionModeHandler.java @@ -41,6 +41,7 @@ import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.MediaObject; import com.android.gallery3d.data.MediaObject.PanoramaSupportCallback; +import com.android.gallery3d.data.MediaSet; import com.android.gallery3d.data.Path; import com.android.gallery3d.ui.MenuExecutor.ProgressListener; import com.android.gallery3d.util.Future; @@ -219,6 +220,9 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi String format = mActivity.getResources().getQuantityString( R.plurals.number_of_items_selected, count); setTitle(String.format(format, count)); + if (count == 0) { + mShareMaxDialog = false; + } // For clients who call SelectionManager.selectAll() directly, we need to ensure the // menu status is consistent with selection manager. @@ -319,6 +323,26 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi return operation; } + private boolean computeCanShare(ArrayList<MediaObject> selected, int max) { + int numSelected = selected.size(); + if (numSelected > max) { + return false; + } + + numSelected = 0; + for (MediaObject mediaObject : selected) { + if (mediaObject instanceof MediaSet) { + numSelected = numSelected + ((MediaSet) mediaObject).getTotalMediaItemCount(); + } else { + numSelected = numSelected + 1; + } + if (numSelected > max) { + return false; + } + } + return true; + } + @TargetApi(ApiHelper.VERSION_CODES.JELLY_BEAN) private void setNfcBeamPushUris(Uri[] uris) { if (mNfcAdapter != null && ApiHelper.HAS_SET_BEAM_PUSH_URIS) { @@ -442,11 +466,10 @@ public class ActionModeHandler implements Callback, PopupList.OnPopupItemClickLi if (jc.isCancelled()) { return null; } - int numSelected = selected.size(); - final boolean canSharePanoramas = - numSelected <= MAX_SELECTED_ITEMS_FOR_PANORAMA_SHARE_INTENT; - final boolean canShare = - numSelected <= MAX_SELECTED_ITEMS_FOR_SHARE_INTENT; + final boolean canSharePanoramas = computeCanShare(selected, + MAX_SELECTED_ITEMS_FOR_PANORAMA_SHARE_INTENT); + final boolean canShare = computeCanShare(selected, + MAX_SELECTED_ITEMS_FOR_SHARE_INTENT); final GetAllPanoramaSupports supportCallback = canSharePanoramas ? new GetAllPanoramaSupports(selected, jc) |
