diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/Camera.java | 17 | ||||
-rw-r--r-- | src/com/android/camera/ModePicker.java | 9 | ||||
-rwxr-xr-x | src/com/android/camera/VideoCamera.java | 19 | ||||
-rwxr-xr-x | src/com/android/camera/panorama/PanoramaActivity.java | 16 | ||||
-rw-r--r-- | src/com/android/camera/ui/AbstractIndicatorButton.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/ui/FaceView.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorControl.java | 14 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlBarContainer.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlWheelContainer.java | 6 | ||||
-rw-r--r-- | src/com/android/camera/ui/RotateImageView.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/ui/RotateLayout.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/SecondLevelIndicatorControlBar.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/ui/SharePopup.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomControl.java | 10 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomControlBar.java | 10 |
15 files changed, 64 insertions, 73 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 931095e..252dff7 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -1217,16 +1217,13 @@ public class Camera extends ActivityBase implements FocusManager.Listener, } } - private void setOrientationIndicator(int degree) { - if (mThumbnailView != null) mThumbnailView.setDegree(degree); - if (mModePicker != null) mModePicker.setDegree(degree); - if (mSharePopup != null) mSharePopup.setOrientation(degree); - if (mIndicatorControlContainer != null) mIndicatorControlContainer.setDegree(degree); - if (mZoomControl != null) mZoomControl.setDegree(degree); - if (mFocusIndicator != null) mFocusIndicator.setOrientation(degree); - if (mFaceView != null) mFaceView.setOrientation(degree); - if (mReviewCancelButton != null) mReviewCancelButton.setOrientation(degree); - if (mReviewDoneButton != null) mReviewDoneButton.setOrientation(degree); + private void setOrientationIndicator(int orientation) { + Rotatable[] indicators = {mThumbnailView, mModePicker, mSharePopup, + mIndicatorControlContainer, mZoomControl, mFocusIndicator, mFaceView, + mReviewCancelButton, mReviewDoneButton}; + for (Rotatable indicator : indicators) { + if (indicator != null) indicator.setOrientation(orientation); + } } @Override diff --git a/src/com/android/camera/ModePicker.java b/src/com/android/camera/ModePicker.java index 528bc3d..ccde71d 100644 --- a/src/com/android/camera/ModePicker.java +++ b/src/com/android/camera/ModePicker.java @@ -17,6 +17,7 @@ package com.android.camera; import com.android.camera.ui.PopupManager; +import com.android.camera.ui.Rotatable; import com.android.camera.ui.RotateImageView; import android.content.Context; @@ -36,7 +37,7 @@ import android.widget.RelativeLayout; * a current mode indicator. */ public class ModePicker extends RelativeLayout implements View.OnClickListener, - PopupManager.OnOtherPopupShowedListener { + PopupManager.OnOtherPopupShowedListener, Rotatable { public static final int MODE_CAMERA = 0; public static final int MODE_VIDEO = 1; public static final int MODE_PANORAMA = 2; @@ -188,11 +189,11 @@ public class ModePicker extends RelativeLayout implements View.OnClickListener, return true; } - public void setDegree(int degree) { + public void setOrientation(int orientation) { for (int i = 0; i < MODE_NUM; ++i) { - mModeSelectionIcon[i].setDegree(degree); + mModeSelectionIcon[i].setOrientation(orientation); if (mCurrentModeFrame != null) { - mCurrentModeIcon[i].setDegree(degree); + mCurrentModeIcon[i].setOrientation(orientation); } } } diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 5ad9205..0cd57ef 100755 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -541,19 +541,18 @@ public class VideoCamera extends ActivityBase } } - private void setOrientationIndicator(int degree) { - if (mThumbnailView != null) mThumbnailView.setDegree(degree); - if (mModePicker != null) mModePicker.setDegree(degree); - if (mSharePopup != null) mSharePopup.setOrientation(degree); - if (mBgLearningMessageRotater != null) mBgLearningMessageRotater.setOrientation(degree); - if (mIndicatorControlContainer != null) mIndicatorControlContainer.setDegree(degree); - if (mReviewDoneButton != null) mReviewDoneButton.setOrientation(degree); - if (mReviewPlayButton != null) mReviewPlayButton.setOrientation(degree); - if (mReviewCancelButton!= null) mReviewCancelButton.setOrientation(degree); + private void setOrientationIndicator(int orientation) { + Rotatable[] indicators = {mThumbnailView, mModePicker, mSharePopup, + mBgLearningMessageRotater, mIndicatorControlContainer, + mReviewDoneButton, mReviewPlayButton, mReviewCancelButton}; + for (Rotatable indicator : indicators) { + if (indicator != null) indicator.setOrientation(orientation); + } + // We change the orientation of the linearlayout only for phone UI because when in portrait // the width is not enough. if (mLabelsLinearLayout != null) { - if (((degree / 90) & 1) == 1) { + if (((orientation / 90) & 1) == 1) { mLabelsLinearLayout.setOrientation(mLabelsLinearLayout.VERTICAL); } else { mLabelsLinearLayout.setOrientation(mLabelsLinearLayout.HORIZONTAL); diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java index 43d33a8..6fd9b1a 100755 --- a/src/com/android/camera/panorama/PanoramaActivity.java +++ b/src/com/android/camera/panorama/PanoramaActivity.java @@ -314,12 +314,6 @@ public class PanoramaActivity extends ActivityBase implements }); } - @Override - public void onStart() { - super.onStart(); - updateThumbnailButton(); - } - private void setupCamera() { openCamera(); Parameters parameters = mCameraDevice.getParameters(); @@ -744,6 +738,14 @@ public class PanoramaActivity extends ActivityBase implements t.start(); } + private void initThumbnailButton() { + // Load the thumbnail from the disk. + if (mThumbnail == null) { + mThumbnail = Thumbnail.loadFrom(new File(getFilesDir(), Thumbnail.LAST_THUMB_FILENAME)); + } + updateThumbnailButton(); + } + private void updateThumbnailButton() { // Update last image if URI is invalid and the storage is ready. ContentResolver contentResolver = getContentResolver(); @@ -926,6 +928,8 @@ public class PanoramaActivity extends ActivityBase implements // has to be decided by camera device. initMosaicFrameProcessorIfNeeded(); mMosaicView.onResume(); + + initThumbnailButton(); } public MosaicJpeg generateFinalMosaic(boolean highRes) { diff --git a/src/com/android/camera/ui/AbstractIndicatorButton.java b/src/com/android/camera/ui/AbstractIndicatorButton.java index a661586..0ff7b19 100644 --- a/src/com/android/camera/ui/AbstractIndicatorButton.java +++ b/src/com/android/camera/ui/AbstractIndicatorButton.java @@ -106,10 +106,10 @@ public abstract class AbstractIndicatorButton extends RotateImageView implements } @Override - public void setDegree(int degree) { - super.setDegree(degree); + public void setOrientation(int orientation) { + super.setOrientation(orientation); if (mPopup != null) { - mPopup.setOrientation(degree); + mPopup.setOrientation(orientation); } } diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java index 9018886..ed59682 100644 --- a/src/com/android/camera/ui/FaceView.java +++ b/src/com/android/camera/ui/FaceView.java @@ -29,7 +29,7 @@ import android.util.AttributeSet; import android.util.Log; import android.view.View; -public class FaceView extends View implements FocusIndicator { +public class FaceView extends View implements FocusIndicator, Rotatable { private final String TAG = "FaceView"; private final boolean LOGV = false; // The value for android.hardware.Camera.setDisplayOrientation. diff --git a/src/com/android/camera/ui/IndicatorControl.java b/src/com/android/camera/ui/IndicatorControl.java index 86b0cc9..cac38b8 100644 --- a/src/com/android/camera/ui/IndicatorControl.java +++ b/src/com/android/camera/ui/IndicatorControl.java @@ -35,7 +35,7 @@ import java.util.ArrayList; * A view that contains camera setting indicators. */ public abstract class IndicatorControl extends RelativeLayout implements - IndicatorButton.Listener, OtherSettingsPopup.Listener { + IndicatorButton.Listener, OtherSettingsPopup.Listener, Rotatable { private static final String TAG = "IndicatorControl"; public static final int MODE_CAMERA = 0; public static final int MODE_VIDEO = 1; @@ -45,7 +45,7 @@ public abstract class IndicatorControl extends RelativeLayout implements protected CameraPicker mCameraPicker; private PreferenceGroup mPreferenceGroup; - private int mDegree = 0; + private int mOrientation = 0; protected int mCurrentMode = MODE_CAMERA; @@ -61,15 +61,13 @@ public abstract class IndicatorControl extends RelativeLayout implements super(context, attrs); } - public void setDegree(int degree) { - mDegree = degree; + public void setOrientation(int orientation) { + mOrientation = orientation; int count = getChildCount(); for (int i = 0 ; i < count ; ++i) { View view = getChildAt(i); - if (view instanceof RotateImageView) { - ((RotateImageView) view).setDegree(degree); - } else if (view instanceof ZoomControl) { - ((ZoomControl) view).setDegree(degree); + if (view instanceof Rotatable) { + ((Rotatable) view).setOrientation(orientation); } } } diff --git a/src/com/android/camera/ui/IndicatorControlBarContainer.java b/src/com/android/camera/ui/IndicatorControlBarContainer.java index 6b60ace..1e860ad 100644 --- a/src/com/android/camera/ui/IndicatorControlBarContainer.java +++ b/src/com/android/camera/ui/IndicatorControlBarContainer.java @@ -75,9 +75,9 @@ public class IndicatorControlBarContainer extends IndicatorControlContainer { secondLevelKeys, secondLevelOtherSettingKeys); } - public void setDegree(int degree) { - mIndicatorControlBar.setDegree(degree); - mSecondLevelIndicatorControlBar.setDegree(degree); + public void setOrientation(int orientation) { + mIndicatorControlBar.setOrientation(orientation); + mSecondLevelIndicatorControlBar.setOrientation(orientation); } @Override diff --git a/src/com/android/camera/ui/IndicatorControlWheelContainer.java b/src/com/android/camera/ui/IndicatorControlWheelContainer.java index 14539da..29074c2 100644 --- a/src/com/android/camera/ui/IndicatorControlWheelContainer.java +++ b/src/com/android/camera/ui/IndicatorControlWheelContainer.java @@ -191,9 +191,9 @@ public class IndicatorControlWheelContainer extends IndicatorControlContainer { } @Override - public void setDegree(int degree) { - mIndicatorControlWheel.setDegree(degree); - mZoomControlWheel.setDegree(degree); + public void setOrientation(int orientation) { + mIndicatorControlWheel.setOrientation(orientation); + mZoomControlWheel.setOrientation(orientation); } public void startTimeLapseAnimation(int timeLapseInterval, long startTime) { diff --git a/src/com/android/camera/ui/RotateImageView.java b/src/com/android/camera/ui/RotateImageView.java index 390d705..f47a26b 100644 --- a/src/com/android/camera/ui/RotateImageView.java +++ b/src/com/android/camera/ui/RotateImageView.java @@ -16,8 +16,6 @@ package com.android.camera.ui; -import com.android.camera.ui.Rotatable; - import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -66,12 +64,8 @@ public class RotateImageView extends ColorFilterImageView implements Rotatable { return mTargetDegree; } - public void setOrientation(int orientation) { - setDegree(orientation); - } - // Rotate the view counter-clockwise - public void setDegree(int degree) { + public void setOrientation(int degree) { // make sure in the range of [0, 359] degree = degree >= 0 ? degree % 360 : degree % 360 + 360; if (degree == mTargetDegree) return; diff --git a/src/com/android/camera/ui/RotateLayout.java b/src/com/android/camera/ui/RotateLayout.java index 24815f8..e66e71a 100644 --- a/src/com/android/camera/ui/RotateLayout.java +++ b/src/com/android/camera/ui/RotateLayout.java @@ -16,8 +16,6 @@ package com.android.camera.ui; -import com.android.camera.ui.Rotatable; - import android.content.Context; import android.util.AttributeSet; import android.view.View; diff --git a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java index c9037d9..45bbca8 100644 --- a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java +++ b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java @@ -39,7 +39,7 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements private View mDivider; // the divider line private View mIndicatorHighlight; // the side highlight bar private View mPopupedIndicator; - int mDegree = 0; + int mOrientation = 0; int mSelectedIndex = -1; // There are some views in the ViewGroup before adding the indicator buttons, // such as Close icon, divider line and the hightlight bar, we need to @@ -64,7 +64,7 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements setPreferenceGroup(group); mNonIndicatorButtonCount = getChildCount(); addControls(keys, otherSettingKeys); - if (mDegree != 0) setDegree(mDegree); + if (mOrientation != 0) setOrientation(mOrientation); } public void onClick(View view) { @@ -151,9 +151,9 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements } @Override - public void setDegree(int degree) { - mDegree = degree; - super.setDegree(degree); + public void setOrientation(int orientation) { + mOrientation = orientation; + super.setOrientation(orientation); } @Override diff --git a/src/com/android/camera/ui/SharePopup.java b/src/com/android/camera/ui/SharePopup.java index de78f66..384634a 100644 --- a/src/com/android/camera/ui/SharePopup.java +++ b/src/com/android/camera/ui/SharePopup.java @@ -50,7 +50,7 @@ import java.util.Map; // A popup window that contains a big thumbnail and a list of apps to share. public class SharePopup extends PopupWindow implements View.OnClickListener, - View.OnTouchListener, AdapterView.OnItemClickListener { + View.OnTouchListener, AdapterView.OnItemClickListener, Rotatable { private static final String TAG = "SharePopup"; private static final String ADAPTER_COLUMN_ICON = "icon"; private Context mContext; diff --git a/src/com/android/camera/ui/ZoomControl.java b/src/com/android/camera/ui/ZoomControl.java index 1809d18..f2971cd 100644 --- a/src/com/android/camera/ui/ZoomControl.java +++ b/src/com/android/camera/ui/ZoomControl.java @@ -29,7 +29,7 @@ import android.widget.RelativeLayout; * A view that contains camera zoom control which could adjust the zoom in/out * if the camera supports zooming. */ -public abstract class ZoomControl extends RelativeLayout { +public abstract class ZoomControl extends RelativeLayout implements Rotatable { // The states of zoom button. public static final int ZOOM_IN = 0; public static final int ZOOM_OUT = 1; @@ -42,7 +42,7 @@ public abstract class ZoomControl extends RelativeLayout { protected ImageView mZoomOut; protected ImageView mZoomSlider; protected int mSliderPosition = 0; - protected int mDegree; + protected int mOrientation; private Handler mHandler; public interface OnZoomChangedListener { @@ -208,13 +208,13 @@ public abstract class ZoomControl extends RelativeLayout { return true; } - public void setDegree(int degree) { - mDegree = degree; + public void setOrientation(int orientation) { + mOrientation = orientation; int count = getChildCount(); for (int i = 0 ; i < count ; ++i) { View view = getChildAt(i); if (view instanceof RotateImageView) { - ((RotateImageView) view).setDegree(degree); + ((RotateImageView) view).setOrientation(orientation); } } } diff --git a/src/com/android/camera/ui/ZoomControlBar.java b/src/com/android/camera/ui/ZoomControlBar.java index 08042d4..2e14e53 100644 --- a/src/com/android/camera/ui/ZoomControlBar.java +++ b/src/com/android/camera/ui/ZoomControlBar.java @@ -59,7 +59,7 @@ public class ZoomControlBar extends ZoomControl { // landscape mode, the zoom-in bottom should be on the top, so the // position should be reversed. int pos; // the relative position in the zoom slider bar - if (mDegree == 180) { + if (mOrientation == 180) { pos = y - mTotalIconHeight; } else { pos = mHeight - mTotalIconHeight - y; @@ -114,10 +114,10 @@ public class ZoomControlBar extends ZoomControl { } @Override - public void setDegree(int degree) { + public void setOrientation(int orientation) { // layout for the left-hand camera control - if ((degree == 180) || (mDegree == 180)) requestLayout(); - super.setDegree(degree); + if ((orientation == 180) || (mOrientation == 180)) requestLayout(); + super.setOrientation(orientation); } @Override @@ -135,7 +135,7 @@ public class ZoomControlBar extends ZoomControl { } else { sliderPosition = (int) ((double) mSliderLength * mZoomIndex / mZoomMax); } - if (mDegree == 180) { + if (mOrientation == 180) { mZoomOut.layout(0, 0, width, mIconHeight); mZoomIn.layout(0, mHeight - mIconHeight, width, mHeight); pos = mBar.getTop() + sliderPosition; |