diff options
author | Hung-ying Tyan <tyanh@google.com> | 2010-12-08 12:59:50 +0800 |
---|---|---|
committer | Hung-ying Tyan <tyanh@google.com> | 2010-12-08 14:39:51 +0800 |
commit | 5030bd7b700869feb50083571a680fa55730229b (patch) | |
tree | f78f7d4ee46f30758393ee5ef6c30b465020d2fa | |
parent | 68c7128fb60ed5b83f7af13c02111b079218879a (diff) | |
download | LegacyCamera-5030bd7b700869feb50083571a680fa55730229b.zip LegacyCamera-5030bd7b700869feb50083571a680fa55730229b.tar.gz LegacyCamera-5030bd7b700869feb50083571a680fa55730229b.tar.bz2 |
Disable camera zoom control in video mode
instead of removing, and other fixes.
+ Add images for disabled state.
+ Remove zoom stub.
+ In ZoomPicker, increase transition period from pressed to long pressed state
to 300ms. 200ms is too short for single press and showing images in pressed
state.
+ In ZoomPicker, restore image to state list instead of normal-state image.
Bug: 3252995
Change-Id: Id9484d6e0580c023671cf96e60a099512075f656
-rw-r--r-- | res/drawable-hdpi/button_zoom_in_disabled_holo.png | bin | 0 -> 2360 bytes | |||
-rw-r--r-- | res/drawable-hdpi/button_zoom_out_disabled_holo.png | bin | 0 -> 2291 bytes | |||
-rw-r--r-- | res/drawable-mdpi/button_zoom_in_disabled_holo.png | bin | 0 -> 2360 bytes | |||
-rw-r--r-- | res/drawable-mdpi/button_zoom_out_disabled_holo.png | bin | 0 -> 2291 bytes | |||
-rw-r--r-- | res/drawable-xlarge/btn_zoom_in.xml | 1 | ||||
-rw-r--r-- | res/drawable-xlarge/btn_zoom_out.xml | 1 | ||||
-rw-r--r-- | res/layout-xlarge/camera_control.xml | 5 | ||||
-rw-r--r-- | res/layout-xlarge/zoom_picker.xml | 5 | ||||
-rw-r--r-- | src/com/android/camera/Camera.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/ui/ZoomPicker.java | 15 |
10 files changed, 24 insertions, 12 deletions
diff --git a/res/drawable-hdpi/button_zoom_in_disabled_holo.png b/res/drawable-hdpi/button_zoom_in_disabled_holo.png Binary files differnew file mode 100644 index 0000000..7688afe --- /dev/null +++ b/res/drawable-hdpi/button_zoom_in_disabled_holo.png diff --git a/res/drawable-hdpi/button_zoom_out_disabled_holo.png b/res/drawable-hdpi/button_zoom_out_disabled_holo.png Binary files differnew file mode 100644 index 0000000..832319e --- /dev/null +++ b/res/drawable-hdpi/button_zoom_out_disabled_holo.png diff --git a/res/drawable-mdpi/button_zoom_in_disabled_holo.png b/res/drawable-mdpi/button_zoom_in_disabled_holo.png Binary files differnew file mode 100644 index 0000000..7688afe --- /dev/null +++ b/res/drawable-mdpi/button_zoom_in_disabled_holo.png diff --git a/res/drawable-mdpi/button_zoom_out_disabled_holo.png b/res/drawable-mdpi/button_zoom_out_disabled_holo.png Binary files differnew file mode 100644 index 0000000..832319e --- /dev/null +++ b/res/drawable-mdpi/button_zoom_out_disabled_holo.png diff --git a/res/drawable-xlarge/btn_zoom_in.xml b/res/drawable-xlarge/btn_zoom_in.xml index 1ae7aeb..d798b5a 100644 --- a/res/drawable-xlarge/btn_zoom_in.xml +++ b/res/drawable-xlarge/btn_zoom_in.xml @@ -16,5 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_zoom_in_pressed_holo" /> + <item android:state_enabled="false" android:drawable="@drawable/button_zoom_in_disabled_holo" /> <item android:drawable="@drawable/button_zoom_in_holo" /> </selector> diff --git a/res/drawable-xlarge/btn_zoom_out.xml b/res/drawable-xlarge/btn_zoom_out.xml index 92370c1..925327d 100644 --- a/res/drawable-xlarge/btn_zoom_out.xml +++ b/res/drawable-xlarge/btn_zoom_out.xml @@ -16,5 +16,6 @@ <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/button_zoom_out_pressed_holo" /> + <item android:state_enabled="false" android:drawable="@drawable/button_zoom_out_disabled_holo" /> <item android:drawable="@drawable/button_zoom_out_holo" /> </selector> diff --git a/res/layout-xlarge/camera_control.xml b/res/layout-xlarge/camera_control.xml index 4507fc4..f7002d9 100644 --- a/res/layout-xlarge/camera_control.xml +++ b/res/layout-xlarge/camera_control.xml @@ -25,9 +25,8 @@ this is circular dependency and is not allowed so it's very unfortunate that we have to hardcode the width here. --> - <ViewStub android:id="@+id/zoom_stub" - android:inflatedId="@+id/zoom_picker" - android:layout="@layout/zoom_picker" + <include android:id="@+id/zoom_picker" + layout="@layout/zoom_picker" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:layout_width="wrap_content" diff --git a/res/layout-xlarge/zoom_picker.xml b/res/layout-xlarge/zoom_picker.xml index 68431ba..4278da7 100644 --- a/res/layout-xlarge/zoom_picker.xml +++ b/res/layout-xlarge/zoom_picker.xml @@ -23,16 +23,19 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" - android:layout_alignParentRight="true"> + android:layout_alignParentRight="true" + android:enabled="false"> <Button android:id="@+id/decrement" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:enabled="false" android:background="@drawable/btn_zoom_out" /> <Button android:id="@+id/increment" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dp" + android:enabled="false" android:background="@drawable/btn_zoom_in" /> </com.android.camera.ui.ZoomPicker> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index ab4ef7b..1598d93 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -1026,10 +1026,6 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, } mIndicatorWheel = findViewById(R.id.indicator_wheel); - // Show zoom picker. - ViewStub zoomStub = (ViewStub) findViewById(R.id.zoom_stub); - if (zoomStub != null) mZoomPicker = (ZoomPicker) zoomStub.inflate(); - // Make sure preview is started. try { startPreviewThread.join(); @@ -1045,6 +1041,11 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, // parameters. initializeControlPanel(); initializeCameraPicker(); + + if (mControlPanel != null) { + mZoomPicker = (ZoomPicker) mControlPanel.findViewById(R.id.zoom_picker); + mZoomPicker.setEnabled(true); // disabled initially in xml + } } private void changeHeadUpDisplayState() { diff --git a/src/com/android/camera/ui/ZoomPicker.java b/src/com/android/camera/ui/ZoomPicker.java index 4d85db9..98e18d7 100644 --- a/src/com/android/camera/ui/ZoomPicker.java +++ b/src/com/android/camera/ui/ZoomPicker.java @@ -83,10 +83,10 @@ public class ZoomPicker extends LinearLayout { mIncrement = true; // Give bigger delay so users can tap to change only one // zoom step. - mHandler.postDelayed(mRunnable, 200); + mHandler.postDelayed(mRunnable, 300); } } else if (event.getAction() == MotionEvent.ACTION_UP) { - mIncrementButton.setBackgroundResource(R.drawable.button_zoom_in_holo); + mIncrementButton.setBackgroundResource(R.drawable.btn_zoom_in); mIncrement = false; } return false; @@ -100,10 +100,10 @@ public class ZoomPicker extends LinearLayout { mDecrement = true; // Give bigger delay so users can tap to change only one // zoom step. - mHandler.postDelayed(mRunnable, 200); + mHandler.postDelayed(mRunnable, 300); } } else if (event.getAction() == MotionEvent.ACTION_UP) { - mDecrementButton.setBackgroundResource(R.drawable.button_zoom_out_holo); + mDecrementButton.setBackgroundResource(R.drawable.btn_zoom_out); mDecrement = false; } return false; @@ -166,4 +166,11 @@ public class ZoomPicker extends LinearLayout { mFormatter.format("%2.1fx", mFormatterArgs); return mFormatter.toString(); } + + @Override + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + mIncrementButton.setEnabled(enabled); + mDecrementButton.setEnabled(enabled); + } } |