diff options
16 files changed, 41 insertions, 17 deletions
diff --git a/res/drawable-hdpi/button_zoom_in_longpressed_holo.png b/res/drawable-hdpi/button_zoom_in_longpressed_holo.png Binary files differdeleted file mode 100644 index d9f9f12..0000000 --- a/res/drawable-hdpi/button_zoom_in_longpressed_holo.png +++ /dev/null diff --git a/res/drawable-hdpi/button_zoom_in_pressed_holo.png b/res/drawable-hdpi/button_zoom_in_pressed_holo.png Binary files differindex e75cb4a..d9f9f12 100644 --- a/res/drawable-hdpi/button_zoom_in_pressed_holo.png +++ b/res/drawable-hdpi/button_zoom_in_pressed_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_longpressed_holo.png b/res/drawable-hdpi/button_zoom_out_longpressed_holo.png Binary files differdeleted file mode 100644 index d2a3e59..0000000 --- a/res/drawable-hdpi/button_zoom_out_longpressed_holo.png +++ /dev/null diff --git a/res/drawable-hdpi/button_zoom_out_pressed_holo.png b/res/drawable-hdpi/button_zoom_out_pressed_holo.png Binary files differindex 4a032a6..d2a3e59 100644 --- a/res/drawable-hdpi/button_zoom_out_pressed_holo.png +++ b/res/drawable-hdpi/button_zoom_out_pressed_holo.png diff --git a/res/drawable-mdpi/button_zoom_in_longpressed_holo.png b/res/drawable-mdpi/button_zoom_in_longpressed_holo.png Binary files differdeleted file mode 100644 index d9f9f12..0000000 --- a/res/drawable-mdpi/button_zoom_in_longpressed_holo.png +++ /dev/null diff --git a/res/drawable-mdpi/button_zoom_in_pressed_holo.png b/res/drawable-mdpi/button_zoom_in_pressed_holo.png Binary files differindex e75cb4a..d9f9f12 100644 --- a/res/drawable-mdpi/button_zoom_in_pressed_holo.png +++ b/res/drawable-mdpi/button_zoom_in_pressed_holo.png diff --git a/res/drawable-mdpi/button_zoom_out_longpressed_holo.png b/res/drawable-mdpi/button_zoom_out_longpressed_holo.png Binary files differdeleted file mode 100644 index d2a3e59..0000000 --- a/res/drawable-mdpi/button_zoom_out_longpressed_holo.png +++ /dev/null diff --git a/res/drawable-mdpi/button_zoom_out_pressed_holo.png b/res/drawable-mdpi/button_zoom_out_pressed_holo.png Binary files differindex 4a032a6..d2a3e59 100644 --- a/res/drawable-mdpi/button_zoom_out_pressed_holo.png +++ b/res/drawable-mdpi/button_zoom_out_pressed_holo.png diff --git a/res/layout-w1024dp/camera_control.xml b/res/layout-w1024dp/camera_control.xml index d52847e..5c2b3b5 100644 --- a/res/layout-w1024dp/camera_control.xml +++ b/res/layout-w1024dp/camera_control.xml @@ -40,16 +40,18 @@ android:focusable="true" android:src="@drawable/btn_ic_camera_shutter" android:background="@drawable/btn_shutter" /> - <Button android:id="@+id/zoom_increment" + <com.android.camera.ui.RotateImageView android:id="@+id/zoom_increment" + android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@drawable/btn_zoom_in" + android:src="@drawable/btn_zoom_in" android:visibility="gone" /> - <Button android:id="@+id/zoom_decrement" + <com.android.camera.ui.RotateImageView android:id="@+id/zoom_decrement" + android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="@drawable/btn_zoom_out" + android:src="@drawable/btn_zoom_out" android:visibility="gone" /> <com.android.camera.ui.CameraPicker android:id="@+id/camera_picker" 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); |