summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorrepo sync <cywang@google.com>2011-07-15 05:45:30 +0800
committerrepo sync <cywang@google.com>2011-07-18 07:13:00 +0800
commitcead50ba3ce2df3bd9fcf06c6f54ea0c6980f0d7 (patch)
tree03dca5218182d684c95b17eedef5f0e1d2707420 /src
parent2b1f214ecbd9c0e40edf827620b59ba00777c948 (diff)
downloadLegacyCamera-cead50ba3ce2df3bd9fcf06c6f54ea0c6980f0d7.zip
LegacyCamera-cead50ba3ce2df3bd9fcf06c6f54ea0c6980f0d7.tar.gz
LegacyCamera-cead50ba3ce2df3bd9fcf06c6f54ea0c6980f0d7.tar.bz2
Make all wheel icons rotatable.
+Make the popup menu rotatable. bug:5039041 Change-Id: I28394531d5c0894215b8229159cfe9c7bee958b9
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java5
-rw-r--r--src/com/android/camera/VideoCamera.java4
-rw-r--r--src/com/android/camera/ui/AbstractIndicatorButton.java9
-rw-r--r--src/com/android/camera/ui/CameraPicker.java2
-rw-r--r--src/com/android/camera/ui/IndicatorWheel.java10
-rw-r--r--src/com/android/camera/ui/RotateImageView.java8
-rw-r--r--src/com/android/camera/ui/ZoomPicker.java10
7 files changed, 35 insertions, 13 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 02e9eab..9a506a6 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -606,8 +606,8 @@ public class Camera extends ActivityBase implements View.OnClickListener,
}
private void initializeZoomPicker() {
- Button zoomIncrement = (Button) findViewById(R.id.zoom_increment);
- Button zoomDecrement = (Button) findViewById(R.id.zoom_decrement);
+ View zoomIncrement = findViewById(R.id.zoom_increment);
+ View zoomDecrement = findViewById(R.id.zoom_decrement);
TextView zoomRatio = (TextView) findViewById(R.id.zoom_ratio);
if (zoomIncrement != null && zoomDecrement != null && mParameters.isZoomSupported()) {
mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement, zoomRatio);
@@ -1236,6 +1236,7 @@ public class Camera extends ActivityBase implements View.OnClickListener,
if (mCameraSwitchIcon != null) mCameraSwitchIcon.setDegree(degree);
if (mVideoSwitchIcon != null) mVideoSwitchIcon.setDegree(degree);
if (mSharePopup != null) mSharePopup.setOrientation(degree);
+ if (mIndicatorWheel != null) mIndicatorWheel.setDegree(degree);
}
@Override
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 31444c4..1e0e030 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -503,8 +503,8 @@ public class VideoCamera extends ActivityBase
}
private void initializeZoomPicker() {
- Button zoomIncrement = (Button) findViewById(R.id.zoom_increment);
- Button zoomDecrement = (Button) findViewById(R.id.zoom_decrement);
+ View zoomIncrement = findViewById(R.id.zoom_increment);
+ View zoomDecrement = findViewById(R.id.zoom_decrement);
TextView zoomRatio = (TextView) findViewById(R.id.zoom_ratio);
if (zoomIncrement != null && zoomDecrement != null && mParameters.isZoomSupported()) {
mZoomPicker = new ZoomPicker(this, zoomIncrement, zoomDecrement, zoomRatio);
diff --git a/src/com/android/camera/ui/AbstractIndicatorButton.java b/src/com/android/camera/ui/AbstractIndicatorButton.java
index 6f7a656..efed757 100644
--- a/src/com/android/camera/ui/AbstractIndicatorButton.java
+++ b/src/com/android/camera/ui/AbstractIndicatorButton.java
@@ -26,7 +26,7 @@ import android.view.animation.AnimationUtils;
import android.widget.ImageView;
// This is an indicator button and pressing it opens a popup window. Ex: flash or other settings.
-public abstract class AbstractIndicatorButton extends ImageView {
+public abstract class AbstractIndicatorButton extends RotateImageView {
private final String TAG = "AbstractIndicatorButton";
protected Context mContext;
protected Animation mFadeIn, mFadeOut;
@@ -87,11 +87,18 @@ public abstract class AbstractIndicatorButton extends ImageView {
}
}
+ @Override
+ public void setDegree(int degree) {
+ super.setDegree(degree);
+ if (mPopup != null) mPopup.setRotation(-degree);
+ }
+
abstract protected void initializePopup();
private void showPopup() {
if (mPopup == null) initializePopup();
+ mPopup.setRotation(-getDegree());
mPopup.clearAnimation();
mPopup.startAnimation(mFadeIn);
mPopup.setVisibility(View.VISIBLE);
diff --git a/src/com/android/camera/ui/CameraPicker.java b/src/com/android/camera/ui/CameraPicker.java
index aa0e53b..b77cb5f 100644
--- a/src/com/android/camera/ui/CameraPicker.java
+++ b/src/com/android/camera/ui/CameraPicker.java
@@ -27,7 +27,7 @@ import android.widget.ImageView;
/**
* A view for switching the front/back camera.
*/
-public class CameraPicker extends ImageView implements View.OnClickListener {
+public class CameraPicker extends RotateImageView implements View.OnClickListener {
private Listener mListener;
private ListPreference mPreference;
private CharSequence[] mCameras;
diff --git a/src/com/android/camera/ui/IndicatorWheel.java b/src/com/android/camera/ui/IndicatorWheel.java
index 6b3df10..1f66550 100644
--- a/src/com/android/camera/ui/IndicatorWheel.java
+++ b/src/com/android/camera/ui/IndicatorWheel.java
@@ -111,6 +111,16 @@ public class IndicatorWheel extends ViewGroup implements
return false;
}
+ public void setDegree(int degree) {
+ int count = getChildCount();
+ for (int i = 0 ; i < count ; ++i) {
+ View view = getChildAt(i);
+ if (view instanceof RotateImageView) {
+ ((RotateImageView) view).setDegree(degree);
+ }
+ }
+ }
+
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (!onFilterTouchEventForSecurity(event)) return false;
diff --git a/src/com/android/camera/ui/RotateImageView.java b/src/com/android/camera/ui/RotateImageView.java
index a76d7bc..4085bb2 100644
--- a/src/com/android/camera/ui/RotateImageView.java
+++ b/src/com/android/camera/ui/RotateImageView.java
@@ -52,10 +52,18 @@ public class RotateImageView extends ImageView {
super(context, attrs);
}
+ public RotateImageView(Context context) {
+ super(context);
+ }
+
public void enableAnimation(boolean enable) {
mEnableAnimation = enable;
}
+ protected int getDegree() {
+ return mTargetDegree;
+ }
+
// Rotate the view counter-clockwise
public void setDegree(int degree) {
// make sure in the range of [0, 359]
diff --git a/src/com/android/camera/ui/ZoomPicker.java b/src/com/android/camera/ui/ZoomPicker.java
index 5aba04e..e8305b3 100644
--- a/src/com/android/camera/ui/ZoomPicker.java
+++ b/src/com/android/camera/ui/ZoomPicker.java
@@ -43,8 +43,8 @@ public class ZoomPicker {
private final Formatter mFormatter = new Formatter(mBuilder);
private final Object[] mFormatterArgs = new Object[1];
private String mZoomText;
- private Button mIncrementButton;
- private Button mDecrementButton;
+ private View mIncrementButton;
+ private View mDecrementButton;
// The state of zoom button.
public static final int ZOOM_IN = 0;
@@ -55,7 +55,6 @@ public class ZoomPicker {
private final Runnable mRunnable = new Runnable() {
public void run() {
if (mIncrement) {
- mIncrementButton.setBackgroundResource(R.drawable.button_zoom_in_longpressed_holo);
if (mSmoothZoomSupported) {
if (mZoomIndex != mZoomMax && mListener != null) {
mListener.onZoomStateChanged(ZOOM_IN);
@@ -64,7 +63,6 @@ public class ZoomPicker {
mHandler.postDelayed(this, 65);
}
} else if (mDecrement) {
- mDecrementButton.setBackgroundResource(R.drawable.button_zoom_out_longpressed_holo);
if (mSmoothZoomSupported) {
if (mZoomIndex != 0 && mListener != null) {
mListener.onZoomStateChanged(ZOOM_OUT);
@@ -76,7 +74,7 @@ public class ZoomPicker {
}
};
- public ZoomPicker(Context context, Button increment, Button decrement, TextView zoomText) {
+ public ZoomPicker(Context context, View increment, View decrement, TextView zoomText) {
mZoomText = context.getString(R.string.zoom_text);
mHandler = new Handler();
@@ -92,7 +90,6 @@ public class ZoomPicker {
}
} else if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL) {
- mIncrementButton.setBackgroundResource(R.drawable.btn_zoom_in);
mIncrement = false;
if (mSmoothZoomSupported) {
if (mListener != null) mListener.onZoomStateChanged(ZOOM_STOP);
@@ -114,7 +111,6 @@ public class ZoomPicker {
}
} else if (action == MotionEvent.ACTION_UP
|| action == MotionEvent.ACTION_CANCEL) {
- mDecrementButton.setBackgroundResource(R.drawable.btn_zoom_out);
mDecrement = false;
if (mSmoothZoomSupported) {
if (mListener != null) mListener.onZoomStateChanged(ZOOM_STOP);