diff options
17 files changed, 64 insertions, 77 deletions
diff --git a/res/drawable-hdpi/ic_rotate_camera_holo_dark.png b/res/drawable-hdpi/ic_rotate_camera_holo_dark.png Binary files differnew file mode 100755 index 0000000..c4e2b63 --- /dev/null +++ b/res/drawable-hdpi/ic_rotate_camera_holo_dark.png diff --git a/res/drawable-hdpi/ic_rotate_camera_pressed_holo_dark.png b/res/drawable-hdpi/ic_rotate_camera_pressed_holo_dark.png Binary files differnew file mode 100755 index 0000000..415277a --- /dev/null +++ b/res/drawable-hdpi/ic_rotate_camera_pressed_holo_dark.png diff --git a/res/drawable-hdpi/ic_rotate_video_holo_dark.png b/res/drawable-hdpi/ic_rotate_video_holo_dark.png Binary files differnew file mode 100755 index 0000000..bef5a67 --- /dev/null +++ b/res/drawable-hdpi/ic_rotate_video_holo_dark.png diff --git a/res/drawable-hdpi/ic_rotate_video_pressed_holo_dark.png b/res/drawable-hdpi/ic_rotate_video_pressed_holo_dark.png Binary files differnew file mode 100755 index 0000000..4a194ef --- /dev/null +++ b/res/drawable-hdpi/ic_rotate_video_pressed_holo_dark.png diff --git a/res/drawable-mdpi/ic_rotate_camera_holo_dark.png b/res/drawable-mdpi/ic_rotate_camera_holo_dark.png Binary files differnew file mode 100755 index 0000000..8d40ff3 --- /dev/null +++ b/res/drawable-mdpi/ic_rotate_camera_holo_dark.png diff --git a/res/drawable-mdpi/ic_rotate_camera_pressed_holo_dark.png b/res/drawable-mdpi/ic_rotate_camera_pressed_holo_dark.png Binary files differnew file mode 100755 index 0000000..fcb07ac --- /dev/null +++ b/res/drawable-mdpi/ic_rotate_camera_pressed_holo_dark.png diff --git a/res/drawable-mdpi/ic_rotate_video_holo_dark.png b/res/drawable-mdpi/ic_rotate_video_holo_dark.png Binary files differnew file mode 100755 index 0000000..7cd1a3b --- /dev/null +++ b/res/drawable-mdpi/ic_rotate_video_holo_dark.png diff --git a/res/drawable-mdpi/ic_rotate_video_pressed_holo_dark.png b/res/drawable-mdpi/ic_rotate_video_pressed_holo_dark.png Binary files differnew file mode 100755 index 0000000..d032eda --- /dev/null +++ b/res/drawable-mdpi/ic_rotate_video_pressed_holo_dark.png diff --git a/res/drawable/camera_toggle.xml b/res/drawable/camera_toggle.xml new file mode 100644 index 0000000..df5b71e --- /dev/null +++ b/res/drawable/camera_toggle.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/ic_rotate_camera_pressed_holo_dark" /> + <item android:drawable="@drawable/ic_rotate_camera_holo_dark" /> +</selector> + + diff --git a/res/drawable/camera_toggle_video.xml b/res/drawable/camera_toggle_video.xml new file mode 100644 index 0000000..5a9fb90 --- /dev/null +++ b/res/drawable/camera_toggle_video.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="true" android:drawable="@drawable/ic_rotate_video_pressed_holo_dark" /> + <item android:drawable="@drawable/ic_rotate_video_holo_dark" /> +</selector> + + diff --git a/res/layout-xlarge/camera_control.xml b/res/layout-xlarge/camera_control.xml index 8b712a6..82757c6 100644 --- a/res/layout-xlarge/camera_control.xml +++ b/res/layout-xlarge/camera_control.xml @@ -89,5 +89,13 @@ android:background="@drawable/btn_ic_mode_switch_camera"/> </com.android.camera.SwitcherSet> <include layout="@layout/review_control"/> + <com.android.camera.ui.CameraPicker android:id="@+id/camera_picker" + android:clickable="true" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentRight="true" + android:layout_alignParentBottom="true" + android:layout_marginRight="38dp" + android:layout_marginBottom="80dp" /> </com.android.camera.ui.ControlPanel> diff --git a/res/layout-xlarge/camera_picker.xml b/res/layout-xlarge/camera_picker.xml deleted file mode 100644 index eb0bcd0..0000000 --- a/res/layout-xlarge/camera_picker.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2010 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<com.android.camera.ui.CameraPicker xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/camera_picker" - android:visibility="gone" - android:orientation="horizontal" - android:layout_width="260dp" - android:layout_height="54dp" - android:layout_marginTop="10dp" - android:gravity="center" - android:layout_gravity="center_horizontal" - android:background="@drawable/mode_switch_bg_v2"> - <RadioButton android:text="@string/pref_camera_id_entry_back" - android:id="@+id/camera_switch_to_back" - android:layout_width="100dp" - android:layout_height="fill_parent" - android:layout_gravity="center" - android:gravity="center" - android:textSize="16sp" - android:textColor="@drawable/btn_camera_picker" - android:button="@android:color/transparent" - android:background="@android:color/transparent" - android:textStyle="bold"/> - <ImageView android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:src="@drawable/btn_ic_mode_switch_video"/> - <RadioButton android:text="@string/pref_camera_id_entry_front" - android:id="@+id/camera_switch_to_front" - android:layout_width="100dp" - android:layout_height="fill_parent" - android:layout_gravity="center" - android:gravity="center" - android:textSize="16sp" - android:textColor="@drawable/btn_camera_picker" - android:button="@android:color/transparent" - android:background="@android:color/transparent" - android:textStyle="bold"/> -</com.android.camera.ui.CameraPicker> diff --git a/res/layout-xlarge/preview_frame.xml b/res/layout-xlarge/preview_frame.xml index 3e72bc5..16be7e9 100644 --- a/res/layout-xlarge/preview_frame.xml +++ b/res/layout-xlarge/preview_frame.xml @@ -50,5 +50,4 @@ android:visibility="invisible"/> <include layout="@layout/review_thumbnail"/> </RelativeLayout> - <include layout="@layout/camera_picker" /> </com.android.camera.PreviewFrameLayout> diff --git a/res/layout-xlarge/preview_frame_video.xml b/res/layout-xlarge/preview_frame_video.xml index 6a4ace1..62a750b 100644 --- a/res/layout-xlarge/preview_frame_video.xml +++ b/res/layout-xlarge/preview_frame_video.xml @@ -48,5 +48,4 @@ android:drawableLeft="@drawable/ic_recording_indicator_small" android:visibility="gone"/> </RelativeLayout> - <include layout="@layout/camera_picker"/> </com.android.camera.PreviewFrameLayout> diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 10e9b5d..390cad6 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -550,6 +550,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private void initializeCameraPicker() { mCameraPicker = (CameraPicker) findViewById(R.id.camera_picker); if (mCameraPicker != null) { + mCameraPicker.setImageResource(R.drawable.camera_toggle); ListPreference pref = mPreferenceGroup.findPreference( CameraSettings.KEY_CAMERA_ID); if (pref != null) { diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index a7cd97d..ea5156a 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -421,6 +421,7 @@ public class VideoCamera extends NoSearchActivity private void initializeCameraPicker() { mCameraPicker = (CameraPicker) findViewById(R.id.camera_picker); if (mCameraPicker != null) { + mCameraPicker.setImageResource(R.drawable.camera_toggle_video); ListPreference pref = mPreferenceGroup.findPreference( CameraSettings.KEY_CAMERA_ID); if (pref != null) { @@ -1419,6 +1420,7 @@ public class VideoCamera extends NoSearchActivity updateRecordingIndicator(false); mRecordingTimeView.setText(""); mRecordingTimeView.setVisibility(View.VISIBLE); + mCameraPicker.setVisibility(View.GONE); if (mTimeLapseRecordingTimeView != null) { mTimeLapseRecordingTimeView.setText(""); mTimeLapseRecordingTimeView.setVisibility(View.VISIBLE); @@ -1529,6 +1531,7 @@ public class VideoCamera extends NoSearchActivity enableCameraControls(true); updateRecordingIndicator(true); mRecordingTimeView.setVisibility(View.GONE); + mCameraPicker.setVisibility(View.VISIBLE); if (mTimeLapseRecordingTimeView != null) { mTimeLapseRecordingTimeView.setVisibility(View.GONE); } diff --git a/src/com/android/camera/ui/CameraPicker.java b/src/com/android/camera/ui/CameraPicker.java index e2a3441..dd00c13 100644 --- a/src/com/android/camera/ui/CameraPicker.java +++ b/src/com/android/camera/ui/CameraPicker.java @@ -23,15 +23,12 @@ import android.content.Context; import android.hardware.Camera.CameraInfo; import android.util.AttributeSet; import android.view.View; -import android.widget.RadioButton; -import android.widget.RadioGroup; +import android.widget.ImageView; /** * A view for switching the front/back camera. */ -public class CameraPicker extends RadioGroup implements View.OnClickListener { - private RadioButton mFrontCamera; - private RadioButton mBackCamera; +public class CameraPicker extends ImageView implements View.OnClickListener { private Listener mListener; private ListPreference mPreference; private CharSequence[] mCameras; @@ -53,35 +50,24 @@ public class CameraPicker extends RadioGroup implements View.OnClickListener { mPreference = pref; mCameras = pref.getEntryValues(); if (mCameras == null) return; + setOnClickListener(this); String cameraId = pref.getValue(); setVisibility(View.VISIBLE); if (mCameras[CameraInfo.CAMERA_FACING_FRONT].equals(cameraId)) { - mFrontCamera.setChecked(true); mCameraIndex = CameraInfo.CAMERA_FACING_FRONT; } else { - mBackCamera.setChecked(true); mCameraIndex = CameraInfo.CAMERA_FACING_BACK; } } - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mFrontCamera = (RadioButton) findViewById(R.id.camera_switch_to_front); - mFrontCamera.setOnClickListener(this); - mBackCamera = (RadioButton) findViewById(R.id.camera_switch_to_back); - mBackCamera.setOnClickListener(this); - } - public void onClick(View v) { - int newCameraIndex = (v == mFrontCamera) + if (mCameras == null) return; + int newCameraIndex = (mCameraIndex == CameraInfo.CAMERA_FACING_BACK) ? CameraInfo.CAMERA_FACING_FRONT : CameraInfo.CAMERA_FACING_BACK; - if (mCameraIndex != newCameraIndex) { - mCameraIndex = newCameraIndex; - mPreference.setValue((String) mCameras[mCameraIndex]); - mListener.onSharedPreferenceChanged(); - } + mCameraIndex = newCameraIndex; + mPreference.setValue((String) mCameras[mCameraIndex]); + mListener.onSharedPreferenceChanged(); } } |