OSDN Git Service

Shows image filename passed from other apps.
authorPin Ting <pinting@google.com>
Wed, 18 Jan 2012 09:19:42 +0000 (17:19 +0800)
committerPin Ting <pinting@google.com>
Thu, 2 Feb 2012 04:46:59 +0000 (12:46 +0800)
bug:5796182
This change will be followed up by a change to the class
android.content.Intent.
Change-Id: I3c607c535a4e90d867a98528118d1b6f10fa45cf

src/com/android/gallery3d/app/Gallery.java

index 253af2b..7ab7628 100644 (file)
@@ -201,6 +201,14 @@ public final class Gallery extends AbstractGalleryActivity implements OnCancelLi
                             albumPath.toString());
                 }
                 data.putString(PhotoPage.KEY_MEDIA_ITEM_PATH, itemPath.toString());
+
+                // Displays the filename as title, which is passed through intent from other apps.
+                // If other apps don't set this value, just display empty string.
+                // TODO: modify the javadoc of android.content.Intent.EXTRA_TITLE to include this
+                // usage
+                final String title = intent.getStringExtra(Intent.EXTRA_TITLE);
+                setTitle((title != null) ? title : "");
+
                 getStateManager().startState(PhotoPage.class, data);
             }
         }