diff options
author | Chih-Chung Chang <chihchung@google.com> | 2012-05-09 21:17:10 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2012-05-09 21:17:10 +0800 |
commit | 82f7ac999aae05b251cfe2c886020780832cd4a3 (patch) | |
tree | d025462eb456fc3fb63a1ac0f18d4080fc9923e0 /src/com/android/gallery3d/app | |
parent | ebf0f78490f851766f643d3d45fa351f4e92e091 (diff) | |
download | android_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')
-rw-r--r-- | src/com/android/gallery3d/app/AppBridge.java | 2 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 32 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/com/android/gallery3d/app/AppBridge.java b/src/com/android/gallery3d/app/AppBridge.java index e8cf8731b..90cbd0bbb 100644 --- a/src/com/android/gallery3d/app/AppBridge.java +++ b/src/com/android/gallery3d/app/AppBridge.java @@ -57,6 +57,8 @@ public abstract class AppBridge implements Parcelable { public boolean switchWithCaptureAnimation(int offset); // Enable or disable the swiping gestures (the default is enabled). public void setSwipingEnabled(boolean enabled); + // Notify that the ScreenNail is changed. + public void notifyScreenNailChanged(); } // If server is null, the services are not available. 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); |