summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/ui/PhotoView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/ui/PhotoView.java')
-rw-r--r--src/com/android/gallery3d/ui/PhotoView.java29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/ui/PhotoView.java b/src/com/android/gallery3d/ui/PhotoView.java
index 9a0fe9d09..934638870 100644
--- a/src/com/android/gallery3d/ui/PhotoView.java
+++ b/src/com/android/gallery3d/ui/PhotoView.java
@@ -124,6 +124,7 @@ public class PhotoView extends GLView {
public void onDeleteImage(Path path, int offset);
public void onUndoDeleteImage();
public void onCommitDeleteImage();
+ public void onFilmModeChanged(boolean enabled);
}
// The rules about orientation locking:
@@ -149,7 +150,6 @@ public class PhotoView extends GLView {
private static final int MSG_UNDO_BAR_TIMEOUT = 7;
private static final int MSG_UNDO_BAR_FULL_CAMERA = 8;
- private static final int MOVE_THRESHOLD = 256;
private static final float SWIPE_THRESHOLD = 300f;
private static final float DEFAULT_TEXT_SIZE = 20;
@@ -625,7 +625,7 @@ public class PhotoView extends GLView {
if (mWasCameraCenter && mIsCamera && !isCenter && !mFilmMode) {
// Temporary disabled to de-emphasize filmstrip.
- // setFilmMode(true);
+ setFilmMode(true);
} else if (!mWasCameraCenter && isCameraCenter && mFilmMode) {
setFilmMode(false);
}
@@ -1268,18 +1268,22 @@ public class PhotoView extends GLView {
mGestureListener.setSwipingEnabled(enabled);
}
- private void setFilmMode(boolean enabled) {
+ public void setFilmMode(boolean enabled) {
if (mFilmMode == enabled) return;
mFilmMode = enabled;
mPositionController.setFilmMode(mFilmMode);
mModel.setNeedFullImage(!enabled);
mModel.setFocusHintDirection(
mFilmMode ? Model.FOCUS_HINT_PREVIOUS : Model.FOCUS_HINT_NEXT);
- mListener.onActionBarAllowed(!enabled);
-
- // Move into camera in page mode, lock
- if (!enabled && mPictures.get(0).isCamera()) {
- mListener.lockOrientation();
+ mListener.onFilmModeChanged(enabled);
+ boolean isCamera = mPictures.get(0).isCamera();
+ if (isCamera) {
+ // Move into camera in page mode, lock
+ if (!enabled) mListener.lockOrientation();
+ mListener.onActionBarAllowed(false);
+ } else {
+ mListener.onActionBarAllowed(true);
+ if (enabled) mListener.onActionBarWanted();
}
}
@@ -1307,6 +1311,7 @@ public class PhotoView extends GLView {
// move to the camera preview and show controls after resume
public void resetToFirstPicture() {
mModel.moveTo(0);
+ mListener.onActionBarAllowed(false);
setFilmMode(false);
}
@@ -1532,7 +1537,9 @@ public class PhotoView extends GLView {
Rect r = mPositionController.getPosition(0);
int viewW = getWidth();
- int threshold = MOVE_THRESHOLD + gapToSide(r.width(), viewW);
+ // Setting the move threshold proportional to the width of the view
+ int moveThreshold = viewW / 5 ;
+ int threshold = moveThreshold + gapToSide(r.width(), viewW);
// If we have moved the picture a lot, switching.
if (viewW - r.right > threshold) {
@@ -1566,6 +1573,10 @@ public class PhotoView extends GLView {
// Focus switching
////////////////////////////////////////////////////////////////////////////
+ public void switchToImage(int index) {
+ mModel.moveTo(index);
+ }
+
private void switchToNextImage() {
mModel.moveTo(mModel.getCurrentIndex() + 1);
}