• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Gallery2


Commit MetaInfo

修订版67f9cd0df453240e51e450b8cc991c8a8d5b7fdd (tree)
时间2011-09-20 01:44:24
作者Ray Chen <raychen@goog...>
CommiterAndroid Git Automerger

Log Message

am acbab5b1: Merge "Fix 5291553 Not able to share downloaded image file"

* commit 'acbab5b17f393e57f7466e5459fed41f518e2864':

Fix 5291553 Not able to share downloaded image file

更改概述

差异

--- 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
8585 private FilmStripView mFilmStripView;
8686 private DetailsHelper mDetailsHelper;
8787 private boolean mShowDetails;
88+ private Path mPendingSharePath;
8889
8990 // mMediaSet could be null if there is no KEY_MEDIA_SET_PATH supplied.
9091 // E.g., viewing a photo in gmail attachment
@@ -240,6 +241,7 @@ public class PhotoPage extends ActivityState
240241 mPhotoView.setModel(mModel);
241242 updateCurrentPhoto(mediaItem);
242243 }
244+
243245 mHandler = new SynchronizedHandler(mActivity.getGLRoot()) {
244246 @Override
245247 public void handleMessage(Message message) {
@@ -257,6 +259,21 @@ public class PhotoPage extends ActivityState
257259 mPhotoView.setOpenedItem(itemPath);
258260 }
259261
262+ private void updateShareURI(Path path) {
263+ if (mShareActionProvider != null) {
264+ DataManager manager = mActivity.getDataManager();
265+ int type = manager.getMediaType(path);
266+ Intent intent = new Intent(Intent.ACTION_SEND);
267+ intent.setType(MenuExecutor.getMimeType(type));
268+ intent.putExtra(Intent.EXTRA_STREAM, manager.getContentUri(path));
269+ mShareActionProvider.setShareIntent(intent);
270+ mPendingSharePath = null;
271+ } else {
272+ // This happens when ActionBar is not created yet.
273+ mPendingSharePath = path;
274+ }
275+ }
276+
260277 private void setTitle(String title) {
261278 if (title == null) return;
262279 boolean showTitle = mActivity.getAndroidContext().getResources().getBoolean(
@@ -276,19 +293,10 @@ public class PhotoPage extends ActivityState
276293 mDetailsHelper.reloadDetails(mModel.getCurrentIndex());
277294 }
278295 setTitle(photo.getName());
279- mPhotoView.showVideoPlayIcon(photo.getMediaType()
280- == MediaObject.MEDIA_TYPE_VIDEO);
296+ mPhotoView.showVideoPlayIcon(
297+ photo.getMediaType() == MediaObject.MEDIA_TYPE_VIDEO);
281298
282- // If we have an ActionBar then we update the share intent
283- if (mShareActionProvider != null) {
284- Path path = photo.getPath();
285- DataManager manager = mActivity.getDataManager();
286- int type = manager.getMediaType(path);
287- Intent intent = new Intent(Intent.ACTION_SEND);
288- intent.setType(MenuExecutor.getMimeType(type));
289- intent.putExtra(Intent.EXTRA_STREAM, manager.getContentUri(path));
290- mShareActionProvider.setShareIntent(intent);
291- }
299+ updateShareURI(photo.getPath());
292300 }
293301
294302 private void updateMenuOperations() {
@@ -384,6 +392,7 @@ public class PhotoPage extends ActivityState
384392 menu.findItem(R.id.action_slideshow).setVisible(
385393 mMediaSet != null && !(mMediaSet instanceof MtpDevice));
386394 mShareActionProvider = GalleryActionBar.initializeShareActionProvider(menu);
395+ if (mPendingSharePath != null) updateShareURI(mPendingSharePath);
387396 mMenu = menu;
388397 mShowBars = true;
389398 updateMenuOperations();