summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/PhotoPage.java
diff options
context:
space:
mode:
authorRay Chen <raychen@google.com>2012-03-06 17:24:28 +0800
committerRay Chen <raychen@google.com>2012-03-15 08:50:35 +0800
commitf3f7f56af19f3f04a7daefd16981e5f55e39053d (patch)
treef932b44f1959b36ab2a5cdd62a5bb4453ac05512 /src/com/android/gallery3d/app/PhotoPage.java
parent762f8e20f608bc805d9e9f01fa2c4925f4735cf0 (diff)
downloadandroid_packages_apps_Snap-f3f7f56af19f3f04a7daefd16981e5f55e39053d.tar.gz
android_packages_apps_Snap-f3f7f56af19f3f04a7daefd16981e5f55e39053d.tar.bz2
android_packages_apps_Snap-f3f7f56af19f3f04a7daefd16981e5f55e39053d.zip
Fix 3462852 [UI] When linking from Camera preview - App icon with 'Up' arrow should go to next level up.
Some changes in this CL: 1. ActivityState can decide whether to enable home button and show up arrow 2. ActivityState can handle home_up event on its own 3. Support getContentUri in LocalAlbum (Image/Video Roll) and LocalMergeAlbum (Camera Roll) 4. Gallery supports view action for AlbumPage (Camera Roll) Change-Id: I85a75cdce9cbc2a877651fdec34a0180ed8e785c
Diffstat (limited to 'src/com/android/gallery3d/app/PhotoPage.java')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 3aaa26336..8040a2fc6 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -20,6 +20,7 @@ import android.app.ActionBar;
import android.app.ActionBar.OnMenuVisibilityListener;
import android.app.Activity;
import android.content.ActivityNotFoundException;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
@@ -104,6 +105,7 @@ public class PhotoPage extends ActivityState
private MenuExecutor mMenuExecutor;
private boolean mIsActive;
private ShareActionProvider mShareActionProvider;
+ private String mSetPathString;
public static interface Model extends PhotoView.Model {
public void resume();
@@ -176,16 +178,16 @@ public class PhotoPage extends ActivityState
mRootPane.addComponent(mPhotoView);
mApplication = (GalleryApp)((Activity) mActivity).getApplication();
- String setPathString = data.getString(KEY_MEDIA_SET_PATH);
+ mSetPathString = data.getString(KEY_MEDIA_SET_PATH);
Path itemPath = Path.fromString(data.getString(KEY_MEDIA_ITEM_PATH));
- if (setPathString != null) {
- mMediaSet = mActivity.getDataManager().getMediaSet(setPathString);
+ if (mSetPathString != null) {
+ mMediaSet = mActivity.getDataManager().getMediaSet(mSetPathString);
mCurrentIndex = data.getInt(KEY_INDEX_HINT, 0);
mMediaSet = (MediaSet)
- mActivity.getDataManager().getMediaObject(setPathString);
+ mActivity.getDataManager().getMediaObject(mSetPathString);
if (mMediaSet == null) {
- Log.w(TAG, "failed to restore " + setPathString);
+ Log.w(TAG, "failed to restore " + mSetPathString);
}
PhotoDataAdapter pda = new PhotoDataAdapter(
mActivity, mPhotoView, mMediaSet, itemPath, mCurrentIndex);
@@ -438,6 +440,24 @@ public class PhotoPage extends ActivityState
DataManager manager = mActivity.getDataManager();
int action = item.getItemId();
switch (action) {
+ case android.R.id.home: {
+ if (mSetPathString != null) {
+ if (mActivity.getStateManager().getStateCount() > 1) {
+ onBackPressed();
+ } else {
+ Activity a = (Activity) mActivity;
+ Uri uri = mActivity.getDataManager().getContentUri(
+ Path.fromString(mSetPathString));
+ Intent intent = new Intent(Intent.ACTION_VIEW)
+ .setClass(a, Gallery.class)
+ .setDataAndType(uri, ContentResolver.CURSOR_DIR_BASE_TYPE)
+ .setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
+ Intent.FLAG_ACTIVITY_NEW_TASK);
+ a.startActivity(intent);
+ }
+ }
+ return true;
+ }
case R.id.action_slideshow: {
Bundle data = new Bundle();
data.putString(SlideshowPage.KEY_SET_PATH, mMediaSet.getPath().toString());
@@ -610,6 +630,8 @@ public class PhotoPage extends ActivityState
if (mMenuVisibilityListener == null) {
mMenuVisibilityListener = new MyMenuVisibilityListener();
}
+ mActivity.getGalleryActionBar().setDisplayOptions(mSetPathString != null, true);
+
mActionBar.addOnMenuVisibilityListener(mMenuVisibilityListener);
onUserInteraction();
}