summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorrepo sync <cywang@google.com>2011-07-17 16:24:44 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-17 16:24:44 -0700
commitb4aa4791c329cadc4df8edf3def5655cf4105f56 (patch)
tree60e5046e1e754b01e29bf7e1ff45192cca90b5f6 /src/com/android
parente1b7b87757cfef229162601154b0d62bbfb693a2 (diff)
parentcead50ba3ce2df3bd9fcf06c6f54ea0c6980f0d7 (diff)
downloadLegacyCamera-b4aa4791c329cadc4df8edf3def5655cf4105f56.zip
LegacyCamera-b4aa4791c329cadc4df8edf3def5655cf4105f56.tar.gz
LegacyCamera-b4aa4791c329cadc4df8edf3def5655cf4105f56.tar.bz2
Merge "Make all wheel icons rotatable."
Diffstat (limited to 'src/com/android')
-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 1183de0..d1315d4 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -605,8 +605,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 300d31f..d0027f2 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -504,8 +504,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);