summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBobby Georgescu <georgescu@google.com>2012-10-02 18:34:08 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-03 00:16:06 -0700
commit4216866c697760da809b6912fb40c146905ce5a3 (patch)
tree6c976250db230dc352439aee1786062ea302d295
parent66fdb16ff418043db62b240a156aac27bbc0a7ee (diff)
downloadandroid_packages_apps_Snap-4216866c697760da809b6912fb40c146905ce5a3.tar.gz
android_packages_apps_Snap-4216866c697760da809b6912fb40c146905ce5a3.tar.bz2
android_packages_apps_Snap-4216866c697760da809b6912fb40c146905ce5a3.zip
Correct behavior when swiping to placeholder item in PhotoPage
Bug: 7261641 Change-Id: I54deed0f20a4673cb5470ffc128c73cddc071772
-rw-r--r--src/com/android/gallery3d/app/PhotoPage.java21
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java14
2 files changed, 21 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 6d05df167..3c64fa32b 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -92,6 +92,7 @@ public class PhotoPage extends ActivityState implements
private static final int MSG_WANT_BARS = 7;
private static final int MSG_REFRESH_BOTTOM_CONTROLS = 8;
private static final int MSG_ON_CAMERA_CENTER = 9;
+ private static final int MSG_ON_PICTURE_CENTER = 10;
private static final int HIDE_BARS_TIMEOUT = 3500;
private static final int UNFREEZE_GLROOT_TIMEOUT = 250;
@@ -311,6 +312,13 @@ public class PhotoPage extends ActivityState implements
}
break;
}
+ case MSG_ON_PICTURE_CENTER: {
+ if (mCurrentPhoto != null
+ && (mCurrentPhoto.getSupportedOperations() & MediaObject.SUPPORT_ACTION) != 0) {
+ mPhotoView.setFilmMode(true);
+ }
+ break;
+ }
default: throw new AssertionError(message.what);
}
}
@@ -417,9 +425,7 @@ public class PhotoPage extends ActivityState implements
mCurrentIndex = index;
if (mAppBridge != null) {
- mPhotoView.setWantCameraCenterCallbacks(true);
if (mCurrentIndex > 0) {
- mHandler.removeMessages(MSG_ON_CAMERA_CENTER);
mSkipUpdateCurrentPhoto = false;
}
@@ -431,6 +437,7 @@ public class PhotoPage extends ActivityState implements
CAMERA_SWITCH_CUTOFF_THRESHOLD_MS;
mPhotoView.stopScrolling();
} else if (oldIndex == 1 && mCurrentIndex == 0) {
+ mPhotoView.setWantPictureCenterCallbacks(true);
mSkipUpdateCurrentPhoto = true;
}
}
@@ -483,9 +490,11 @@ public class PhotoPage extends ActivityState implements
}
}
- public void onCameraCenter() {
- mPhotoView.setWantCameraCenterCallbacks(false);
- mHandler.sendEmptyMessage(MSG_ON_CAMERA_CENTER);
+ public void onPictureCenter(boolean isCamera) {
+ mPhotoView.setWantPictureCenterCallbacks(false);
+ mHandler.removeMessages(MSG_ON_CAMERA_CENTER);
+ mHandler.removeMessages(MSG_ON_PICTURE_CENTER);
+ mHandler.sendEmptyMessage(isCamera ? MSG_ON_CAMERA_CENTER : MSG_ON_PICTURE_CENTER);
}
public boolean canDisplayBottomControls() {
@@ -598,7 +607,7 @@ public class PhotoPage extends ActivityState implements
// more clear
if ((photo.getSupportedOperations() & MediaObject.SUPPORT_ACTION) != 0
&& !mPhotoView.getFilmMode()) {
- mPhotoView.setFilmMode(true);
+ mPhotoView.setWantPictureCenterCallbacks(true);
}
updateMenuOperations();
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 303d302d2..8c9c6d757 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -125,7 +125,7 @@ public class PhotoView extends GLView {
public void onUndoDeleteImage();
public void onCommitDeleteImage();
public void onFilmModeChanged(boolean enabled);
- public void onCameraCenter();
+ public void onPictureCenter(boolean isCamera);
}
// The rules about orientation locking:
@@ -199,7 +199,7 @@ public class PhotoView extends GLView {
private boolean mCancelExtraScalingPending;
private boolean mFilmMode = false;
- private boolean mWantCameraCenterCallbacks = false;
+ private boolean mWantPictureCenterCallbacks = false;
private int mDisplayRotation = 0;
private int mCompensation = 0;
private boolean mFullScreenCamera;
@@ -383,8 +383,8 @@ public class PhotoView extends GLView {
}
}
- public void setWantCameraCenterCallbacks(boolean wanted) {
- mWantCameraCenterCallbacks = wanted;
+ public void setWantPictureCenterCallbacks(boolean wanted) {
+ mWantPictureCenterCallbacks = wanted;
}
////////////////////////////////////////////////////////////////////////////
@@ -629,10 +629,8 @@ public class PhotoView extends GLView {
// Holdings except touch-down prevent the transitions.
if ((mHolding & ~HOLD_TOUCH_DOWN) != 0) return;
- boolean isCameraCenter = mIsCamera && mPositionController.isCenter() && !canUndoLastPicture();
-
- if (isCameraCenter && mWantCameraCenterCallbacks) {
- mListener.onCameraCenter();
+ if (mWantPictureCenterCallbacks && mPositionController.isCenter()) {
+ mListener.onPictureCenter(mIsCamera && !canUndoLastPicture());
}
}