summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ui')
-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
5 files changed, 30 insertions, 9 deletions
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);