diff options
author | Doris Liu <tianliu@google.com> | 2012-10-18 15:01:35 -0700 |
---|---|---|
committer | Doris Liu <tianliu@google.com> | 2012-10-18 18:14:34 -0700 |
commit | a680a0c32ae3321c632288b36083f2782af2c55b (patch) | |
tree | 3902eb4c97a21646b915f8d320c4eca01ee67420 | |
parent | 79704855fb9b83acf9dc505f9ab1989ec1c770bc (diff) | |
download | android_packages_apps_Gallery2-a680a0c32ae3321c632288b36083f2782af2c55b.tar.gz android_packages_apps_Gallery2-a680a0c32ae3321c632288b36083f2782af2c55b.tar.bz2 android_packages_apps_Gallery2-a680a0c32ae3321c632288b36083f2782af2c55b.zip |
Adding support for tiny planet in gallery
Bug: 7344427
Change-Id: I6fad734b28022f45cc551d81212ee4d3a0c867b2
-rw-r--r-- | res/drawable-hdpi/ic_menu_tiny_planet.png | bin | 0 -> 2425 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_menu_tiny_planet.png | bin | 0 -> 1485 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_menu_tiny_planet.png | bin | 0 -> 3386 bytes | |||
-rw-r--r-- | res/layout/photopage_bottom_controls.xml | 13 | ||||
-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 |
7 files changed, 48 insertions, 8 deletions
diff --git a/res/drawable-hdpi/ic_menu_tiny_planet.png b/res/drawable-hdpi/ic_menu_tiny_planet.png Binary files differnew file mode 100644 index 000000000..12a05511c --- /dev/null +++ b/res/drawable-hdpi/ic_menu_tiny_planet.png diff --git a/res/drawable-mdpi/ic_menu_tiny_planet.png b/res/drawable-mdpi/ic_menu_tiny_planet.png Binary files differnew file mode 100644 index 000000000..f3c3030c1 --- /dev/null +++ b/res/drawable-mdpi/ic_menu_tiny_planet.png diff --git a/res/drawable-xhdpi/ic_menu_tiny_planet.png b/res/drawable-xhdpi/ic_menu_tiny_planet.png Binary files differnew file mode 100644 index 000000000..565c7d26b --- /dev/null +++ b/res/drawable-xhdpi/ic_menu_tiny_planet.png diff --git a/res/layout/photopage_bottom_controls.xml b/res/layout/photopage_bottom_controls.xml index 1883b8e8d..8fe594d7c 100644 --- a/res/layout/photopage_bottom_controls.xml +++ b/res/layout/photopage_bottom_controls.xml @@ -34,4 +34,17 @@ android:paddingLeft="5dp" android:paddingRight="5dp" android:visibility="gone"/> + <ImageButton + android:id="@+id/photopage_bottom_control_tiny_planet" + android:src="@drawable/ic_menu_tiny_planet" + android:background="@drawable/photopage_bottom_button_background" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" + android:paddingTop="5dp" + android:paddingBottom="5dp" + android:paddingLeft="15dp" + android:paddingRight="15dp" + android:visibility="gone"/> </RelativeLayout> 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)); } } |