summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app/PhotoPage.java
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2012-05-09 21:17:10 +0800
committerChih-Chung Chang <chihchung@google.com>2012-05-09 21:17:10 +0800
commit82f7ac999aae05b251cfe2c886020780832cd4a3 (patch)
treed025462eb456fc3fb63a1ac0f18d4080fc9923e0 /src/com/android/gallery3d/app/PhotoPage.java
parentebf0f78490f851766f643d3d45fa351f4e92e091 (diff)
downloadandroid_packages_apps_Snap-82f7ac999aae05b251cfe2c886020780832cd4a3.tar.gz
android_packages_apps_Snap-82f7ac999aae05b251cfe2c886020780832cd4a3.tar.bz2
android_packages_apps_Snap-82f7ac999aae05b251cfe2c886020780832cd4a3.zip
Handle ScreenNail size change.
Bug: 6355399 Change-Id: Ice7560c12aa06cf8ac58cc3883f0888b5c6e71a5
Diffstat (limited to 'src/com/android/gallery3d/app/PhotoPage.java')
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 783d0ed25..3f9f05728 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -44,6 +44,8 @@ import com.android.gallery3d.data.MediaObject;
import com.android.gallery3d.data.MediaSet;
import com.android.gallery3d.data.MtpDevice;
import com.android.gallery3d.data.Path;
+import com.android.gallery3d.data.SnailAlbum;
+import com.android.gallery3d.data.SnailItem;
import com.android.gallery3d.data.SnailSource;
import com.android.gallery3d.picasasource.PicasaSource;
import com.android.gallery3d.ui.DetailsHelper;
@@ -116,8 +118,8 @@ public class PhotoPage extends ActivityState implements
// This is the original mSetPathString before adding the camera preview item.
private String mOriginalSetPathString;
private AppBridge mAppBridge;
- private ScreenNail mScreenNail;
- private MediaItem mScreenNailItem;
+ private SnailItem mScreenNailItem;
+ private SnailAlbum mScreenNailSet;
private OrientationManager mOrientationManager;
private NfcAdapter mNfcAdapter;
@@ -180,14 +182,17 @@ public class PhotoPage extends ActivityState implements
mOrientationManager.lockOrientation();
// Get the ScreenNail from AppBridge and register it.
- mScreenNail = mAppBridge.attachScreenNail();
- int id = SnailSource.registerScreenNail(mScreenNail);
+ int id = SnailSource.newId();
Path screenNailSetPath = SnailSource.getSetPath(id);
Path screenNailItemPath = SnailSource.getItemPath(id);
- mScreenNailItem = (MediaItem) mActivity.getDataManager()
+ mScreenNailSet = (SnailAlbum) mActivity.getDataManager()
+ .getMediaObject(screenNailSetPath);
+ mScreenNailItem = (SnailItem) mActivity.getDataManager()
.getMediaObject(screenNailItemPath);
+ mScreenNailItem.setScreenNail(mAppBridge.attachScreenNail());
- // Combine the original MediaSet with the one for CameraScreenNail.
+ // Combine the original MediaSet with the one for ScreenNail
+ // from AppBridge.
mSetPathString = "/combo/item/{" + screenNailSetPath +
"," + mSetPathString + "}";
@@ -427,8 +432,7 @@ public class PhotoPage extends ActivityState implements
protected void onBackPressed() {
if (mShowDetails) {
hideDetails();
- } else if (mScreenNail == null
- || !switchWithCaptureAnimation(-1)) {
+ } else if (mAppBridge == null || !switchWithCaptureAnimation(-1)) {
// We are leaving this page. Set the result now.
setResult();
super.onBackPressed();
@@ -490,6 +494,12 @@ public class PhotoPage extends ActivityState implements
}
@Override
+ public void notifyScreenNailChanged() {
+ mScreenNailItem.setScreenNail(mAppBridge.attachScreenNail());
+ mScreenNailSet.notifyChange();
+ }
+
+ @Override
protected boolean onCreateActionBar(Menu menu) {
MenuInflater inflater = ((Activity) mActivity).getMenuInflater();
inflater.inflate(R.menu.photo, menu);
@@ -744,11 +754,11 @@ public class PhotoPage extends ActivityState implements
@Override
protected void onDestroy() {
if (mAppBridge != null) {
- // Unregister the ScreenNail and notify mAppBridge.
- SnailSource.unregisterScreenNail(mScreenNail);
+ mScreenNailItem.setScreenNail(null);
mAppBridge.detachScreenNail();
mAppBridge = null;
- mScreenNail = null;
+ mScreenNailSet = null;
+ mScreenNailItem = null;
}
mOrientationManager.removeListener(this);
mActivity.getGLRoot().setOrientationSource(null);