diff options
author | Wei Huang <weih@google.com> | 2011-08-30 10:22:41 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-30 10:22:41 -0700 |
commit | 0ba0e9e5e4bae838e0cce29a509f875b434a0542 (patch) | |
tree | 941084465ffee27a0e349075f5d78ff22006e8a5 /src/com/android/gallery3d | |
parent | 44aac4bcb6ddd0b6553a198db4adb479d3437c8e (diff) | |
parent | 7474877ffcaa8480872083b36e3d2b00eb0bc867 (diff) | |
download | android_packages_apps_Snap-0ba0e9e5e4bae838e0cce29a509f875b434a0542.tar.gz android_packages_apps_Snap-0ba0e9e5e4bae838e0cce29a509f875b434a0542.tar.bz2 android_packages_apps_Snap-0ba0e9e5e4bae838e0cce29a509f875b434a0542.zip |
Merge "Fix 4975579 PTP: Unable to load the thumbnails while connected to camera"
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/data/MtpImage.java | 11 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/ActionModeHandler.java | 20 |
2 files changed, 13 insertions, 18 deletions
diff --git a/src/com/android/gallery3d/data/MtpImage.java b/src/com/android/gallery3d/data/MtpImage.java index e0e5481d9..218f70483 100644 --- a/src/com/android/gallery3d/data/MtpImage.java +++ b/src/com/android/gallery3d/data/MtpImage.java @@ -78,8 +78,8 @@ public class MtpImage extends MediaItem { public Job<Bitmap> requestImage(int type) { return new Job<Bitmap>() { public Bitmap run(JobContext jc) { - GetThumbnailBytes job = new GetThumbnailBytes(); - byte[] thumbnail = mThreadPool.submit(job).get(); + byte[] thumbnail = mMtpContext.getMtpClient().getThumbnail( + UsbDevice.getDeviceName(mDeviceId), mObjectId); if (thumbnail == null) { Log.w(TAG, "decoding thumbnail failed"); return null; @@ -116,13 +116,6 @@ public class MtpImage extends MediaItem { return SUPPORT_FULL_IMAGE | SUPPORT_IMPORT; } - private class GetThumbnailBytes implements Job<byte[]> { - public byte[] run(JobContext jc) { - return mMtpContext.getMtpClient().getThumbnail( - UsbDevice.getDeviceName(mDeviceId), mObjectId); - } - } - public void updateContent(MtpObjectInfo info) { if (mObjectId != info.getObjectHandle() || mDateTaken != info.getDateCreated()) { mObjectId = info.getObjectHandle(); diff --git a/src/com/android/gallery3d/ui/ActionModeHandler.java b/src/com/android/gallery3d/ui/ActionModeHandler.java index 493c7c5b2..fbe582523 100644 --- a/src/com/android/gallery3d/ui/ActionModeHandler.java +++ b/src/com/android/gallery3d/ui/ActionModeHandler.java @@ -188,16 +188,18 @@ public class ActionModeHandler implements ActionMode.Callback { operation &= SUPPORT_MULTIPLE_MASK; } - + final int size = uris.size(); Log.v(TAG, "Sharing intent MIME type=" + mimeType + ", uri size = "+ uris.size()); - if (uris.size() > 1) { - intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType); - intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); - } else { - intent.setAction(Intent.ACTION_SEND).setType(mimeType); - intent.putExtra(Intent.EXTRA_STREAM, uris.get(0)); + if (size > 0) { + if (size > 1) { + intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType); + intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); + } else { + intent.setAction(Intent.ACTION_SEND).setType(mimeType); + intent.putExtra(Intent.EXTRA_STREAM, uris.get(0)); + } + intent.setType(mimeType); } - intent.setType(mimeType); final int supportedOperation = operation; @@ -207,7 +209,7 @@ public class ActionModeHandler implements ActionMode.Callback { mMenuTask = null; MenuExecutor.updateMenuOperation(mMenu, supportedOperation); - if (mShareActionProvider != null) { + if (mShareActionProvider != null && size > 0) { Log.v(TAG, "Sharing intent is ready: action = " + intent.getAction()); mShareActionProvider.setShareIntent(intent); } |