summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2011-09-18 21:37:26 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-18 21:37:26 -0700
commit350646b3edc73227bfcd1024202cc0fe0405c1b9 (patch)
tree07769509a1b1a86f9b993baa55892ece6d805057 /src/com/android/gallery3d/app
parentf95aed139ef3292948f1ade97cc48312a62fc30d (diff)
parent414190774a73ba9029808f946a4ee066628862d7 (diff)
downloadandroid_packages_apps_Snap-350646b3edc73227bfcd1024202cc0fe0405c1b9.tar.gz
android_packages_apps_Snap-350646b3edc73227bfcd1024202cc0fe0405c1b9.tar.bz2
android_packages_apps_Snap-350646b3edc73227bfcd1024202cc0fe0405c1b9.zip
Merge "Fix 5291553 Not able to share downloaded image file"
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java33
1 files changed, 21 insertions, 12 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index a3b385ac0..44b9299fc 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -85,6 +85,7 @@ public class PhotoPage extends ActivityState
private FilmStripView mFilmStripView;
private DetailsHelper mDetailsHelper;
private boolean mShowDetails;
+ private Path mPendingSharePath;
// mMediaSet could be null if there is no KEY_MEDIA_SET_PATH supplied.
// E.g., viewing a photo in gmail attachment
@@ -240,6 +241,7 @@ public class PhotoPage extends ActivityState
mPhotoView.setModel(mModel);
updateCurrentPhoto(mediaItem);
}
+
mHandler = new SynchronizedHandler(mActivity.getGLRoot()) {
@Override
public void handleMessage(Message message) {
@@ -257,6 +259,21 @@ public class PhotoPage extends ActivityState
mPhotoView.setOpenedItem(itemPath);
}
+ private void updateShareURI(Path path) {
+ if (mShareActionProvider != null) {
+ DataManager manager = mActivity.getDataManager();
+ int type = manager.getMediaType(path);
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType(MenuExecutor.getMimeType(type));
+ intent.putExtra(Intent.EXTRA_STREAM, manager.getContentUri(path));
+ mShareActionProvider.setShareIntent(intent);
+ mPendingSharePath = null;
+ } else {
+ // This happens when ActionBar is not created yet.
+ mPendingSharePath = path;
+ }
+ }
+
private void setTitle(String title) {
if (title == null) return;
boolean showTitle = mActivity.getAndroidContext().getResources().getBoolean(
@@ -276,19 +293,10 @@ public class PhotoPage extends ActivityState
mDetailsHelper.reloadDetails(mModel.getCurrentIndex());
}
setTitle(photo.getName());
- mPhotoView.showVideoPlayIcon(photo.getMediaType()
- == MediaObject.MEDIA_TYPE_VIDEO);
+ mPhotoView.showVideoPlayIcon(
+ photo.getMediaType() == MediaObject.MEDIA_TYPE_VIDEO);
- // If we have an ActionBar then we update the share intent
- if (mShareActionProvider != null) {
- Path path = photo.getPath();
- DataManager manager = mActivity.getDataManager();
- int type = manager.getMediaType(path);
- Intent intent = new Intent(Intent.ACTION_SEND);
- intent.setType(MenuExecutor.getMimeType(type));
- intent.putExtra(Intent.EXTRA_STREAM, manager.getContentUri(path));
- mShareActionProvider.setShareIntent(intent);
- }
+ updateShareURI(photo.getPath());
}
private void updateMenuOperations() {
@@ -384,6 +392,7 @@ public class PhotoPage extends ActivityState
menu.findItem(R.id.action_slideshow).setVisible(
mMediaSet != null && !(mMediaSet instanceof MtpDevice));
mShareActionProvider = GalleryActionBar.initializeShareActionProvider(menu);
+ if (mPendingSharePath != null) updateShareURI(mPendingSharePath);
mMenu = menu;
mShowBars = true;
updateMenuOperations();