summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2012-05-17 12:47:26 -0700
committerAngus Kong <shkong@google.com>2012-05-17 13:09:09 -0700
commit5d895388e23ffe73c10a08b4b1039c0251e569cb (patch)
tree71b911375304e2a07e2fcfa83ccc27194c6f012a /src
parent3aad1aba14d3abe8324e0a0e129627d51a466bc4 (diff)
downloadandroid_packages_apps_Snap-5d895388e23ffe73c10a08b4b1039c0251e569cb.tar.gz
android_packages_apps_Snap-5d895388e23ffe73c10a08b4b1039c0251e569cb.tar.bz2
android_packages_apps_Snap-5d895388e23ffe73c10a08b4b1039c0251e569cb.zip
Support Panorama preview.
The panorama preview doesn't consider display rotation. bug:6305152 Change-Id: I6389a74d3c0e64d8b6bc206e728d1088f04be225
Diffstat (limited to 'src')
-rw-r--r--src/com/android/gallery3d/app/AppBridge.java1
-rw-r--r--src/com/android/gallery3d/app/PhotoDataAdapter.java10
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java3
-rw-r--r--src/com/android/gallery3d/app/SinglePhotoDataAdapter.java5
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java19
5 files changed, 34 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/app/AppBridge.java b/src/com/android/gallery3d/app/AppBridge.java
index 90cbd0bbb..5d6b1ec52 100644
--- a/src/com/android/gallery3d/app/AppBridge.java
+++ b/src/com/android/gallery3d/app/AppBridge.java
@@ -34,6 +34,7 @@ public abstract class AppBridge implements Parcelable {
// These are requests sent from PhotoPage to the app
//////////////////////////////////////////////////////////////////////////
+ public abstract boolean isPanorama();
public abstract ScreenNail attachScreenNail();
public abstract void detachScreenNail();
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java
index a0c4cdf6a..66b423f69 100644
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -147,6 +147,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
private int mSize = 0;
private Path mItemPath;
private int mCameraIndex;
+ private boolean mIsPanorama;
private boolean mIsActive;
private boolean mNeedFullImage;
@@ -164,12 +165,14 @@ public class PhotoDataAdapter implements PhotoPage.Model {
// find the image being viewed. cameraIndex is the index of the camera
// preview. If cameraIndex < 0, there is no camera preview.
public PhotoDataAdapter(GalleryActivity activity, PhotoView view,
- MediaSet mediaSet, Path itemPath, int indexHint, int cameraIndex) {
+ MediaSet mediaSet, Path itemPath, int indexHint, int cameraIndex,
+ boolean isPanorama) {
mSource = Utils.checkNotNull(mediaSet);
mPhotoView = Utils.checkNotNull(view);
mItemPath = Utils.checkNotNull(itemPath);
mCurrentIndex = indexHint;
mCameraIndex = cameraIndex;
+ mIsPanorama = isPanorama;
mThreadPool = activity.getThreadPool();
mNeedFullImage = true;
@@ -429,6 +432,11 @@ public class PhotoDataAdapter implements PhotoPage.Model {
}
@Override
+ public boolean isPanorama(int offset) {
+ return isCamera(offset) && mIsPanorama;
+ }
+
+ @Override
public boolean isVideo(int offset) {
MediaItem item = getItem(mCurrentIndex + offset);
return (item == null)
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index d344558ce..1778f261b 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -216,7 +216,8 @@ public class PhotoPage extends ActivityState implements
}
PhotoDataAdapter pda = new PhotoDataAdapter(
mActivity, mPhotoView, mMediaSet, itemPath, mCurrentIndex,
- mAppBridge == null ? -1 : 0);
+ mAppBridge == null ? -1 : 0,
+ mAppBridge == null ? false : mAppBridge.isPanorama());
mModel = pda;
mPhotoView.setModel(mModel);
diff --git a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
index 179c93043..f26f405d4 100644
--- a/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java
@@ -190,6 +190,11 @@ public class SinglePhotoDataAdapter extends TileImageViewAdapter
}
@Override
+ public boolean isPanorama(int offset) {
+ return false;
+ }
+
+ @Override
public boolean isVideo(int offset) {
return mItem.getMediaType() == MediaItem.MEDIA_TYPE_VIDEO;
}
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 1610a1274..46d7c9362 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -71,6 +71,9 @@ public class PhotoView extends GLView {
// Returns true if the item is the Camera preview.
public boolean isCamera(int offset);
+ // Returns true if the item is the Panorama.
+ public boolean isPanorama(int offset);
+
// Returns true if the item is a Video.
public boolean isVideo(int offset);
}
@@ -403,6 +406,10 @@ public class PhotoView extends GLView {
return (mCompensation - mDisplayRotation + 360) % 360;
}
+ private int getPanoramaRotation() {
+ return mCompensation;
+ }
+
////////////////////////////////////////////////////////////////////////////
// Pictures
////////////////////////////////////////////////////////////////////////////
@@ -418,6 +425,7 @@ public class PhotoView extends GLView {
class FullPicture implements Picture {
private int mRotation;
private boolean mIsCamera;
+ private boolean mIsPanorama;
private boolean mIsVideo;
private boolean mWasCameraCenter;
@@ -431,6 +439,7 @@ public class PhotoView extends GLView {
mTileView.notifyModelInvalidated();
mIsCamera = mModel.isCamera(0);
+ mIsPanorama = mModel.isPanorama(0);
mIsVideo = mModel.isVideo(0);
setScreenNail(mModel.getScreenNail(0));
updateSize(false);
@@ -439,7 +448,9 @@ public class PhotoView extends GLView {
@Override
public void updateSize(boolean force) {
- if (mIsCamera) {
+ if (mIsPanorama) {
+ mRotation = getPanoramaRotation();
+ } else if (mIsCamera) {
mRotation = getCameraRotation();
} else {
mRotation = mModel.getImageRotation(0);
@@ -629,6 +640,7 @@ public class PhotoView extends GLView {
private ScreenNail mScreenNail;
private Size mSize = new Size();
private boolean mIsCamera;
+ private boolean mIsPanorama;
private boolean mIsVideo;
public ScreenNailPicture(int index) {
@@ -638,6 +650,7 @@ public class PhotoView extends GLView {
@Override
public void reload() {
mIsCamera = mModel.isCamera(mIndex);
+ mIsPanorama = mModel.isPanorama(mIndex);
mIsVideo = mModel.isVideo(mIndex);
setScreenNail(mModel.getScreenNail(mIndex));
}
@@ -703,7 +716,9 @@ public class PhotoView extends GLView {
@Override
public void updateSize(boolean force) {
- if (mIsCamera) {
+ if (mIsPanorama) {
+ mRotation = getPanoramaRotation();
+ } else if (mIsCamera) {
mRotation = getCameraRotation();
} else {
mRotation = mModel.getImageRotation(mIndex);