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;
}
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);
}
}
mCurrentIndex = index;
if (mAppBridge != null) {
- mPhotoView.setWantCameraCenterCallbacks(true);
if (mCurrentIndex > 0) {
- mHandler.removeMessages(MSG_ON_CAMERA_CENTER);
mSkipUpdateCurrentPhoto = false;
}
CAMERA_SWITCH_CUTOFF_THRESHOLD_MS;
mPhotoView.stopScrolling();
} else if (oldIndex == 1 && mCurrentIndex == 0) {
+ mPhotoView.setWantPictureCenterCallbacks(true);
mSkipUpdateCurrentPhoto = true;
}
}
}
}
- 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() {
// more clear
if ((photo.getSupportedOperations() & MediaObject.SUPPORT_ACTION) != 0
&& !mPhotoView.getFilmMode()) {
- mPhotoView.setFilmMode(true);
+ mPhotoView.setWantPictureCenterCallbacks(true);
}
updateMenuOperations();
public void onUndoDeleteImage();
public void onCommitDeleteImage();
public void onFilmModeChanged(boolean enabled);
- public void onCameraCenter();
+ public void onPictureCenter(boolean isCamera);
}
// The rules about orientation locking:
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;
}
}
- public void setWantCameraCenterCallbacks(boolean wanted) {
- mWantCameraCenterCallbacks = wanted;
+ public void setWantPictureCenterCallbacks(boolean wanted) {
+ mWantPictureCenterCallbacks = wanted;
}
////////////////////////////////////////////////////////////////////////////
// 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());
}
}