diff options
author | Steve Kondik <shade@chemlab.org> | 2013-12-15 02:07:46 -0500 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2013-12-16 02:05:16 -0500 |
commit | 8bdc51d3ecd4e3afd025671b33d12abc31c22431 (patch) | |
tree | 59b2c22cbc1bb1cfbb8ba36d3db6198ee42c7524 | |
parent | affefab0f7758b7d134c14e9aeac566828f238be (diff) | |
download | android_packages_apps_Camera2-8bdc51d3ecd4e3afd025671b33d12abc31c22431.tar.gz android_packages_apps_Camera2-8bdc51d3ecd4e3afd025671b33d12abc31c22431.tar.bz2 android_packages_apps_Camera2-8bdc51d3ecd4e3afd025671b33d12abc31c22431.zip |
camera: Forward-porting CM features
* ASD, slow shutter, beautify, focus time, etc
* New menu structure
* Includes work from Steve Kondik, Ethan Chen, jt1134, Michael Bestas
Change-Id: I73cf1e685ab2d55579d4b85f39916b59435e6569
65 files changed, 811 insertions, 389 deletions
diff --git a/res/drawable-hdpi/ic_asd.png b/res/drawable-hdpi/ic_asd.png Binary files differnew file mode 100755 index 000000000..36811fd06 --- /dev/null +++ b/res/drawable-hdpi/ic_asd.png diff --git a/res/drawable-hdpi/ic_asd_off.png b/res/drawable-hdpi/ic_asd_off.png Binary files differnew file mode 100755 index 000000000..0754228e7 --- /dev/null +++ b/res/drawable-hdpi/ic_asd_off.png diff --git a/res/drawable-hdpi/ic_beautify.png b/res/drawable-hdpi/ic_beautify.png Binary files differnew file mode 100755 index 000000000..1593c37d4 --- /dev/null +++ b/res/drawable-hdpi/ic_beautify.png diff --git a/res/drawable-hdpi/ic_beautify_off.png b/res/drawable-hdpi/ic_beautify_off.png Binary files differnew file mode 100755 index 000000000..dff40ce51 --- /dev/null +++ b/res/drawable-hdpi/ic_beautify_off.png diff --git a/res/drawable-hdpi/ic_enhance.png b/res/drawable-hdpi/ic_enhance.png Binary files differnew file mode 100755 index 000000000..b4158ba85 --- /dev/null +++ b/res/drawable-hdpi/ic_enhance.png diff --git a/res/drawable-hdpi/ic_indicator_sce_asd.png b/res/drawable-hdpi/ic_indicator_sce_asd.png Binary files differnew file mode 100755 index 000000000..e63e1d2bf --- /dev/null +++ b/res/drawable-hdpi/ic_indicator_sce_asd.png diff --git a/res/drawable-hdpi/ic_slowshutter.png b/res/drawable-hdpi/ic_slowshutter.png Binary files differnew file mode 100755 index 000000000..3c4202df8 --- /dev/null +++ b/res/drawable-hdpi/ic_slowshutter.png diff --git a/res/drawable-hdpi/ic_slowshutter_off.png b/res/drawable-hdpi/ic_slowshutter_off.png Binary files differnew file mode 100755 index 000000000..39236c52d --- /dev/null +++ b/res/drawable-hdpi/ic_slowshutter_off.png diff --git a/res/drawable-hdpi/ic_tint.png b/res/drawable-hdpi/ic_tint.png Binary files differnew file mode 100755 index 000000000..34a0bb2de --- /dev/null +++ b/res/drawable-hdpi/ic_tint.png diff --git a/res/drawable-hdpi/smart_scene_indoor.png b/res/drawable-hdpi/smart_scene_indoor.png Binary files differnew file mode 100755 index 000000000..30d12f522 --- /dev/null +++ b/res/drawable-hdpi/smart_scene_indoor.png diff --git a/res/drawable-hdpi/smart_scene_landscape.png b/res/drawable-hdpi/smart_scene_landscape.png Binary files differnew file mode 100755 index 000000000..66dcf2026 --- /dev/null +++ b/res/drawable-hdpi/smart_scene_landscape.png diff --git a/res/drawable-hdpi/smart_scene_macro.png b/res/drawable-hdpi/smart_scene_macro.png Binary files differnew file mode 100755 index 000000000..8f7b9f896 --- /dev/null +++ b/res/drawable-hdpi/smart_scene_macro.png diff --git a/res/drawable-hdpi/smart_scene_mix_illuminant.png b/res/drawable-hdpi/smart_scene_mix_illuminant.png Binary files differnew file mode 100755 index 000000000..9730d55b2 --- /dev/null +++ b/res/drawable-hdpi/smart_scene_mix_illuminant.png diff --git a/res/drawable-hdpi/smart_scene_night.png b/res/drawable-hdpi/smart_scene_night.png Binary files differnew file mode 100755 index 000000000..9f786ced3 --- /dev/null +++ b/res/drawable-hdpi/smart_scene_night.png diff --git a/res/drawable-hdpi/smart_scene_portrait.png b/res/drawable-hdpi/smart_scene_portrait.png Binary files differnew file mode 100755 index 000000000..701214c1a --- /dev/null +++ b/res/drawable-hdpi/smart_scene_portrait.png diff --git a/res/drawable-hdpi/smart_scene_sports.png b/res/drawable-hdpi/smart_scene_sports.png Binary files differnew file mode 100755 index 000000000..b5173e4ce --- /dev/null +++ b/res/drawable-hdpi/smart_scene_sports.png diff --git a/res/drawable-mdpi/ic_asd.png b/res/drawable-mdpi/ic_asd.png Binary files differnew file mode 100755 index 000000000..fe86e3b77 --- /dev/null +++ b/res/drawable-mdpi/ic_asd.png diff --git a/res/drawable-mdpi/ic_asd_off.png b/res/drawable-mdpi/ic_asd_off.png Binary files differnew file mode 100755 index 000000000..7fe91db45 --- /dev/null +++ b/res/drawable-mdpi/ic_asd_off.png diff --git a/res/drawable-mdpi/ic_beautify.png b/res/drawable-mdpi/ic_beautify.png Binary files differnew file mode 100755 index 000000000..0505b957d --- /dev/null +++ b/res/drawable-mdpi/ic_beautify.png diff --git a/res/drawable-mdpi/ic_beautify_off.png b/res/drawable-mdpi/ic_beautify_off.png Binary files differnew file mode 100755 index 000000000..95df3426e --- /dev/null +++ b/res/drawable-mdpi/ic_beautify_off.png diff --git a/res/drawable-mdpi/ic_enhance.png b/res/drawable-mdpi/ic_enhance.png Binary files differnew file mode 100755 index 000000000..12f73baf9 --- /dev/null +++ b/res/drawable-mdpi/ic_enhance.png diff --git a/res/drawable-mdpi/ic_indicator_sce_asd.png b/res/drawable-mdpi/ic_indicator_sce_asd.png Binary files differnew file mode 100755 index 000000000..8df3dbe29 --- /dev/null +++ b/res/drawable-mdpi/ic_indicator_sce_asd.png diff --git a/res/drawable-mdpi/ic_slowshutter.png b/res/drawable-mdpi/ic_slowshutter.png Binary files differnew file mode 100755 index 000000000..bdfcc403e --- /dev/null +++ b/res/drawable-mdpi/ic_slowshutter.png diff --git a/res/drawable-mdpi/ic_slowshutter_off.png b/res/drawable-mdpi/ic_slowshutter_off.png Binary files differnew file mode 100755 index 000000000..d9f65dcfe --- /dev/null +++ b/res/drawable-mdpi/ic_slowshutter_off.png diff --git a/res/drawable-mdpi/ic_tint.png b/res/drawable-mdpi/ic_tint.png Binary files differnew file mode 100755 index 000000000..cd593bbde --- /dev/null +++ b/res/drawable-mdpi/ic_tint.png diff --git a/res/drawable-mdpi/smart_scene_indoor.png b/res/drawable-mdpi/smart_scene_indoor.png Binary files differnew file mode 100644 index 000000000..d3c65bc6d --- /dev/null +++ b/res/drawable-mdpi/smart_scene_indoor.png diff --git a/res/drawable-mdpi/smart_scene_landscape.png b/res/drawable-mdpi/smart_scene_landscape.png Binary files differnew file mode 100644 index 000000000..f235dafd5 --- /dev/null +++ b/res/drawable-mdpi/smart_scene_landscape.png diff --git a/res/drawable-mdpi/smart_scene_macro.png b/res/drawable-mdpi/smart_scene_macro.png Binary files differnew file mode 100644 index 000000000..91ded8a31 --- /dev/null +++ b/res/drawable-mdpi/smart_scene_macro.png diff --git a/res/drawable-mdpi/smart_scene_mix_illuminant.png b/res/drawable-mdpi/smart_scene_mix_illuminant.png Binary files differnew file mode 100644 index 000000000..081553411 --- /dev/null +++ b/res/drawable-mdpi/smart_scene_mix_illuminant.png diff --git a/res/drawable-mdpi/smart_scene_night.png b/res/drawable-mdpi/smart_scene_night.png Binary files differnew file mode 100644 index 000000000..8aec6e542 --- /dev/null +++ b/res/drawable-mdpi/smart_scene_night.png diff --git a/res/drawable-mdpi/smart_scene_portrait.png b/res/drawable-mdpi/smart_scene_portrait.png Binary files differnew file mode 100644 index 000000000..8e11540ca --- /dev/null +++ b/res/drawable-mdpi/smart_scene_portrait.png diff --git a/res/drawable-mdpi/smart_scene_sports.png b/res/drawable-mdpi/smart_scene_sports.png Binary files differnew file mode 100644 index 000000000..4438687f1 --- /dev/null +++ b/res/drawable-mdpi/smart_scene_sports.png diff --git a/res/drawable-xhdpi/ic_asd.png b/res/drawable-xhdpi/ic_asd.png Binary files differnew file mode 100755 index 000000000..ffa4a2e7a --- /dev/null +++ b/res/drawable-xhdpi/ic_asd.png diff --git a/res/drawable-xhdpi/ic_asd_off.png b/res/drawable-xhdpi/ic_asd_off.png Binary files differnew file mode 100755 index 000000000..ff708a9c0 --- /dev/null +++ b/res/drawable-xhdpi/ic_asd_off.png diff --git a/res/drawable-xhdpi/ic_beautify.png b/res/drawable-xhdpi/ic_beautify.png Binary files differnew file mode 100755 index 000000000..5f581efa9 --- /dev/null +++ b/res/drawable-xhdpi/ic_beautify.png diff --git a/res/drawable-xhdpi/ic_beautify_off.png b/res/drawable-xhdpi/ic_beautify_off.png Binary files differnew file mode 100755 index 000000000..9d3079fb2 --- /dev/null +++ b/res/drawable-xhdpi/ic_beautify_off.png diff --git a/res/drawable-xhdpi/ic_enhance.png b/res/drawable-xhdpi/ic_enhance.png Binary files differnew file mode 100755 index 000000000..9c34ea2e9 --- /dev/null +++ b/res/drawable-xhdpi/ic_enhance.png diff --git a/res/drawable-xhdpi/ic_indicator_beautify.png b/res/drawable-xhdpi/ic_indicator_beautify.png Binary files differnew file mode 100755 index 000000000..bc88810df --- /dev/null +++ b/res/drawable-xhdpi/ic_indicator_beautify.png diff --git a/res/drawable-xhdpi/ic_indicator_sce_asd.png b/res/drawable-xhdpi/ic_indicator_sce_asd.png Binary files differnew file mode 100755 index 000000000..33e4dacfa --- /dev/null +++ b/res/drawable-xhdpi/ic_indicator_sce_asd.png diff --git a/res/drawable-xhdpi/ic_indicator_slowshutter.png b/res/drawable-xhdpi/ic_indicator_slowshutter.png Binary files differnew file mode 100755 index 000000000..fdfbe7f8f --- /dev/null +++ b/res/drawable-xhdpi/ic_indicator_slowshutter.png diff --git a/res/drawable-xhdpi/ic_slowshutter.png b/res/drawable-xhdpi/ic_slowshutter.png Binary files differnew file mode 100755 index 000000000..bb0a89a3d --- /dev/null +++ b/res/drawable-xhdpi/ic_slowshutter.png diff --git a/res/drawable-xhdpi/ic_slowshutter_off.png b/res/drawable-xhdpi/ic_slowshutter_off.png Binary files differnew file mode 100755 index 000000000..da8c264fd --- /dev/null +++ b/res/drawable-xhdpi/ic_slowshutter_off.png diff --git a/res/drawable-xhdpi/ic_tint.png b/res/drawable-xhdpi/ic_tint.png Binary files differnew file mode 100755 index 000000000..5cd73ab43 --- /dev/null +++ b/res/drawable-xhdpi/ic_tint.png diff --git a/res/drawable-xhdpi/smart_scene_indoor.png b/res/drawable-xhdpi/smart_scene_indoor.png Binary files differnew file mode 100644 index 000000000..8425c5029 --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_indoor.png diff --git a/res/drawable-xhdpi/smart_scene_landscape.png b/res/drawable-xhdpi/smart_scene_landscape.png Binary files differnew file mode 100644 index 000000000..20fa5dacd --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_landscape.png diff --git a/res/drawable-xhdpi/smart_scene_macro.png b/res/drawable-xhdpi/smart_scene_macro.png Binary files differnew file mode 100644 index 000000000..eb0fff390 --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_macro.png diff --git a/res/drawable-xhdpi/smart_scene_mix_illuminant.png b/res/drawable-xhdpi/smart_scene_mix_illuminant.png Binary files differnew file mode 100644 index 000000000..62e119a2d --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_mix_illuminant.png diff --git a/res/drawable-xhdpi/smart_scene_night.png b/res/drawable-xhdpi/smart_scene_night.png Binary files differnew file mode 100644 index 000000000..d96940311 --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_night.png diff --git a/res/drawable-xhdpi/smart_scene_portrait.png b/res/drawable-xhdpi/smart_scene_portrait.png Binary files differnew file mode 100644 index 000000000..1ac80236f --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_portrait.png diff --git a/res/drawable-xhdpi/smart_scene_sports.png b/res/drawable-xhdpi/smart_scene_sports.png Binary files differnew file mode 100644 index 000000000..6a72b737b --- /dev/null +++ b/res/drawable-xhdpi/smart_scene_sports.png diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml index cfa73e390..26110fd3c 100644 --- a/res/layout/photo_module.xml +++ b/res/layout/photo_module.xml @@ -112,11 +112,21 @@ android:layout="@layout/face_view" android:layout_width="match_parent" android:layout_height="match_parent" - android:visibility="gone"/> + android:visibility="gone" /> <com.android.camera.ui.RenderOverlay android:id="@+id/render_overlay" android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_height="match_parent"> + <com.android.camera.ui.RotateImageView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/scene_detect_icon" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentTop="true" + android:padding="23dp" + android:visibility="gone" + android:src="@drawable/smart_scene_sports" /> + </com.android.camera.ui.RenderOverlay> <include layout="@layout/camera_controls" android:layout_gravity="center" style="@style/CameraControls"/> diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml new file mode 100755 index 000000000..d543e7d9c --- /dev/null +++ b/res/values/cm_arrays.xml @@ -0,0 +1,146 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2013 The CyanogenMod 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. +--> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <string-array name="pref_switch_entryvalues" translatable="false"> + <item>off</item> + <item>on</item> + </string-array> + + <array name="pref_switch_entries" translatable="false"> + <item>@string/setting_off</item> + <item>@string/setting_on</item> + </array> + + <!-- Camera Preferences for burst modes --> + <string-array name="pref_camera_burst_mode_entries" translatable="false"> + <item>@string/pref_camera_burst_entry_20</item> + <item>@string/pref_camera_burst_entry_15</item> + <item>@string/pref_camera_burst_entry_10</item> + <item>@string/pref_camera_burst_entry_5</item> + <item>@string/pref_camera_burst_entry_off</item> + </string-array> + + <string-array name="pref_camera_burst_mode_values" translatable="false"> + <item>20</item> + <item>15</item> + <item>10</item> + <item>5</item> + <item>1</item> + </string-array> + + <!-- Camera Preferences for timer duration --> + <string-array name="pref_camera_focustime_duration_entries" translatable="false"> + <item>@string/pref_camera_focustime_entry_infinite</item> + <item>@string/pref_camera_focustime_entry_30</item> + <item>@string/pref_camera_focustime_entry_20</item> + <item>@string/pref_camera_focustime_entry_15</item> + <item>@string/pref_camera_focustime_entry_10</item> + <item>@string/pref_camera_focustime_entry_5</item> + </string-array> + + <!-- Camera focus duration - stored in milliseconds --> + <string-array name="pref_camera_focustime_duration_values" translatable="false"> + <item>0</item> + <item>30000</item> + <item>20000</item> + <item>15000</item> + <item>10000</item> + <item>5000</item> + </string-array> + + <!-- Slow shutter feature --> + <string-array name="pref_camera_slow_shutter_entries" translatable="false"> + <item>@string/pref_camera_slow_shutter_entry_off</item> + <item>@string/pref_camera_slow_shutter_entry_auto</item> + <!-- + <item>@string/pref_camera_slow_shutter_entry_half_second</item> + <item>@string/pref_camera_slow_shutter_entry_1s</item> + <item>@string/pref_camera_slow_shutter_entry_2s</item> + <item>@string/pref_camera_slow_shutter_entry_4s</item> + <item>@string/pref_camera_slow_shutter_entry_8s</item> + --> + </string-array> + + <string-array name="pref_camera_slow_shutter_entryvalues" translatable="false"> + <item>slow-shutter-off</item> + <item>slow-shutter-auto</item> + <!-- + <item>slow-shutter-1/2s</item> + <item>slow-shutter-1s</item> + <item>slow-shutter-2s</item> + <item>slow-shutter-4s</item> + <item>slow-shutter-8s</item> + --> + </string-array> + + <string-array name="pref_camera_slow_shutter_icons" translatable="false"> + <item>@drawable/ic_slowshutter_off</item> + <item>@drawable/ic_slowshutter</item> + </string-array> + + <string-array name="pref_camera_beauty_mode_icons" translatable="false"> + <item>@drawable/ic_beautify_off</item> + <item>@drawable/ic_beautify</item> + </string-array> + + <string-array name="pref_camera_beauty_mode_labels" translatable="false"> + <item>@string/camera_menu_beauty_mode_label</item> + <item>@string/camera_menu_beauty_mode_label</item> + </string-array> + + <string-array name="pref_camera_slow_shutter_labels" translatable="false"> + <item>@string/camera_menu_slow_shutter_label</item> + <item>@string/camera_menu_slow_shutter_label</item> + </string-array> + + <string-array name="camera_asd_values" translatable="false"> + <item>indoor</item> + <item>landscape</item> + <item>macro</item> + <item>mix_illuminant</item> + <item>night</item> + <item>portrait</item> + <item>sports</item> + </string-array> + + <string-array name="camera_asd_icons" translatable="false"> + <item>@drawable/smart_scene_indoor</item> + <item>@drawable/smart_scene_landscape</item> + <item>@drawable/smart_scene_macro</item> + <item>@drawable/smart_scene_mix_illuminant</item> + <item>@drawable/smart_scene_night</item> + <item>@drawable/smart_scene_portrait</item> + <item>@drawable/smart_scene_sports</item> + </string-array> + + <string-array name="pref_camera_asd_labels" translatable="false"> + <item>@string/camera_menu_asd_label</item> + <item>@string/camera_menu_asd_label</item> + </string-array> + + <string-array name="pref_camera_asd_icons" translatable="false"> + <item>@drawable/ic_asd_off</item> + <item>@drawable/ic_asd</item> + </string-array> + + <string-array name="pref_camera_asd_entryvalues" translatable="false"> + <item>@string/setting_off_value</item> + <item>@string/setting_on_value</item> + </string-array> + +</resources> diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index 134c02bc9..9a2684b40 100644 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -121,7 +121,57 @@ <string name="pref_camera_coloreffect_entry_point_red_yellow">Point red-yellow</string> <string name="pref_camera_coloreffect_entry_cartoonize">Cartoonize</string> + <!-- Settings screen, Burst mode title --> + <string name="pref_camera_burst_title">Burst mode</string> + <string name="pref_camera_burst_default" translatable="false">1</string> + + <!-- Settings screen, Burst mode entries --> + <string name="pref_camera_burst_entry_off">Off</string> + <string name="pref_camera_burst_entry_5">5 shots</string> + <string name="pref_camera_burst_entry_10">10 shots</string> + <string name="pref_camera_burst_entry_15">15 shots</string> + <string name="pref_camera_burst_entry_20">20 shots</string> + + <!-- Touch-to-focus duration settings --> + <string name="pref_camera_focustime_title">Touch focus duration</string> + <string name="pref_camera_focustime_summary">Select duration for touch focus</string> + <string name="pref_camera_focustime_default" translatable="false">5000</string> + + <!-- Settings screen, Timer mode entries --> + <string name="pref_camera_focustime_entry_5">5s</string> + <string name="pref_camera_focustime_entry_10">10s</string> + <string name="pref_camera_focustime_entry_15">15s</string> + <string name="pref_camera_focustime_entry_20">20s</string> + <string name="pref_camera_focustime_entry_30">30s</string> + <string name="pref_camera_focustime_entry_infinite">Infinite</string> + <!-- Red eye flash mode title --> <string name="pref_camera_flashmode_entry_redeye">Red eye</string> <string name="pref_camera_flashmode_label_redeye">RED EYE</string> + + <!-- Beauty mode --> + <string name="pref_camera_beauty_mode_title">Beauty mode</string> + <string name="pref_camera_beauty_mode_default" translatable="false">off</string> + + <!-- Slow shutter modes --> + <string name="pref_camera_slow_shutter_title">Slow shutter</string> + <string name="pref_camera_slow_shutter_default" translatable="false">slow-shutter-off</string> + <string name="pref_camera_slow_shutter_entry_off">Off</string> + <string name="pref_camera_slow_shutter_entry_auto">Auto</string> + <string name="pref_camera_slow_shutter_entry_half_second">1/2 second</string> + <string name="pref_camera_slow_shutter_entry_1s">1 second</string> + <string name="pref_camera_slow_shutter_entry_2s">2 seconds</string> + <string name="pref_camera_slow_shutter_entry_4s">4 seconds</string> + <string name="pref_camera_slow_shutter_entry_8s">8 seconds</string> + + <!-- ASD --> + <string name="pref_camera_asd_default" translatable="false">@string/setting_off_value</string> + + <string name="camera_menu_enhance_label">ENHANCE</string> + <string name="camera_menu_slow_shutter_label">SLOW SHUTTER</string> + <string name="camera_menu_beauty_mode_label">BEAUTIFY</string> + <string name="camera_menu_colorize_label">COLORIZE</string> + <string name="camera_menu_effects_label">EFFECTS</string> + <string name="camera_menu_asd_label">SMART SCENE</string> + </resources> diff --git a/res/xml/camera_preferences.xml b/res/xml/camera_preferences.xml index 36165abc0..d5bd00194 100644 --- a/res/xml/camera_preferences.xml +++ b/res/xml/camera_preferences.xml @@ -31,11 +31,10 @@ camera:defaultValue="@string/pref_exposure_default" camera:title="@string/pref_exposure_title" camera:singleIcon="@drawable/ic_exposure_holo_light" /> - <IconListPreference + <ListPreference camera:key="pref_camera_scenemode_key" camera:defaultValue="@string/pref_camera_scenemode_default" camera:title="@string/pref_camera_scenemode_title" - camera:singleIcon="@drawable/ic_sce" camera:entries="@array/pref_camera_scenemode_entries" camera:entryValues="@array/pref_camera_scenemode_entryvalues" /> <IconListPreference @@ -66,7 +65,6 @@ camera:defaultValue="@array/pref_camera_focusmode_default_array" camera:title="@string/pref_camera_focusmode_title" camera:entries="@array/pref_camera_focusmode_entries" - camera:labelList="@array/pref_camera_focusmode_labels" camera:entryValues="@array/pref_camera_focusmode_entryvalues" /> <ListPreference camera:key="pref_camera_ae_bracket_hdr_key" @@ -230,4 +228,38 @@ camera:defaultValue="@string/pref_camera_videosnapsize_default" camera:entries="@array/pref_camera_picturesize_entries" camera:entryValues="@array/pref_camera_picturesize_entryvalues" /> + <ListPreference + camera:key="pref_camera_focustime_key" + camera:defaultValue="@string/pref_camera_focustime_default" + camera:title="@string/pref_camera_focustime_title" + camera:entries="@array/pref_camera_focustime_duration_entries" + camera:entryValues="@array/pref_camera_focustime_duration_values" /> + <IconListPreference + camera:key="pref_camera_beauty_mode" + camera:defaultValue="@string/pref_camera_beauty_mode_default" + camera:title="@string/pref_camera_beauty_mode_title" + camera:icons="@array/pref_camera_beauty_mode_icons" + camera:largeIcons="@array/pref_camera_beauty_mode_icons" + camera:labelList="@array/pref_camera_beauty_mode_labels" + camera:entries="@array/pref_switch_entries" + camera:entryValues="@array/pref_switch_entryvalues" /> + <IconListPreference + camera:key="pref_camera_slow_shutter" + camera:defaultValue="@string/pref_camera_slow_shutter_default" + camera:title="@string/pref_camera_slow_shutter_title" + camera:icons="@array/pref_camera_slow_shutter_icons" + camera:largeIcons="@array/pref_camera_slow_shutter_icons" + camera:labelList="@array/pref_camera_slow_shutter_labels" + camera:entries="@array/pref_camera_slow_shutter_entries" + camera:entryValues="@array/pref_camera_slow_shutter_entryvalues" /> + <IconListPreference + camera:key="pref_camera_asd" + camera:defaultValue="@string/pref_camera_asd_default" + camera:title="@string/pref_camera_scenemode_entry_asd" + camera:entries="@array/pref_switch_entries" + camera:icons="@array/pref_camera_asd_icons" + camera:largeIcons="@array/pref_camera_asd_icons" + camera:labelList="@array/pref_camera_asd_labels" + camera:entryValues="@array/pref_switch_entryvalues" /> + </PreferenceGroup> diff --git a/res/xml/video_preferences.xml b/res/xml/video_preferences.xml index ab876b81c..78fce96e9 100644 --- a/res/xml/video_preferences.xml +++ b/res/xml/video_preferences.xml @@ -114,16 +114,28 @@ camera:title="@string/pref_camera_hfr_title" camera:entries="@array/pref_camera_hfr_entries" camera:entryValues="@array/pref_camera_hfr_entryvalues"/> - <ListPreference + <IconListPreference camera:key="pref_camera_video_hdr_key" camera:defaultValue="@string/pref_camera_video_hdr_default" - camera:title="@string/pref_camera_video_hdr_title" - camera:entries="@array/pref_camera_video_hdr_entries" - camera:entryValues="@array/pref_camera_video_hdr_entryvalues"/> + camera:title="@string/pref_camera_scenemode_entry_hdr" + camera:entries="@array/pref_camera_hdr_entries" + camera:icons="@array/pref_camera_hdr_icons" + camera:largeIcons="@array/pref_camera_hdr_icons" + camera:labelList="@array/pref_camera_hdr_labels" + camera:entryValues="@array/pref_camera_hdr_entryvalues" /> <ListPreference camera:key="pref_camera_videosnapsize_key" camera:defaultValue="@string/pref_camera_videosnapsize_default" camera:title="@string/pref_camera_picturesize_title" camera:entries="@array/pref_camera_picturesize_entries" camera:entryValues="@array/pref_camera_picturesize_entryvalues" /> + <IconListPreference + camera:key="pref_camera_beauty_mode" + camera:defaultValue="@string/pref_camera_beauty_mode_default" + camera:title="@string/pref_camera_beauty_mode_title" + camera:icons="@array/pref_camera_beauty_mode_icons" + camera:largeIcons="@array/pref_camera_beauty_mode_icons" + camera:labelList="@array/pref_camera_beauty_mode_labels" + camera:entries="@array/pref_switch_entries" + camera:entryValues="@array/pref_switch_entryvalues" /> </PreferenceGroup> diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index e97e08eac..de251e29e 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -36,6 +36,7 @@ import com.android.camera.util.GcamHelper; import com.android.camera2.R; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Locale; import android.os.Build; @@ -55,6 +56,7 @@ public class CameraSettings { public static final String KEY_PICTURE_SIZE = "pref_camera_picturesize_key"; public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key"; public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key"; + public static final String KEY_FOCUS_TIME = "pref_camera_focustime_key"; public static final String KEY_FLASH_MODE = "pref_camera_flashmode_key"; public static final String KEY_VIDEOCAMERA_FLASH_MODE = "pref_camera_video_flashmode_key"; public static final String KEY_WHITE_BALANCE = "pref_camera_whitebalance_key"; @@ -127,6 +129,10 @@ public class CameraSettings { private static final String VIDEO_QUALITY_MMS = "mms"; private static final String VIDEO_QUALITY_YOUTUBE = "youtube"; + public static final String KEY_BURST_MODE = "pref_camera_burst_key"; + public static final String KEY_BEAUTY_MODE = "pref_camera_beauty_mode"; + public static final String KEY_SLOW_SHUTTER = "pref_camera_slow_shutter"; + public static final String KEY_ASD = "pref_camera_asd"; public static final String EXPOSURE_DEFAULT_VALUE = "0"; @@ -297,7 +303,6 @@ public class CameraSettings { ListPreference faceRC = group.findPreference(KEY_FACE_RECOGNITION); ListPreference jpegQuality = group.findPreference(KEY_JPEG_QUALITY); ListPreference videoSnapSize = group.findPreference(KEY_VIDEO_SNAPSHOT_SIZE); - ListPreference videoHdr = group.findPreference(KEY_VIDEO_HDR); ListPreference pictureFormat = group.findPreference(KEY_PICTURE_FORMAT); if (touchAfAec != null) { @@ -329,11 +334,6 @@ public class CameraSettings { denoise, mParameters.getSupportedDenoiseModes()); } - if (videoHdr != null) { - filterUnsupportedOptions(group, - videoHdr, mParameters.getSupportedVideoHDRModes()); - } - if (colorEffect != null) { filterUnsupportedOptions(group, colorEffect, mParameters.getSupportedColorEffects()); @@ -408,6 +408,9 @@ public class CameraSettings { ListPreference cameraHdr = group.findPreference(KEY_CAMERA_HDR); ListPreference disMode = group.findPreference(KEY_DIS); ListPreference cameraHdrPlus = group.findPreference(KEY_CAMERA_HDR_PLUS); + ListPreference beautyMode = group.findPreference(KEY_BEAUTY_MODE); + ListPreference slowShutter = group.findPreference(KEY_SLOW_SHUTTER); + ListPreference asd = group.findPreference(KEY_ASD); // Since the screen could be loaded from different resources, we need // to check if the preference is available here @@ -464,6 +467,17 @@ public class CameraSettings { !GcamHelper.hasGcamCapture() || isFrontCamera)) { removePreference(group, cameraHdrPlus.getKey()); } + if (beautyMode != null) { + if (!isBeautyModeSupported(mParameters)) { + removePreference(group, beautyMode.getKey()); + } + } + if (slowShutter != null) { + filterUnsupportedOptions(group, slowShutter, getSupportedSlowShutter(mParameters)); + } + if (asd != null && !CameraUtil.isAutoSceneDetectionSupported(mParameters)) { + removePreference(group, asd.getKey()); + } qcomInitPreferences(group); } @@ -829,4 +843,38 @@ public class CameraSettings { } return DEFAULT_VIDEO_DURATION * 1000; } + + /** + * Beauty mode + */ + public static void setBeautyMode(Parameters params, boolean enable) { + if (isBeautyModeSupported(params)) { + params.set("video-skinbeauty-mode", enable ? "on" : "off"); + params.set("face-beautify", enable ? "3" : "0"); + } + } + + public static boolean isBeautyModeSupported(Parameters params) { + return params.get("face-beautify") != null; + } + + public static List<String> getSupportedSlowShutter(Parameters params) { + String p = params.get("slow-shutter-values"); + if (p != null) { + return Arrays.asList(p.split(",")); + } + return null; + } + + public static void setSlowShutter(Parameters params, String value) { + if (getSupportedSlowShutter(params) != null) { + params.set("slow-shutter", value); + } + } + + public static boolean isSlowShutterEnabled(Parameters params) { + return (getSupportedSlowShutter(params) != null) && + !"slow-shutter-off".equals(params.get("slow-shutter")); + } + } diff --git a/src/com/android/camera/FocusOverlayManager.java b/src/com/android/camera/FocusOverlayManager.java index 9558944c0..5d0323ef7 100644 --- a/src/com/android/camera/FocusOverlayManager.java +++ b/src/com/android/camera/FocusOverlayManager.java @@ -60,7 +60,6 @@ public class FocusOverlayManager { private static final String TAG = "CAM_FocusManager"; private static final int RESET_TOUCH_FOCUS = 0; - private static final int RESET_TOUCH_FOCUS_DELAY = 3000; private int mState = STATE_IDLE; public static final int STATE_IDLE = 0; // Focus is not active. @@ -95,6 +94,8 @@ public class FocusOverlayManager { private FocusUI mUI; private final Rect mPreviewRect = new Rect(0, 0, 0, 0); + private int mFocusTime; + public interface FocusUI { public boolean hasFaces(); public void clearFocus(); @@ -268,6 +269,11 @@ public class FocusOverlayManager { } } + // set touch-to-focus duration + public void setFocusTime(int time) { + mFocusTime = time; + } + public void onAutoFocus(boolean focused, boolean shutterButtonPressed) { if (mState == STATE_FOCUSING_SNAP_ON_FINISH) { // Take the picture no matter focus succeeds or fails. No need @@ -292,8 +298,8 @@ public class FocusOverlayManager { updateFocusUI(); // If this is triggered by touch focus, cancel focus after a // while. - if (!mFocusDefault) { - mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY); + if ((!mFocusDefault) && (mFocusTime != 0)) { + mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, mFocusTime); } if (shutterButtonPressed) { // Lock AE & AWB so users can half-press shutter and recompose. @@ -390,9 +396,10 @@ public class FocusOverlayManager { autoFocus(); } else { // Just show the indicator in all other cases. updateFocusUI(); - // Reset the metering area in 3 seconds. mHandler.removeMessages(RESET_TOUCH_FOCUS); - mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, RESET_TOUCH_FOCUS_DELAY); + if (mFocusTime != 0) { + mHandler.sendEmptyMessageDelayed(RESET_TOUCH_FOCUS, mFocusTime); + } } } diff --git a/src/com/android/camera/OnScreenIndicators.java b/src/com/android/camera/OnScreenIndicators.java index c5fb430f2..a44acc6a2 100644 --- a/src/com/android/camera/OnScreenIndicators.java +++ b/src/com/android/camera/OnScreenIndicators.java @@ -177,12 +177,20 @@ public class OnScreenIndicators { return; } - if (SCENE_MODE_HDR_PLUS.equals(value)) { + if (value == null) { + mSceneIndicator.setImageResource(R.drawable.ic_indicator_sce_off); + } else if (SCENE_MODE_HDR_PLUS.equals(value)) { mSceneIndicator.setImageResource(R.drawable.ic_indicator_hdr_plus_on); - } else if ((value == null) || Parameters.SCENE_MODE_AUTO.equals(value)) { + } else if ("beauty".equals(value)) { + mSceneIndicator.setImageResource(R.drawable.ic_indicator_beautify); + } else if ("slow".equals(value)) { + mSceneIndicator.setImageResource(R.drawable.ic_indicator_slowshutter); + } else if (Parameters.SCENE_MODE_AUTO.equals(value)) { mSceneIndicator.setImageResource(R.drawable.ic_indicator_sce_off); } else if (Parameters.SCENE_MODE_HDR.equals(value)) { mSceneIndicator.setImageResource(R.drawable.ic_indicator_sce_hdr); + } else if ("asd".equals(value)) { + mSceneIndicator.setImageResource(R.drawable.ic_indicator_sce_asd); } else { mSceneIndicator.setImageResource(R.drawable.ic_indicator_sce_on); } diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java index 0f4d3b74a..b7fc183d2 100644 --- a/src/com/android/camera/PhotoMenu.java +++ b/src/com/android/camera/PhotoMenu.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2013 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,10 +17,10 @@ package com.android.camera; -import java.util.Locale; - +import android.content.Context; import android.content.res.Resources; import android.hardware.Camera.Parameters; +import android.view.LayoutInflater; import com.android.camera.ui.AbstractSettingPopup; import com.android.camera.ui.CountdownTimerPopup; @@ -28,35 +29,28 @@ import com.android.camera.ui.MoreSettingPopup; import com.android.camera.ui.PieItem; import com.android.camera.ui.PieItem.OnClickListener; import com.android.camera.ui.PieRenderer; + import com.android.camera2.R; -import android.content.Context; -import android.view.LayoutInflater; -import android.util.Log; import java.util.Locale; public class PhotoMenu extends PieController implements MoreSettingPopup.Listener, - CountdownTimerPopup.Listener, + CountdownTimerPopup.Listener, ListPrefSettingPopup.Listener { - private static String TAG = "PhotoMenu"; + private static String TAG = "CAM_photomenu"; private final String mSettingOff; - private String[] mOtherKeys1; - private String[] mOtherKeys2; - private String[] mOtherKeys3; - private MoreSettingPopup mPopup1; - private MoreSettingPopup mPopup2; - private MoreSettingPopup mPopup3; + private PhotoUI mUI; + private String[] mOtherKeys; + private AbstractSettingPopup mPopup; + private static final int POPUP_NONE = 0; private static final int POPUP_FIRST_LEVEL = 1; private static final int POPUP_SECOND_LEVEL = 2; - private PhotoUI mUI; private int mPopupStatus; - private AbstractSettingPopup mPopup; private CameraActivity mActivity; - private int popupNum = 0; public PhotoMenu(CameraActivity activity, PhotoUI ui, PieRenderer pie) { super(activity, pie); @@ -68,110 +62,81 @@ public class PhotoMenu extends PieController public void initialize(PreferenceGroup group) { super.initialize(group); mPopup = null; - mPopup1 = null; - mPopup2 = null; - mPopup3 = null; mPopupStatus = POPUP_NONE; PieItem item = null; - popupNum = 0; final Resources res = mActivity.getResources(); Locale locale = res.getConfiguration().locale; - // The order is from left to right in the menu. + // the order is from left to right in the menu + + // exposure compensation + if (group.findPreference(CameraSettings.KEY_EXPOSURE) != null) { + item = makeItem(CameraSettings.KEY_EXPOSURE); + item.setLabel(res.getString(R.string.pref_exposure_label)); + mRenderer.addItem(item); + } + // enhance + PieItem enhance = makeItem(R.drawable.ic_enhance); + enhance.setLabel(res.getString(R.string.camera_menu_enhance_label)); + mRenderer.addItem(enhance); // HDR+ (GCam). if (group.findPreference(CameraSettings.KEY_CAMERA_HDR_PLUS) != null) { item = makeSwitchItem(CameraSettings.KEY_CAMERA_HDR_PLUS, true); - mRenderer.addItem(item); } - - // HDR. + // hdr if (group.findPreference(CameraSettings.KEY_CAMERA_HDR) != null) { item = makeSwitchItem(CameraSettings.KEY_CAMERA_HDR, true); - mRenderer.addItem(item); + enhance.addItem(item); } - - mOtherKeys1 = new String[] { - CameraSettings.KEY_SCENE_MODE, - CameraSettings.KEY_RECORD_LOCATION, - CameraSettings.KEY_PICTURE_SIZE, - CameraSettings.KEY_HISTOGRAM, - CameraSettings.KEY_FOCUS_MODE, - CameraSettings.KEY_PICTURE_FORMAT, - CameraSettings.KEY_JPEG_QUALITY, - CameraSettings.KEY_ZSL, - CameraSettings.KEY_TIMER, - CameraSettings.KEY_TIMER_SOUND_EFFECTS - }; - - mOtherKeys2 = new String[] { - CameraSettings.KEY_COLOR_EFFECT, - CameraSettings.KEY_FACE_DETECTION, - CameraSettings.KEY_FACE_RECOGNITION, - CameraSettings.KEY_TOUCH_AF_AEC, - CameraSettings.KEY_SELECTABLE_ZONE_AF, - CameraSettings.KEY_SATURATION, - CameraSettings.KEY_CONTRAST, - CameraSettings.KEY_SHARPNESS, - CameraSettings.KEY_AUTOEXPOSURE - }; - - mOtherKeys3 = new String[] { - CameraSettings.KEY_ANTIBANDING, - CameraSettings.KEY_ISO, - CameraSettings.KEY_DENOISE, - CameraSettings.KEY_EXPOSURE, - CameraSettings.KEY_WHITE_BALANCE, - CameraSettings.KEY_FLASH_MODE, - CameraSettings.KEY_REDEYE_REDUCTION, - CameraSettings.KEY_AE_BRACKET_HDR - }; - - PieItem item1 = makeItem(R.drawable.ic_settings_holo_light); - item1.setLabel(mActivity.getResources().getString(R.string.camera_menu_more_label)); - item1.setOnClickListener(new OnClickListener() { - @Override - public void onClick(PieItem item) { - if (mPopup1 == null || mPopupStatus != POPUP_FIRST_LEVEL){ - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; - } - mUI.showPopup(mPopup1); - popupNum = 1; - } - }); - mRenderer.addItem(item1); - - PieItem item2 = makeItem(R.drawable.ic_settings_holo_light); - item2.setLabel(mActivity.getResources().getString(R.string.camera_menu_more_label)); - item2.setOnClickListener(new OnClickListener() { - @Override - public void onClick(PieItem item) { - if (mPopup2 == null || mPopupStatus != POPUP_FIRST_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; - } - mUI.showPopup(mPopup2); - popupNum = 2; - } - }); - mRenderer.addItem(item2); - - PieItem item3= makeItem(R.drawable.ic_settings_holo_light); - item3.setLabel(mActivity.getResources().getString(R.string.camera_menu_more_label)); - item3.setOnClickListener(new OnClickListener() { - @Override - public void onClick(PieItem item) { - if (mPopup3 == null || mPopupStatus != POPUP_FIRST_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; + // beautify + if (group.findPreference(CameraSettings.KEY_BEAUTY_MODE) != null) { + item = makeSwitchItem(CameraSettings.KEY_BEAUTY_MODE, true); + enhance.addItem(item); + } + // slow shutter + if (group.findPreference(CameraSettings.KEY_SLOW_SHUTTER) != null) { + item = makeSwitchItem(CameraSettings.KEY_SLOW_SHUTTER, true); + enhance.addItem(item); + } + // auto scene detection + if (group.findPreference(CameraSettings.KEY_ASD) != null) { + item = makeSwitchItem(CameraSettings.KEY_ASD, true); + enhance.addItem(item); + } + // color effect + final ListPreference colorPref = group.findPreference(CameraSettings.KEY_COLOR_EFFECT); + if (colorPref != null) { + item = makeItem(R.drawable.ic_tint); + item.setLabel(res.getString( + R.string.pref_camera_coloreffect_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + ListPrefSettingPopup popup = + (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(colorPref); + popup.setSettingChangedListener(PhotoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); } - mUI.showPopup(mPopup3); - popupNum = 3; - } - }); - mRenderer.addItem(item3); + }); + enhance.addItem(item); + } - // Camera switcher. + // more settings + PieItem more = makeItem(R.drawable.ic_settings_holo_light); + more.setLabel(res.getString(R.string.camera_menu_settings_label)); + mRenderer.addItem(more); + // flash + if (group.findPreference(CameraSettings.KEY_FLASH_MODE) != null) { + item = makeItem(CameraSettings.KEY_FLASH_MODE); + item.setLabel(res.getString(R.string.pref_camera_flashmode_label)); + mRenderer.addItem(item); + } + // camera switcher if (group.findPreference(CameraSettings.KEY_CAMERA_ID) != null) { item = makeSwitchItem(CameraSettings.KEY_CAMERA_ID, false); final PieItem fitem = item; @@ -193,104 +158,133 @@ public class PhotoMenu extends PieController }); mRenderer.addItem(item); } + // location + if (group.findPreference(CameraSettings.KEY_RECORD_LOCATION) != null) { + item = makeSwitchItem(CameraSettings.KEY_RECORD_LOCATION, true); + more.addItem(item); + if (mActivity.isSecureCamera()) { + // Prevent location preference from getting changed in secure camera mode + item.setEnabled(false); + } + } + // countdown timer + final ListPreference ctpref = group.findPreference(CameraSettings.KEY_TIMER); + final ListPreference beeppref = + group.findPreference(CameraSettings.KEY_TIMER_SOUND_EFFECTS); + item = makeItem(R.drawable.ic_timer); + item.setLabel(res.getString(R.string.pref_camera_timer_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + CountdownTimerPopup timerPopup = + (CountdownTimerPopup) mActivity.getLayoutInflater().inflate( + R.layout.countdown_setting_popup, null, false); + timerPopup.initialize(ctpref, beeppref); + timerPopup.setSettingChangedListener(PhotoMenu.this); + mUI.dismissPopup(); + mPopup = timerPopup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); + more.addItem(item); + // image size + final ListPreference sizePref = group.findPreference(CameraSettings.KEY_PICTURE_SIZE); + if (sizePref != null) { + item = makeItem(R.drawable.ic_imagesize); + item.setLabel(res.getString( + R.string.pref_camera_picturesize_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + ListPrefSettingPopup popup = + (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(sizePref); + popup.setSettingChangedListener(PhotoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); + more.addItem(item); + } + // white balance + if (group.findPreference(CameraSettings.KEY_WHITE_BALANCE) != null) { + item = makeItem(CameraSettings.KEY_WHITE_BALANCE); + item.setLabel(res.getString(R.string.pref_camera_whitebalance_label)); + more.addItem(item); + } + // scene mode + final ListPreference scenePref = group.findPreference(CameraSettings.KEY_SCENE_MODE); + if (scenePref != null) { + item = makeItem(R.drawable.ic_sce); + item.setLabel(res.getString(R.string.pref_camera_scenemode_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + LayoutInflater inflater = mActivity.getLayoutInflater(); + ListPrefSettingPopup popup = (ListPrefSettingPopup) inflater.inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(scenePref); + popup.setSettingChangedListener(PhotoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); + enhance.addItem(item); + } + // extra settings popup + mOtherKeys = new String[] { + CameraSettings.KEY_FOCUS_MODE, + CameraSettings.KEY_FOCUS_TIME, + CameraSettings.KEY_ISO, + CameraSettings.KEY_JPEG_QUALITY, + CameraSettings.KEY_AUTOEXPOSURE, + CameraSettings.KEY_ANTIBANDING, + CameraSettings.KEY_BURST_MODE + }; + item = makeItem(R.drawable.ic_settings_holo_light); + item.setLabel(res.getString(R.string.camera_menu_more_label).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + if (mPopup == null || mPopupStatus != POPUP_FIRST_LEVEL) { + LayoutInflater inflater = mActivity.getLayoutInflater(); + MoreSettingPopup popup = (MoreSettingPopup) inflater.inflate( + R.layout.more_setting_popup, null, false); + popup.initialize(mPreferenceGroup, mOtherKeys); + popup.setSettingChangedListener(PhotoMenu.this); + mPopup = popup; + mPopupStatus = POPUP_FIRST_LEVEL; + } + mUI.showPopup(mPopup); + } + }); + more.addItem(item); } @Override - // Hit when an item in a popup gets selected + // Hit when an item in the second-level popup gets selected public void onListPrefChanged(ListPreference pref) { - if (mPopup != null && mPopup1 != null && mPopup2 != null && mPopup3 != null) { - mUI.dismissPopup(); + if (mPopup != null) { + if (mPopupStatus == POPUP_SECOND_LEVEL) { + mUI.dismissPopup(); + } } onSettingChanged(pref); } - @Override - public void overrideSettings(final String ... keyvalues) { - super.overrideSettings(keyvalues); - if ((mPopup1 == null) && (mPopup2 == null) && (mPopup3 == null)) initializePopup(); - mPopup1.overrideSettings(keyvalues); - mPopup2.overrideSettings(keyvalues); - mPopup3.overrideSettings(keyvalues); - } - - protected void initializePopup() { - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - MoreSettingPopup popup1 = (MoreSettingPopup) inflater.inflate( - R.layout.more_setting_popup, null, false); - popup1.setSettingChangedListener(this); - popup1.initialize(mPreferenceGroup, mOtherKeys1); - if (mActivity.isSecureCamera()) { - // Prevent location preference from getting changed in secure camera mode - popup1.setPreferenceEnabled(CameraSettings.KEY_RECORD_LOCATION,false); - } - mPopup1 = popup1; - - MoreSettingPopup popup2 = (MoreSettingPopup) inflater.inflate( - R.layout.more_setting_popup, null, false); - popup2.setSettingChangedListener(this); - popup2.initialize(mPreferenceGroup, mOtherKeys2); - mPopup2 = popup2; - - MoreSettingPopup popup3 = (MoreSettingPopup) inflater.inflate( - R.layout.more_setting_popup, null, false); - popup3.setSettingChangedListener(this); - popup3.initialize(mPreferenceGroup, mOtherKeys3); - mPopup3 = popup3; - - ListPreference pref = mPreferenceGroup.findPreference( - CameraSettings.KEY_SCENE_MODE); - String sceneMode = (pref != null) ? pref.getValue() : null; - pref = mPreferenceGroup.findPreference(CameraSettings.KEY_FACE_DETECTION); - String faceDetection = (pref != null) ? pref.getValue() : null; - if ((sceneMode != null) && !Parameters.SCENE_MODE_AUTO.equals(sceneMode)){ - popup1.setPreferenceEnabled(CameraSettings.KEY_FOCUS_MODE,false); - popup2.setPreferenceEnabled(CameraSettings.KEY_AUTOEXPOSURE,false); - popup2.setPreferenceEnabled(CameraSettings.KEY_TOUCH_AF_AEC,false); - popup3.setPreferenceEnabled(CameraSettings.KEY_FLASH_MODE,false); - popup3.setPreferenceEnabled(CameraSettings.KEY_WHITE_BALANCE,false); - popup3.setPreferenceEnabled(CameraSettings.KEY_EXPOSURE,false); - } - if ((faceDetection != null) && !Parameters.FACE_DETECTION_ON.equals(faceDetection)){ - popup2.setPreferenceEnabled(CameraSettings.KEY_FACE_RECOGNITION,false); - } - } - public void popupDismissed() { - if (mPopupStatus == POPUP_SECOND_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; - if (popupNum == 1) - mUI.showPopup(mPopup1); - else if (popupNum == 2) - mUI.showPopup(mPopup2); - else if (popupNum == 3) - mUI.showPopup(mPopup3); - if(mPopup1 != null) mPopup1 = null; - if(mPopup2 != null) mPopup2 = null; - if(mPopup3 != null) mPopup3 = null; - } else { - initializePopup(); + // if the 2nd level popup gets dismissed + if (mPopup != null) { + if (mPopupStatus == POPUP_SECOND_LEVEL) { + mPopup = null; + } } - - } - - @Override - // Hit when an item in the first-level popup gets selected, then bring up - // the second-level popup - public void onPreferenceClicked(ListPreference pref) { - if (mPopupStatus != POPUP_FIRST_LEVEL) return; - - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - ListPrefSettingPopup basic = (ListPrefSettingPopup) inflater.inflate( - R.layout.list_pref_setting_popup, null, false); - basic.initialize(pref); - basic.setSettingChangedListener(this); - mUI.dismissPopup(); - mPopup = basic; - mUI.showPopup(mPopup); - mPopupStatus = POPUP_SECOND_LEVEL; } // Return true if the preference has the specified key but not the value. @@ -309,17 +303,46 @@ public class PhotoMenu extends PieController @Override public void onSettingChanged(ListPreference pref) { // Reset the scene mode if HDR is set to on. Reset HDR if scene mode is - // set to non-auto. + // set to non-auto. Also disable beautify when HDR is active. if (notSame(pref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)) { setPreference(CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO); - setPreference(CameraSettings.KEY_ZSL,mSettingOff); - } else if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)) { + setPreference(CameraSettings.KEY_BEAUTY_MODE, mSettingOff); + setPreference(CameraSettings.KEY_SLOW_SHUTTER, "slow-shutter-off"); + setPreference(CameraSettings.KEY_ASD, mSettingOff); + } else if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO) || + notSame(pref, CameraSettings.KEY_ASD, mSettingOff)) { setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff); - } - if (notSame(pref,CameraSettings.KEY_ZSL,mSettingOff)){ + setPreference(CameraSettings.KEY_SLOW_SHUTTER, "slow-shutter-off"); + if (!notSame(pref, CameraSettings.KEY_ASD, mSettingOff)) { + setPreference(CameraSettings.KEY_ASD, mSettingOff); + } + } else if (notSame(pref, CameraSettings.KEY_BEAUTY_MODE, mSettingOff)) { + setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff); + setPreference(CameraSettings.KEY_SLOW_SHUTTER, "slow-shutter-off"); + } else if (notSame(pref, CameraSettings.KEY_SLOW_SHUTTER, "slow-shutter-off")) { setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff); + setPreference(CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO); + setPreference(CameraSettings.KEY_ASD, mSettingOff); + setPreference(CameraSettings.KEY_BEAUTY_MODE, mSettingOff); } super.onSettingChanged(pref); } + @Override + // Hit when an item in the first-level popup gets selected, then bring up + // the second-level popup + public void onPreferenceClicked(ListPreference pref) { + if (mPopupStatus != POPUP_FIRST_LEVEL) return; + + LayoutInflater inflater = mActivity.getLayoutInflater(); + ListPrefSettingPopup basic = (ListPrefSettingPopup) inflater.inflate( + R.layout.list_pref_setting_popup, null, false); + basic.initialize(pref); + basic.setSettingChangedListener(this); + mUI.dismissPopup(); + mPopup = basic; + mUI.showPopup(mPopup); + mPopupStatus = POPUP_SECOND_LEVEL; + } + } diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 179e8c950..7b6b27fd8 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -129,6 +129,7 @@ public class PhotoModule private static final int SET_PHOTO_UI_PARAMS = 12; private static final int SWITCH_TO_GCAM_MODULE = 13; private static final int CONFIGURE_SKIN_TONE_FACTOR = 14; + private static final int UPDATE_ASD_ICON = 16; // The subset of parameters we need to update in setCameraParameters(). private static final int UPDATE_PARAM_INITIALIZE = 1; @@ -292,6 +293,9 @@ public class PhotoModule private PreferenceGroup mPreferenceGroup; private boolean mQuickCapture; + + private boolean mSceneDetection = false; + private SensorManager mSensorManager; private float[] mGData = new float[3]; private float[] mMData = new float[3]; @@ -436,6 +440,20 @@ public class PhotoModule } break; } + case UPDATE_ASD_ICON: { + if (!mSceneDetection) { + mUI.updateSceneDetectionIcon(null); + break; + } + if (mCameraState == IDLE) { + mCameraDevice.refreshParameters(); + String scene = mCameraDevice.getParameters().get("asd-mode"); + Log.d(TAG, "detected scene=" + scene + " camstate=" +mCameraState); + mUI.updateSceneDetectionIcon(scene); + } + mHandler.sendEmptyMessageDelayed(UPDATE_ASD_ICON, 2000); + break; + } } } } @@ -1326,9 +1344,11 @@ public class PhotoModule } private void updateSceneMode() { - // If scene mode is set, we cannot set flash mode, white balance, and + updateSceneDetection(); + // If scene mode or slow shutter is set, we cannot set flash mode, white balance, and // focus mode, instead, we read it from driver - if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) { + if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode) || + CameraSettings.isSlowShutterEnabled(mParameters)) { overrideCameraSettings(mParameters.getFlashMode(), mParameters.getWhiteBalance(), mParameters.getFocusMode(), Integer.toString(mParameters.getExposureCompensation()), @@ -2444,6 +2464,14 @@ public class PhotoModule } Log.v(TAG, "Preview size is " + optimalSize.width + "x" + optimalSize.height); + // Beauty mode + CameraSettings.setBeautyMode(mParameters, mPreferences.getString(CameraSettings.KEY_BEAUTY_MODE, + mActivity.getString(R.string.pref_camera_beauty_mode_default)).equals("on")); + + // Slow shutter + CameraSettings.setSlowShutter(mParameters, mPreferences.getString(CameraSettings.KEY_SLOW_SHUTTER, + mActivity.getString(R.string.pref_camera_slow_shutter_default))); + // Since changing scene mode may change supported values, set scene mode // first. HDR is a scene mode. To promote it in UI, it is stored in a // separate preference. @@ -2452,8 +2480,12 @@ public class PhotoModule mActivity.getString(R.string.pref_camera_hdr_default)); String hdrPlus = mPreferences.getString(CameraSettings.KEY_CAMERA_HDR_PLUS, mActivity.getString(R.string.pref_camera_hdr_plus_default)); + String asd = mPreferences.getString(CameraSettings.KEY_ASD, + mActivity.getString(R.string.pref_camera_asd_default)); + boolean hdrOn = onValue.equals(hdr); boolean hdrPlusOn = onValue.equals(hdrPlus); + boolean asdOn = onValue.equals(asd); boolean doGcamModeSwitch = false; if (hdrPlusOn && GcamHelper.hasGcamCapture()) { @@ -2462,6 +2494,8 @@ public class PhotoModule } else { if (hdrOn) { mSceneMode = CameraUtil.SCENE_MODE_HDR; + } else if (asdOn) { + mSceneMode = CameraUtil.SCENE_MODE_ASD; } else { mSceneMode = mPreferences.getString( CameraSettings.KEY_SCENE_MODE, @@ -2469,7 +2503,8 @@ public class PhotoModule } } if (CameraUtil.isSupported(mSceneMode, mParameters.getSupportedSceneModes())) { - if (!mParameters.getSceneMode().equals(mSceneMode)) { + if (!mParameters.getSceneMode().equals(mSceneMode) || + CameraSettings.isSlowShutterEnabled(mParameters)) { mParameters.setSceneMode(mSceneMode); // Setting scene mode will change the settings of flash mode, @@ -2490,9 +2525,6 @@ public class PhotoModule CameraProfile.QUALITY_HIGH); mParameters.setJpegQuality(jpegQuality); - // For the following settings, we need to check if the settings are - // still supported by latest driver, if not, ignore the settings. - // Set exposure compensation int value = CameraSettings.readExposure(mPreferences); int max = mParameters.getMaxExposureCompensation(); @@ -2503,7 +2535,8 @@ public class PhotoModule Log.w(TAG, "invalid exposure range: " + value); } - if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) { + if (Parameters.SCENE_MODE_AUTO.equals(mSceneMode) && + !CameraSettings.isSlowShutterEnabled(mParameters)) { // Set flash mode. String flashMode = mPreferences.getString( CameraSettings.KEY_FLASH_MODE, @@ -2536,6 +2569,12 @@ public class PhotoModule // Set focus mode. mFocusManager.overrideFocusMode(null); mParameters.setFocusMode(mFocusManager.getFocusMode()); + + // Set focus time. + mFocusManager.setFocusTime(Integer.valueOf( + mPreferences.getString(CameraSettings.KEY_FOCUS_TIME, + mActivity.getString(R.string.pref_camera_focustime_default)))); + } else { mFocusManager.overrideFocusMode(mParameters.getFocusMode()); } @@ -2639,6 +2678,15 @@ public class PhotoModule } } + private void updateSceneDetection() { + mSceneDetection = "on".equals(mPreferences.getString(CameraSettings.KEY_ASD, "off")); + + Log.d(TAG, "updateSceneDetection : " + mSceneDetection); + if (mSceneDetection) { + mHandler.sendEmptyMessage(UPDATE_ASD_ICON); + } + } + @Override public void onSharedPreferenceChanged() { // ignore the events after "onPause()" diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index e178a3092..77c158fd0 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -20,7 +20,9 @@ package com.android.camera; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.res.Configuration; +import android.content.res.TypedArray; import android.graphics.Bitmap; +import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.RectF; @@ -55,6 +57,7 @@ import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.PieRenderer; import com.android.camera.ui.PieRenderer.PieListener; import com.android.camera.ui.RenderOverlay; +import com.android.camera.ui.RotateImageView; import com.android.camera.ui.ZoomRenderer; import com.android.camera.util.CameraUtil; import com.android.camera2.R; @@ -96,6 +99,8 @@ public class PhotoUI implements PieListener, private AlertDialog mLocationDialog; // Small indicators which show the camera settings in the viewfinder. + private ImageView mSceneDetectView; + private OnScreenIndicators mOnScreenIndicators; private PieRenderer mPieRenderer; @@ -227,6 +232,8 @@ public class PhotoUI implements PieListener, mFaceView = (FaceView) mRootView.findViewById(R.id.face_view); setSurfaceTextureSizeChangedListener(mFaceView); } + mSceneDetectView = (ImageView) mRootView.findViewById(R.id.scene_detect_icon); + mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls); mAnimationManager = new AnimationManager(); @@ -940,4 +947,23 @@ public class PhotoUI implements PieListener, mController.updateCameraOrientation(); } + public void updateSceneDetectionIcon(String scene) { + if (scene == null) { + mSceneDetectView.setVisibility(View.GONE); + return; + } + String[] values = mActivity.getResources().getStringArray(R.array.camera_asd_values); + int i = 0; + for (i = 0; i < values.length; i++) { + if (values[i].equals(scene)) { + break; + } + } + if (i < values.length) { + TypedArray imgs = mActivity.getResources().obtainTypedArray(R.array.camera_asd_icons); + mSceneDetectView.setImageResource(imgs.getResourceId(i, -1)); + } + mSceneDetectView.setVisibility(View.VISIBLE); + } } + diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java index 01b9ddbc4..f0fec3617 100644 --- a/src/com/android/camera/VideoMenu.java +++ b/src/com/android/camera/VideoMenu.java @@ -1,5 +1,6 @@ /* * Copyright (C) 2012 The Android Open Source Project + * Copyright (C) 2013 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +18,7 @@ package com.android.camera; import android.content.Context; +import android.content.res.Resources; import android.view.LayoutInflater; import com.android.camera.ui.AbstractSettingPopup; @@ -26,8 +28,11 @@ import com.android.camera.ui.PieItem; import com.android.camera.ui.PieItem.OnClickListener; import com.android.camera.ui.PieRenderer; import com.android.camera.ui.TimeIntervalPopup; + import com.android.camera2.R; +import java.util.Locale; + public class VideoMenu extends PieController implements MoreSettingPopup.Listener, ListPrefSettingPopup.Listener, @@ -36,17 +41,13 @@ public class VideoMenu extends PieController private static String TAG = "CAM_VideoMenu"; private VideoUI mUI; - private String[] mOtherKeys1; - private String[] mOtherKeys2; - - private AbstractSettingPopup mPopup1; - private AbstractSettingPopup mPopup2; + private String[] mOtherKeys; + private AbstractSettingPopup mPopup; private static final int POPUP_NONE = 0; private static final int POPUP_FIRST_LEVEL = 1; private static final int POPUP_SECOND_LEVEL = 2; private int mPopupStatus; - private int popupNum; private CameraActivity mActivity; public VideoMenu(CameraActivity activity, VideoUI ui, PieRenderer pie) { @@ -57,164 +58,180 @@ public class VideoMenu extends PieController public void initialize(PreferenceGroup group) { super.initialize(group); - mPopup1 = null; - mPopup2 = null; - popupNum = 0; + mPopup = null; mPopupStatus = POPUP_NONE; PieItem item = null; - // settings popup - mOtherKeys1 = new String[] { - CameraSettings.KEY_DIS, - CameraSettings.KEY_VIDEO_EFFECT, - CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL, - CameraSettings.KEY_VIDEO_QUALITY, - CameraSettings.KEY_VIDEO_ENCODER, - CameraSettings.KEY_AUDIO_ENCODER, - CameraSettings.KEY_VIDEO_DURATION, - CameraSettings.KEY_RECORD_LOCATION - }; + final Resources res = mActivity.getResources(); + Locale locale = res.getConfiguration().locale; + // the order is from left to right in the menu - //settings popup - mOtherKeys2 = new String[] { - CameraSettings.KEY_COLOR_EFFECT, - CameraSettings.KEY_VIDEO_HDR, - CameraSettings.KEY_POWER_MODE, - CameraSettings.KEY_WHITE_BALANCE, - CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE, - CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE, - }; - - PieItem item1 = makeItem(R.drawable.ic_settings_holo_light); - item1.setLabel(mActivity.getResources().getString(R.string.camera_menu_more_label)); - item1.setOnClickListener(new OnClickListener() { - @Override - public void onClick(PieItem item) { - if (mPopup1 == null || mPopupStatus != POPUP_FIRST_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; + // exposure compensation + if (group.findPreference(CameraSettings.KEY_EXPOSURE) != null) { + item = makeItem(CameraSettings.KEY_EXPOSURE); + mRenderer.addItem(item); + } + // enhance + PieItem enhance = makeItem(R.drawable.ic_enhance); + enhance.setLabel(res.getString(R.string.camera_menu_enhance_label)); + mRenderer.addItem(enhance); + // hdr + if (group.findPreference(CameraSettings.KEY_VIDEO_HDR) != null) { + item = makeSwitchItem(CameraSettings.KEY_VIDEO_HDR, true); + enhance.addItem(item); + } + // beautify + if (group.findPreference(CameraSettings.KEY_BEAUTY_MODE) != null) { + item = makeSwitchItem(CameraSettings.KEY_BEAUTY_MODE, true); + enhance.addItem(item); + } + // color effect + final ListPreference colorPref = + group.findPreference(CameraSettings.KEY_COLOR_EFFECT); + if (colorPref != null) { + item = makeItem(R.drawable.ic_tint); + item.setLabel(res.getString( + R.string.pref_camera_coloreffect_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + ListPrefSettingPopup popup = + (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(colorPref); + popup.setSettingChangedListener(VideoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); } - mUI.showPopup(mPopup1); - popupNum = 1; - } - }); - mRenderer.addItem(item1); + }); + enhance.addItem(item); + } - PieItem item2 = makeItem(R.drawable.ic_settings_holo_light); - item2.setLabel(mActivity.getResources().getString(R.string.camera_menu_more_label)); - item2.setOnClickListener(new OnClickListener() { - @Override - public void onClick(PieItem item) { - if (mPopup2 == null || mPopupStatus != POPUP_FIRST_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; - } - mUI.showPopup(mPopup2); - popupNum = 2; - } - }); - mRenderer.addItem(item2); + // more settings + PieItem more = makeItem(R.drawable.ic_settings_holo_light); + more.setLabel(res.getString(R.string.camera_menu_settings_label)); + mRenderer.addItem(more); + // flash + if (group.findPreference(CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE) != null) { + item = makeItem(CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE); + mRenderer.addItem(item); + } // camera switcher if (group.findPreference(CameraSettings.KEY_CAMERA_ID) != null) { - item = makeItem(R.drawable.ic_switch_back); - IconListPreference lpref = (IconListPreference) group.findPreference( - CameraSettings.KEY_CAMERA_ID); - item.setLabel(lpref.getLabel()); - item.setImageResource(mActivity, - ((IconListPreference) lpref).getIconIds() - [lpref.findIndexOfValue(lpref.getValue())]); - + item = makeSwitchItem(CameraSettings.KEY_CAMERA_ID, false); final PieItem fitem = item; item.setOnClickListener(new OnClickListener() { - @Override public void onClick(PieItem item) { // Find the index of next camera. - ListPreference pref = - mPreferenceGroup.findPreference(CameraSettings.KEY_CAMERA_ID); + ListPreference pref = mPreferenceGroup + .findPreference(CameraSettings.KEY_CAMERA_ID); if (pref != null) { int index = pref.findIndexOfValue(pref.getValue()); CharSequence[] values = pref.getEntryValues(); index = (index + 1) % values.length; - int newCameraId = Integer.parseInt((String) values[index]); - fitem.setImageResource(mActivity, - ((IconListPreference) pref).getIconIds()[index]); - fitem.setLabel(pref.getLabel()); - mListener.onCameraPickerClicked(newCameraId); + pref.setValueIndex(index); + mListener.onCameraPickerClicked(index); } + updateItem(fitem, CameraSettings.KEY_CAMERA_ID); } }); mRenderer.addItem(item); } - } - - @Override - public void reloadPreferences() { - super.reloadPreferences(); - if (mPopup1 != null) { - mPopup1.reloadPreference(); - } - if (mPopup2 != null) { - mPopup2.reloadPreference(); + // time lapse + final ListPreference tlPref = + group.findPreference(CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL); + item = makeItem(R.drawable.ic_timer); + item.setLabel(res.getString( + R.string.pref_video_time_lapse_frame_interval_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + TimeIntervalPopup timeInterval = + (TimeIntervalPopup) mActivity.getLayoutInflater().inflate( + R.layout.time_interval_popup, null, false); + timeInterval.initialize((IconListPreference) tlPref); + timeInterval.setSettingChangedListener(VideoMenu.this); + mUI.dismissPopup(); + mPopup = timeInterval; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); + more.addItem(item); + // video size + final ListPreference sizePref = group.findPreference(CameraSettings.KEY_VIDEO_QUALITY); + if (sizePref != null) { + item = makeItem(R.drawable.ic_imagesize); + item.setLabel(res.getString( + R.string.pref_video_quality_title).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + ListPrefSettingPopup popup = + (ListPrefSettingPopup) mActivity.getLayoutInflater().inflate( + R.layout.list_pref_setting_popup, null, false); + popup.initialize(sizePref); + popup.setSettingChangedListener(VideoMenu.this); + mUI.dismissPopup(); + mPopup = popup; + mPopupStatus = POPUP_SECOND_LEVEL; + mUI.showPopup(mPopup); + } + }); + more.addItem(item); } - } - - @Override - public void overrideSettings(final String ... keyvalues) { - super.overrideSettings(keyvalues); - if (((mPopup1 == null) && (mPopup2 == null)) || mPopupStatus != POPUP_FIRST_LEVEL) { - mPopupStatus = POPUP_FIRST_LEVEL; - initializePopup(); + // white balance + if (group.findPreference(CameraSettings.KEY_WHITE_BALANCE) != null) { + item = makeItem(CameraSettings.KEY_WHITE_BALANCE); + item.setLabel(res.getString(R.string.pref_camera_whitebalance_label)); + more.addItem(item); } - ((MoreSettingPopup) mPopup1).overrideSettings(keyvalues); - ((MoreSettingPopup) mPopup2).overrideSettings(keyvalues); + // extra settings popup + mOtherKeys = new String[] { + CameraSettings.KEY_JPEG_QUALITY, + CameraSettings.KEY_VIDEO_ENCODER, + CameraSettings.KEY_AUDIO_ENCODER + }; + item = makeItem(R.drawable.ic_settings_holo_light); + item.setLabel(res.getString(R.string.camera_menu_more_label).toUpperCase(locale)); + item.setOnClickListener(new OnClickListener() { + @Override + public void onClick(PieItem item) { + if (mPopup == null || mPopupStatus != POPUP_FIRST_LEVEL) { + LayoutInflater inflater = mActivity.getLayoutInflater(); + MoreSettingPopup popup = (MoreSettingPopup) inflater.inflate( + R.layout.more_setting_popup, null, false); + popup.initialize(mPreferenceGroup, mOtherKeys); + popup.setSettingChangedListener(VideoMenu.this); + mPopup = popup; + mPopupStatus = POPUP_FIRST_LEVEL; + } + mUI.showPopup(mPopup); + } + }); + more.addItem(item); } @Override // Hit when an item in the second-level popup gets selected public void onListPrefChanged(ListPreference pref) { - if (mPopup1 != null && mPopup2 != null) { + if (mPopup != null) { if (mPopupStatus == POPUP_SECOND_LEVEL) { - mUI.dismissPopup(true); - mPopup1.reloadPreference(); - mPopup2.reloadPreference(); + mUI.dismissPopup(); } } - super.onSettingChanged(pref); + onSettingChanged(pref); } - protected void initializePopup() { - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - - MoreSettingPopup popup1 = (MoreSettingPopup) inflater.inflate( - R.layout.more_setting_popup, null, false); - popup1.setSettingChangedListener(this); - popup1.initialize(mPreferenceGroup, mOtherKeys1); - if (mActivity.isSecureCamera()) { - // Prevent location preference from getting changed in secure camera mode - popup1.setPreferenceEnabled(CameraSettings.KEY_RECORD_LOCATION, false); - } - mPopup1 = popup1; - - MoreSettingPopup popup2 = (MoreSettingPopup) inflater.inflate( - R.layout.more_setting_popup, null, false); - popup2.setSettingChangedListener(this); - popup2.initialize(mPreferenceGroup, mOtherKeys2); - mPopup2 = popup2; - } - - public void popupDismissed(boolean topPopupOnly) { + public void popupDismissed() { // if the 2nd level popup gets dismissed - if (mPopupStatus == POPUP_SECOND_LEVEL) { - initializePopup(); - mPopupStatus = POPUP_FIRST_LEVEL; - if (topPopupOnly) { - if(popupNum == 1) mUI.showPopup(mPopup1); - else if(popupNum == 2) mUI.showPopup(mPopup2); + if (mPopup != null) { + if (mPopupStatus == POPUP_SECOND_LEVEL) { + mPopup = null; } - } else { - initializePopup(); } } @@ -224,25 +241,14 @@ public class VideoMenu extends PieController public void onPreferenceClicked(ListPreference pref) { if (mPopupStatus != POPUP_FIRST_LEVEL) return; - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - - if (CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL.equals(pref.getKey())) { - TimeIntervalPopup timeInterval = (TimeIntervalPopup) inflater.inflate( - R.layout.time_interval_popup, null, false); - timeInterval.initialize((IconListPreference) pref); - timeInterval.setSettingChangedListener(this); - mUI.dismissPopup(true); - mPopup1 = timeInterval; - } else { - ListPrefSettingPopup basic = (ListPrefSettingPopup) inflater.inflate( - R.layout.list_pref_setting_popup, null, false); - basic.initialize(pref); - basic.setSettingChangedListener(this); - mUI.dismissPopup(true); - mPopup1 = basic; - } - mUI.showPopup(mPopup1); + LayoutInflater inflater = mActivity.getLayoutInflater(); + ListPrefSettingPopup basic = (ListPrefSettingPopup) inflater.inflate( + R.layout.list_pref_setting_popup, null, false); + basic.initialize(pref); + basic.setSettingChangedListener(this); + mUI.dismissPopup(); + mPopup = basic; + mUI.showPopup(mPopup); mPopupStatus = POPUP_SECOND_LEVEL; } diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java index 475a24062..84a830fff 100644 --- a/src/com/android/camera/VideoModule.java +++ b/src/com/android/camera/VideoModule.java @@ -1905,10 +1905,16 @@ public class VideoModule implements CameraModule, CameraProfile.QUALITY_HIGH); mParameters.setJpegQuality(jpegQuality); - CameraUtil.dumpParameters(mParameters); + + // Beauty mode + CameraSettings.setBeautyMode(mParameters, mPreferences.getString(CameraSettings.KEY_BEAUTY_MODE, + mActivity.getString(R.string.pref_camera_beauty_mode_default)).equals("on")); //Call Qcom related Camera Parameters qcomSetCameraParameters(); + + CameraUtil.dumpParameters(mParameters); + mCameraDevice.setParameters(mParameters); // Keep preview size up to date. diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index bb270b7f8..52302a49c 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -157,22 +157,16 @@ public class VideoUI implements PieRenderer.PieListener, showAtLocation(mRootView, Gravity.CENTER, 0, 0); } - public void dismiss(boolean topLevelOnly) { + public void dismiss() { super.dismiss(); popupDismissed(); showUI(); - mVideoMenu.popupDismissed(topLevelOnly); + mVideoMenu.popupDismissed(); // Switch back into fullscreen/lights-out mode after popup // is dimissed. mActivity.setSystemBarsVisibility(false); } - - @Override - public void dismiss() { - // Called by Framework when touch outside the popup or hit back key - dismiss(true); - } } public VideoUI(CameraActivity activity, VideoController controller, View parent) { @@ -401,7 +395,7 @@ public class VideoUI implements PieRenderer.PieListener, public boolean collapseCameraControls() { boolean ret = false; if (mPopup != null) { - dismissPopup(false); + dismissPopup(); ret = true; } return ret; @@ -409,7 +403,7 @@ public class VideoUI implements PieRenderer.PieListener, public boolean removeTopLevelPopup() { if (mPopup != null) { - dismissPopup(true); + dismissPopup(); return true; } return false; @@ -549,11 +543,11 @@ public class VideoUI implements PieRenderer.PieListener, } } - public void dismissPopup(boolean topLevelOnly) { + public void dismissPopup() { // In review mode, we do not want to bring up the camera UI if (mController.isInReviewMode()) return; if (mPopup != null) { - mPopup.dismiss(topLevelOnly); + mPopup.dismiss(); } } @@ -565,7 +559,7 @@ public class VideoUI implements PieRenderer.PieListener, hideUI(); if (mPopup != null) { - mPopup.dismiss(false); + mPopup.dismiss(); } mPopup = new SettingsPopup(popup); } diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java index 40a3a2c9d..dee9cd82e 100644 --- a/src/com/android/camera/util/CameraUtil.java +++ b/src/com/android/camera/util/CameraUtil.java @@ -113,6 +113,7 @@ public class CameraUtil { private static final String AUTO_WHITE_BALANCE_LOCK_SUPPORTED = "auto-whitebalance-lock-supported"; private static final String VIDEO_SNAPSHOT_SUPPORTED = "video-snapshot-supported"; public static final String SCENE_MODE_HDR = "hdr"; + public static final String SCENE_MODE_ASD = "asd"; public static final String TRUE = "true"; public static final String FALSE = "false"; @@ -144,6 +145,11 @@ public class CameraUtil { return (supported != null) && supported.contains(SCENE_MODE_HDR); } + public static boolean isAutoSceneDetectionSupported(Parameters params) { + List<String> supported = params.getSupportedSceneModes(); + return (supported != null) && supported.contains(SCENE_MODE_ASD) && (params.get("asd-mode") != null); + } + public static boolean isMeteringAreaSupported(Parameters params) { return params.getMaxNumMeteringAreas() > 0; } |