diff options
author | Doris Liu <tianliu@google.com> | 2012-10-18 21:52:49 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-18 21:52:50 -0700 |
commit | 3b50e7b4baceebfea3fb3ccc7aca2966a20d02b9 (patch) | |
tree | 53fbf6b40a5154efc1ca65a36fe9f2196e262bba | |
parent | 5530e2979762541936a2087df57a5fbaab8cc53a (diff) | |
parent | d672d083d1af3e42e0f87c5b0757d714270dcd9e (diff) | |
download | android_packages_apps_Snap-3b50e7b4baceebfea3fb3ccc7aca2966a20d02b9.tar.gz android_packages_apps_Snap-3b50e7b4baceebfea3fb3ccc7aca2966a20d02b9.tar.bz2 android_packages_apps_Snap-3b50e7b4baceebfea3fb3ccc7aca2966a20d02b9.zip |
Merge "Adding support for tiny planet in gallery" into gb-ub-photos-arches
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 32 | ||||
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPageBottomControls.java | 6 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 5 |
3 files changed, 35 insertions, 8 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index c8eaaca4a..b758e8151 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -164,6 +164,10 @@ public class PhotoPage extends ActivityState implements private boolean mInCameraRoll; private boolean mRecenterCameraOnResume = true; + // These are only valid after the panorama callback + private boolean mIsPanorama; + private boolean mIsPanorama360; + private long mCameraSwitchCutoff = 0; private boolean mSkipUpdateCurrentPhoto = false; private static final long CAMERA_SWITCH_CUTOFF_THRESHOLD_MS = 300; @@ -200,7 +204,8 @@ public class PhotoPage extends ActivityState implements public void panoramaInfoAvailable(MediaObject mediaObject, boolean isPanorama, boolean isPanorama360) { if (mediaObject == mCurrentPhoto) { - mHandler.obtainMessage(MSG_REFRESH_BOTTOM_CONTROLS, isPanorama ? 1 : 0, 0, mediaObject).sendToTarget(); + mHandler.obtainMessage(MSG_REFRESH_BOTTOM_CONTROLS, isPanorama ? 1 : 0, isPanorama360 ? 1 : 0, + mediaObject).sendToTarget(); } } }; @@ -299,7 +304,9 @@ public class PhotoPage extends ActivityState implements } case MSG_REFRESH_BOTTOM_CONTROLS: { if (mCurrentPhoto == message.obj && mBottomControls != null) { - mBottomControls.refresh(message.arg1 != 0); + mIsPanorama = message.arg1 == 1; + mIsPanorama360 = message.arg2 == 1; + mBottomControls.refresh(); } break; } @@ -584,7 +591,7 @@ public class PhotoPage extends ActivityState implements } @Override - public boolean canDisplayBottomControl(int control, boolean isPanorama) { + public boolean canDisplayBottomControl(int control) { if (mCurrentPhoto == null) { return false; } @@ -594,7 +601,10 @@ public class PhotoPage extends ActivityState implements && (mCurrentPhoto.getSupportedOperations() & MediaItem.SUPPORT_EDIT) != 0 && mCurrentPhoto.getMediaType() == MediaObject.MEDIA_TYPE_IMAGE; case R.id.photopage_bottom_control_panorama: - return isPanorama; + return mIsPanorama; + case R.id.photopage_bottom_control_tiny_planet: + return mHaveImageEditor && mShowBars + && mIsPanorama360; default: return false; } @@ -611,6 +621,9 @@ public class PhotoPage extends ActivityState implements mActivity.getPanoramaViewHelper() .showPanorama(mCurrentPhoto.getContentUri()); return; + case R.id.photopage_bottom_control_tiny_planet: + launchTinyPlanet(); + return; default: return; } @@ -651,6 +664,17 @@ public class PhotoPage extends ActivityState implements .addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); } + private void launchTinyPlanet() { + // Deep link into tiny planet + MediaItem current = mModel.getMediaItem(0); + Intent intent = new Intent(FilterShowActivity.TINY_PLANET_ACTION); + intent.setClass(mActivity, FilterShowActivity.class); + intent.setDataAndType(current.getContentUri(), current.getMimeType()) + .setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + mRecenterCameraOnResume = false; + mActivity.startActivityForResult(intent, REQUEST_EDIT); + } + private void launchPhotoEditor() { MediaItem current = mModel.getMediaItem(0); if (current == null || (current.getSupportedOperations() diff --git a/src/com/android/gallery3d/app/PhotoPageBottomControls.java b/src/com/android/gallery3d/app/PhotoPageBottomControls.java index e58e454ac..f416fe52f 100644 --- a/src/com/android/gallery3d/app/PhotoPageBottomControls.java +++ b/src/com/android/gallery3d/app/PhotoPageBottomControls.java @@ -33,7 +33,7 @@ import java.util.Map; public class PhotoPageBottomControls implements OnClickListener { public interface Delegate { public boolean canDisplayBottomControls(); - public boolean canDisplayBottomControl(int control, boolean isPanorama); + public boolean canDisplayBottomControl(int control); public void onBottomControlClicked(int control); public void refreshBottomControlsWhenReady(); } @@ -93,7 +93,7 @@ public class PhotoPageBottomControls implements OnClickListener { mContainer.setVisibility(View.VISIBLE); } - public void refresh(boolean isPanorama) { + public void refresh() { boolean visible = mDelegate.canDisplayBottomControls(); boolean containerVisibilityChanged = (visible != mContainerVisible); if (containerVisibilityChanged) { @@ -109,7 +109,7 @@ public class PhotoPageBottomControls implements OnClickListener { } for (View control : mControlsVisible.keySet()) { Boolean prevVisibility = mControlsVisible.get(control); - boolean curVisibility = mDelegate.canDisplayBottomControl(control.getId(), isPanorama); + boolean curVisibility = mDelegate.canDisplayBottomControl(control.getId()); if (prevVisibility.booleanValue() != curVisibility) { if (!containerVisibilityChanged) { control.clearAnimation(); diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 277859fdd..9d4635e2b 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -78,6 +78,7 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, OnShareTargetSelectedListener { public static final String CROP_ACTION = "com.android.camera.action.CROP"; + public static final String TINY_PLANET_ACTION = "com.android.camera.action.TINY_PLANET"; private final PanelController mPanelController = new PanelController(); private ImageLoader mImageLoader = null; private ImageShow mImageShow = null; @@ -345,8 +346,10 @@ public class FilterShowActivity extends Activity implements OnItemClickListener, } String action = intent.getAction(); - if (action == CROP_ACTION){ + if (action.equalsIgnoreCase(CROP_ACTION)){ mPanelController.showComponent(findViewById(R.id.cropButton)); + } else if (action.equalsIgnoreCase(TINY_PLANET_ACTION)) { + mPanelController.showComponent(findViewById(R.id.tinyplanetButton)); } } |