diff options
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 20 | ||||
-rw-r--r-- | src/com/android/gallery3d/data/LocalImage.java | 7 | ||||
-rw-r--r-- | src/com/android/gallery3d/data/MediaObject.java | 1 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/AbstractSlotRenderer.java | 8 | ||||
-rw-r--r-- | src/com/android/gallery3d/ui/PhotoView.java | 15 |
5 files changed, 40 insertions, 11 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 71f886129..d101aac7b 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -37,9 +37,11 @@ import com.actionbarsherlock.view.MenuItem; import com.android.gallery3d.R; import com.android.gallery3d.anim.FloatAnimation; import com.android.gallery3d.common.ApiHelper; +import com.android.gallery3d.common.LightCycleHelper; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.DataManager; import com.android.gallery3d.data.FilterDeleteSet; +import com.android.gallery3d.data.LocalImage; import com.android.gallery3d.data.MediaDetails; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; @@ -182,15 +184,15 @@ public class PhotoPage extends ActivityState implements private final GLView mRootPane = new GLView() { @Override protected void renderBackground(GLCanvas view) { - if(mFadeOutTexture != null) { - if(mBackgroundFade.calculate(AnimationTime.get())) invalidate(); - if(!mBackgroundFade.isActive()) { + if (mFadeOutTexture != null) { + if (mBackgroundFade.calculate(AnimationTime.get())) invalidate(); + if (!mBackgroundFade.isActive()) { mFadeOutTexture = null; mOpenAnimationRect = null; BitmapScreenNail.enableDrawPlaceholder(); } else { float fadeAlpha = mBackgroundFade.get(); - if(fadeAlpha < 1f) { + if (fadeAlpha < 1f) { view.clearBuffer(getBackgroundColor()); view.setAlpha(fadeAlpha); } @@ -224,7 +226,7 @@ public class PhotoPage extends ActivityState implements mPhotoView = new PhotoView(mActivity); mPhotoView.setListener(this); mRootPane.addComponent(mPhotoView); - mApplication = (GalleryApp)((Activity) mActivity).getApplication(); + mApplication = (GalleryApp) ((Activity) mActivity).getApplication(); mOrientationManager = mActivity.getOrientationManager(); mOrientationManager.addListener(this); mActivity.getGLRoot().setOrientationSource(mOrientationManager); @@ -364,7 +366,7 @@ public class PhotoPage extends ActivityState implements // start the opening animation only if it's not restored. if (restoreState == null) { mFadeOutTexture = mActivity.getTransitionStore().get(AlbumPage.KEY_FADE_TEXTURE); - if(mFadeOutTexture != null) { + if (mFadeOutTexture != null) { mBackgroundFade.start(); BitmapScreenNail.disableDrawPlaceholder(); mOpenAnimationRect = (Rect) data.getParcelable(KEY_OPEN_ANIMATION_RECT); @@ -751,6 +753,8 @@ public class PhotoPage extends ActivityState implements boolean playVideo = (mSecureAlbum == null) && ((item.getSupportedOperations() & MediaItem.SUPPORT_PLAY) != 0); + boolean viewPanorama = + (item.getSupportedOperations() & MediaItem.SUPPORT_VIEW_PANORAMA) != 0; if (playVideo) { // determine if the point is at center (1/6) of the photo view. @@ -763,6 +767,10 @@ public class PhotoPage extends ActivityState implements if (playVideo) { playVideo(mActivity, item.getPlayUri(), item.getName()); + } else if (viewPanorama) { + LocalImage img = (LocalImage) item; + LightCycleHelper.viewPanorama( + mActivity, img.getContentUri(), img.getMimeType()); } else { toggleBars(); } diff --git a/src/com/android/gallery3d/data/LocalImage.java b/src/com/android/gallery3d/data/LocalImage.java index b10b96289..93287bca1 100644 --- a/src/com/android/gallery3d/data/LocalImage.java +++ b/src/com/android/gallery3d/data/LocalImage.java @@ -34,6 +34,7 @@ import android.util.Log; import com.android.gallery3d.app.GalleryApp; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.BitmapUtils; +import com.android.gallery3d.common.LightCycleHelper; import com.android.gallery3d.util.GalleryUtils; import com.android.gallery3d.util.ThreadPool.Job; import com.android.gallery3d.util.ThreadPool.JobContext; @@ -239,6 +240,12 @@ public class LocalImage extends LocalMediaItem { if (GalleryUtils.isValidLocation(latitude, longitude)) { operation |= SUPPORT_SHOW_ON_MAP; } + + if (LightCycleHelper.isPanorama(caption) && + LightCycleHelper.hasLightCycleView( + mApplication.getAndroidContext().getPackageManager())) { + operation |= SUPPORT_VIEW_PANORAMA; + } return operation; } diff --git a/src/com/android/gallery3d/data/MediaObject.java b/src/com/android/gallery3d/data/MediaObject.java index 45f425fdd..87f567d7a 100644 --- a/src/com/android/gallery3d/data/MediaObject.java +++ b/src/com/android/gallery3d/data/MediaObject.java @@ -37,6 +37,7 @@ public abstract class MediaObject { public static final int SUPPORT_INFO = 1 << 10; public static final int SUPPORT_IMPORT = 1 << 11; public static final int SUPPORT_TRIM = 1 << 12; + public static final int SUPPORT_VIEW_PANORAMA = 1 << 13; public static final int SUPPORT_ALL = 0xffffffff; // These are the bits returned from getMediaType(): diff --git a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java index 98eae568b..c36847d69 100644 --- a/src/com/android/gallery3d/ui/AbstractSlotRenderer.java +++ b/src/com/android/gallery3d/ui/AbstractSlotRenderer.java @@ -42,15 +42,13 @@ public abstract class AbstractSlotRenderer implements SlotView.SlotRenderer { Texture content, int width, int height, int rotation) { canvas.save(GLCanvas.SAVE_FLAG_MATRIX); + // The content is always rendered in to the largest square that fits + // inside the slot, aligned to the top of the slot. + width = height = Math.min(width, height); if (rotation != 0) { canvas.translate(width / 2, height / 2); canvas.rotate(rotation, 0, 0, 1); canvas.translate(-width / 2, -height / 2); - if (((rotation % 90) & 1) != 0) { - int temp = height; - height = width; - width = height; - } } // Fit the content into the box diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java index 25d3154a9..5c4c1e970 100644 --- a/src/com/android/gallery3d/ui/PhotoView.java +++ b/src/com/android/gallery3d/ui/PhotoView.java @@ -21,6 +21,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; +import android.os.Build; import android.os.Message; import android.util.FloatMath; import android.view.MotionEvent; @@ -29,6 +30,7 @@ import android.view.animation.AccelerateInterpolator; import com.android.gallery3d.R; import com.android.gallery3d.app.AbstractGalleryActivity; +import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.Utils; import com.android.gallery3d.data.MediaItem; import com.android.gallery3d.data.MediaObject; @@ -945,6 +947,19 @@ public class PhotoView extends GLView { @Override public boolean onSingleTapUp(float x, float y) { + // On crespo running Android 2.3.6 (gingerbread), a pinch out gesture results in the + // following call sequence: onDown(), onUp() and then onSingleTapUp(). The correct + // sequence for a single-tap-up gesture should be: onDown(), onSingleTapUp() and onUp(). + // The call sequence for a pinch out gesture in JB is: onDown(), then onUp() and there's + // no onSingleTapUp(). Base on these observations, the following condition is added to + // filter out the false alarm where onSingleTapUp() is called within a pinch out + // gesture. The framework fix went into ICS. Refer to b/4588114. + if (Build.VERSION.SDK_INT < ApiHelper.VERSION_CODES.ICE_CREAM_SANDWICH) { + if ((mHolding & HOLD_TOUCH_DOWN) == 0) { + return true; + } + } + // We do this in addition to onUp() because we want the snapback of // setFilmMode to happen. mHolding &= ~HOLD_TOUCH_DOWN; |