From 8bdc51d3ecd4e3afd025671b33d12abc31c22431 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Sun, 15 Dec 2013 02:07:46 -0500 Subject: 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 --- res/drawable-hdpi/ic_asd.png | Bin 0 -> 4159 bytes res/drawable-hdpi/ic_asd_off.png | Bin 0 -> 3863 bytes res/drawable-hdpi/ic_beautify.png | Bin 0 -> 7336 bytes res/drawable-hdpi/ic_beautify_off.png | Bin 0 -> 6007 bytes res/drawable-hdpi/ic_enhance.png | Bin 0 -> 4583 bytes res/drawable-hdpi/ic_indicator_sce_asd.png | Bin 0 -> 3076 bytes res/drawable-hdpi/ic_slowshutter.png | Bin 0 -> 3888 bytes res/drawable-hdpi/ic_slowshutter_off.png | Bin 0 -> 3649 bytes res/drawable-hdpi/ic_tint.png | Bin 0 -> 4170 bytes res/drawable-hdpi/smart_scene_indoor.png | Bin 0 -> 2729 bytes res/drawable-hdpi/smart_scene_landscape.png | Bin 0 -> 3292 bytes res/drawable-hdpi/smart_scene_macro.png | Bin 0 -> 3302 bytes res/drawable-hdpi/smart_scene_mix_illuminant.png | Bin 0 -> 3294 bytes res/drawable-hdpi/smart_scene_night.png | Bin 0 -> 3335 bytes res/drawable-hdpi/smart_scene_portrait.png | Bin 0 -> 2852 bytes res/drawable-hdpi/smart_scene_sports.png | Bin 0 -> 3277 bytes res/drawable-mdpi/ic_asd.png | Bin 0 -> 3008 bytes res/drawable-mdpi/ic_asd_off.png | Bin 0 -> 2912 bytes res/drawable-mdpi/ic_beautify.png | Bin 0 -> 4397 bytes res/drawable-mdpi/ic_beautify_off.png | Bin 0 -> 3774 bytes res/drawable-mdpi/ic_enhance.png | Bin 0 -> 2929 bytes res/drawable-mdpi/ic_indicator_sce_asd.png | Bin 0 -> 2261 bytes res/drawable-mdpi/ic_slowshutter.png | Bin 0 -> 2839 bytes res/drawable-mdpi/ic_slowshutter_off.png | Bin 0 -> 2683 bytes res/drawable-mdpi/ic_tint.png | Bin 0 -> 2724 bytes res/drawable-mdpi/smart_scene_indoor.png | Bin 0 -> 1762 bytes res/drawable-mdpi/smart_scene_landscape.png | Bin 0 -> 1970 bytes res/drawable-mdpi/smart_scene_macro.png | Bin 0 -> 1936 bytes res/drawable-mdpi/smart_scene_mix_illuminant.png | Bin 0 -> 1963 bytes res/drawable-mdpi/smart_scene_night.png | Bin 0 -> 2006 bytes res/drawable-mdpi/smart_scene_portrait.png | Bin 0 -> 1709 bytes res/drawable-mdpi/smart_scene_sports.png | Bin 0 -> 1913 bytes res/drawable-xhdpi/ic_asd.png | Bin 0 -> 5669 bytes res/drawable-xhdpi/ic_asd_off.png | Bin 0 -> 5297 bytes res/drawable-xhdpi/ic_beautify.png | Bin 0 -> 10145 bytes res/drawable-xhdpi/ic_beautify_off.png | Bin 0 -> 8180 bytes res/drawable-xhdpi/ic_enhance.png | Bin 0 -> 6017 bytes res/drawable-xhdpi/ic_indicator_beautify.png | Bin 0 -> 4112 bytes res/drawable-xhdpi/ic_indicator_sce_asd.png | Bin 0 -> 4060 bytes res/drawable-xhdpi/ic_indicator_slowshutter.png | Bin 0 -> 3456 bytes res/drawable-xhdpi/ic_slowshutter.png | Bin 0 -> 5087 bytes res/drawable-xhdpi/ic_slowshutter_off.png | Bin 0 -> 4798 bytes res/drawable-xhdpi/ic_tint.png | Bin 0 -> 5715 bytes res/drawable-xhdpi/smart_scene_indoor.png | Bin 0 -> 2007 bytes res/drawable-xhdpi/smart_scene_landscape.png | Bin 0 -> 2560 bytes res/drawable-xhdpi/smart_scene_macro.png | Bin 0 -> 2574 bytes res/drawable-xhdpi/smart_scene_mix_illuminant.png | Bin 0 -> 2571 bytes res/drawable-xhdpi/smart_scene_night.png | Bin 0 -> 2614 bytes res/drawable-xhdpi/smart_scene_portrait.png | Bin 0 -> 2169 bytes res/drawable-xhdpi/smart_scene_sports.png | Bin 0 -> 2538 bytes res/layout/photo_module.xml | 14 +- res/values/cm_arrays.xml | 146 ++++++++ res/values/cm_strings.xml | 50 +++ res/xml/camera_preferences.xml | 38 +- res/xml/video_preferences.xml | 20 +- src/com/android/camera/CameraSettings.java | 60 ++- src/com/android/camera/FocusOverlayManager.java | 17 +- src/com/android/camera/OnScreenIndicators.java | 12 +- src/com/android/camera/PhotoMenu.java | 421 ++++++++++++---------- src/com/android/camera/PhotoModule.java | 62 +++- src/com/android/camera/PhotoUI.java | 26 ++ src/com/android/camera/VideoMenu.java | 300 +++++++-------- src/com/android/camera/VideoModule.java | 8 +- src/com/android/camera/VideoUI.java | 20 +- src/com/android/camera/util/CameraUtil.java | 6 + 65 files changed, 811 insertions(+), 389 deletions(-) create mode 100755 res/drawable-hdpi/ic_asd.png create mode 100755 res/drawable-hdpi/ic_asd_off.png create mode 100755 res/drawable-hdpi/ic_beautify.png create mode 100755 res/drawable-hdpi/ic_beautify_off.png create mode 100755 res/drawable-hdpi/ic_enhance.png create mode 100755 res/drawable-hdpi/ic_indicator_sce_asd.png create mode 100755 res/drawable-hdpi/ic_slowshutter.png create mode 100755 res/drawable-hdpi/ic_slowshutter_off.png create mode 100755 res/drawable-hdpi/ic_tint.png create mode 100755 res/drawable-hdpi/smart_scene_indoor.png create mode 100755 res/drawable-hdpi/smart_scene_landscape.png create mode 100755 res/drawable-hdpi/smart_scene_macro.png create mode 100755 res/drawable-hdpi/smart_scene_mix_illuminant.png create mode 100755 res/drawable-hdpi/smart_scene_night.png create mode 100755 res/drawable-hdpi/smart_scene_portrait.png create mode 100755 res/drawable-hdpi/smart_scene_sports.png create mode 100755 res/drawable-mdpi/ic_asd.png create mode 100755 res/drawable-mdpi/ic_asd_off.png create mode 100755 res/drawable-mdpi/ic_beautify.png create mode 100755 res/drawable-mdpi/ic_beautify_off.png create mode 100755 res/drawable-mdpi/ic_enhance.png create mode 100755 res/drawable-mdpi/ic_indicator_sce_asd.png create mode 100755 res/drawable-mdpi/ic_slowshutter.png create mode 100755 res/drawable-mdpi/ic_slowshutter_off.png create mode 100755 res/drawable-mdpi/ic_tint.png create mode 100644 res/drawable-mdpi/smart_scene_indoor.png create mode 100644 res/drawable-mdpi/smart_scene_landscape.png create mode 100644 res/drawable-mdpi/smart_scene_macro.png create mode 100644 res/drawable-mdpi/smart_scene_mix_illuminant.png create mode 100644 res/drawable-mdpi/smart_scene_night.png create mode 100644 res/drawable-mdpi/smart_scene_portrait.png create mode 100644 res/drawable-mdpi/smart_scene_sports.png create mode 100755 res/drawable-xhdpi/ic_asd.png create mode 100755 res/drawable-xhdpi/ic_asd_off.png create mode 100755 res/drawable-xhdpi/ic_beautify.png create mode 100755 res/drawable-xhdpi/ic_beautify_off.png create mode 100755 res/drawable-xhdpi/ic_enhance.png create mode 100755 res/drawable-xhdpi/ic_indicator_beautify.png create mode 100755 res/drawable-xhdpi/ic_indicator_sce_asd.png create mode 100755 res/drawable-xhdpi/ic_indicator_slowshutter.png create mode 100755 res/drawable-xhdpi/ic_slowshutter.png create mode 100755 res/drawable-xhdpi/ic_slowshutter_off.png create mode 100755 res/drawable-xhdpi/ic_tint.png create mode 100644 res/drawable-xhdpi/smart_scene_indoor.png create mode 100644 res/drawable-xhdpi/smart_scene_landscape.png create mode 100644 res/drawable-xhdpi/smart_scene_macro.png create mode 100644 res/drawable-xhdpi/smart_scene_mix_illuminant.png create mode 100644 res/drawable-xhdpi/smart_scene_night.png create mode 100644 res/drawable-xhdpi/smart_scene_portrait.png create mode 100644 res/drawable-xhdpi/smart_scene_sports.png create mode 100755 res/values/cm_arrays.xml diff --git a/res/drawable-hdpi/ic_asd.png b/res/drawable-hdpi/ic_asd.png new file mode 100755 index 000000000..36811fd06 Binary files /dev/null and b/res/drawable-hdpi/ic_asd.png differ diff --git a/res/drawable-hdpi/ic_asd_off.png b/res/drawable-hdpi/ic_asd_off.png new file mode 100755 index 000000000..0754228e7 Binary files /dev/null and b/res/drawable-hdpi/ic_asd_off.png differ diff --git a/res/drawable-hdpi/ic_beautify.png b/res/drawable-hdpi/ic_beautify.png new file mode 100755 index 000000000..1593c37d4 Binary files /dev/null and b/res/drawable-hdpi/ic_beautify.png differ diff --git a/res/drawable-hdpi/ic_beautify_off.png b/res/drawable-hdpi/ic_beautify_off.png new file mode 100755 index 000000000..dff40ce51 Binary files /dev/null and b/res/drawable-hdpi/ic_beautify_off.png differ diff --git a/res/drawable-hdpi/ic_enhance.png b/res/drawable-hdpi/ic_enhance.png new file mode 100755 index 000000000..b4158ba85 Binary files /dev/null and b/res/drawable-hdpi/ic_enhance.png differ diff --git a/res/drawable-hdpi/ic_indicator_sce_asd.png b/res/drawable-hdpi/ic_indicator_sce_asd.png new file mode 100755 index 000000000..e63e1d2bf Binary files /dev/null and b/res/drawable-hdpi/ic_indicator_sce_asd.png differ diff --git a/res/drawable-hdpi/ic_slowshutter.png b/res/drawable-hdpi/ic_slowshutter.png new file mode 100755 index 000000000..3c4202df8 Binary files /dev/null and b/res/drawable-hdpi/ic_slowshutter.png differ diff --git a/res/drawable-hdpi/ic_slowshutter_off.png b/res/drawable-hdpi/ic_slowshutter_off.png new file mode 100755 index 000000000..39236c52d Binary files /dev/null and b/res/drawable-hdpi/ic_slowshutter_off.png differ diff --git a/res/drawable-hdpi/ic_tint.png b/res/drawable-hdpi/ic_tint.png new file mode 100755 index 000000000..34a0bb2de Binary files /dev/null and b/res/drawable-hdpi/ic_tint.png differ diff --git a/res/drawable-hdpi/smart_scene_indoor.png b/res/drawable-hdpi/smart_scene_indoor.png new file mode 100755 index 000000000..30d12f522 Binary files /dev/null and b/res/drawable-hdpi/smart_scene_indoor.png differ diff --git a/res/drawable-hdpi/smart_scene_landscape.png b/res/drawable-hdpi/smart_scene_landscape.png new file mode 100755 index 000000000..66dcf2026 Binary files /dev/null and b/res/drawable-hdpi/smart_scene_landscape.png differ diff --git a/res/drawable-hdpi/smart_scene_macro.png b/res/drawable-hdpi/smart_scene_macro.png new file mode 100755 index 000000000..8f7b9f896 Binary files /dev/null and b/res/drawable-hdpi/smart_scene_macro.png differ diff --git a/res/drawable-hdpi/smart_scene_mix_illuminant.png b/res/drawable-hdpi/smart_scene_mix_illuminant.png new file mode 100755 index 000000000..9730d55b2 Binary files /dev/null and b/res/drawable-hdpi/smart_scene_mix_illuminant.png differ diff --git a/res/drawable-hdpi/smart_scene_night.png b/res/drawable-hdpi/smart_scene_night.png new file mode 100755 index 000000000..9f786ced3 Binary files /dev/null and b/res/drawable-hdpi/smart_scene_night.png differ diff --git a/res/drawable-hdpi/smart_scene_portrait.png b/res/drawable-hdpi/smart_scene_portrait.png new file mode 100755 index 000000000..701214c1a Binary files /dev/null and b/res/drawable-hdpi/smart_scene_portrait.png differ diff --git a/res/drawable-hdpi/smart_scene_sports.png b/res/drawable-hdpi/smart_scene_sports.png new file mode 100755 index 000000000..b5173e4ce Binary files /dev/null and b/res/drawable-hdpi/smart_scene_sports.png differ diff --git a/res/drawable-mdpi/ic_asd.png b/res/drawable-mdpi/ic_asd.png new file mode 100755 index 000000000..fe86e3b77 Binary files /dev/null and b/res/drawable-mdpi/ic_asd.png differ diff --git a/res/drawable-mdpi/ic_asd_off.png b/res/drawable-mdpi/ic_asd_off.png new file mode 100755 index 000000000..7fe91db45 Binary files /dev/null and b/res/drawable-mdpi/ic_asd_off.png differ diff --git a/res/drawable-mdpi/ic_beautify.png b/res/drawable-mdpi/ic_beautify.png new file mode 100755 index 000000000..0505b957d Binary files /dev/null and b/res/drawable-mdpi/ic_beautify.png differ diff --git a/res/drawable-mdpi/ic_beautify_off.png b/res/drawable-mdpi/ic_beautify_off.png new file mode 100755 index 000000000..95df3426e Binary files /dev/null and b/res/drawable-mdpi/ic_beautify_off.png differ diff --git a/res/drawable-mdpi/ic_enhance.png b/res/drawable-mdpi/ic_enhance.png new file mode 100755 index 000000000..12f73baf9 Binary files /dev/null and b/res/drawable-mdpi/ic_enhance.png differ diff --git a/res/drawable-mdpi/ic_indicator_sce_asd.png b/res/drawable-mdpi/ic_indicator_sce_asd.png new file mode 100755 index 000000000..8df3dbe29 Binary files /dev/null and b/res/drawable-mdpi/ic_indicator_sce_asd.png differ diff --git a/res/drawable-mdpi/ic_slowshutter.png b/res/drawable-mdpi/ic_slowshutter.png new file mode 100755 index 000000000..bdfcc403e Binary files /dev/null and b/res/drawable-mdpi/ic_slowshutter.png differ diff --git a/res/drawable-mdpi/ic_slowshutter_off.png b/res/drawable-mdpi/ic_slowshutter_off.png new file mode 100755 index 000000000..d9f65dcfe Binary files /dev/null and b/res/drawable-mdpi/ic_slowshutter_off.png differ diff --git a/res/drawable-mdpi/ic_tint.png b/res/drawable-mdpi/ic_tint.png new file mode 100755 index 000000000..cd593bbde Binary files /dev/null and b/res/drawable-mdpi/ic_tint.png differ diff --git a/res/drawable-mdpi/smart_scene_indoor.png b/res/drawable-mdpi/smart_scene_indoor.png new file mode 100644 index 000000000..d3c65bc6d Binary files /dev/null and b/res/drawable-mdpi/smart_scene_indoor.png differ diff --git a/res/drawable-mdpi/smart_scene_landscape.png b/res/drawable-mdpi/smart_scene_landscape.png new file mode 100644 index 000000000..f235dafd5 Binary files /dev/null and b/res/drawable-mdpi/smart_scene_landscape.png differ diff --git a/res/drawable-mdpi/smart_scene_macro.png b/res/drawable-mdpi/smart_scene_macro.png new file mode 100644 index 000000000..91ded8a31 Binary files /dev/null and b/res/drawable-mdpi/smart_scene_macro.png differ diff --git a/res/drawable-mdpi/smart_scene_mix_illuminant.png b/res/drawable-mdpi/smart_scene_mix_illuminant.png new file mode 100644 index 000000000..081553411 Binary files /dev/null and b/res/drawable-mdpi/smart_scene_mix_illuminant.png differ diff --git a/res/drawable-mdpi/smart_scene_night.png b/res/drawable-mdpi/smart_scene_night.png new file mode 100644 index 000000000..8aec6e542 Binary files /dev/null and b/res/drawable-mdpi/smart_scene_night.png differ diff --git a/res/drawable-mdpi/smart_scene_portrait.png b/res/drawable-mdpi/smart_scene_portrait.png new file mode 100644 index 000000000..8e11540ca Binary files /dev/null and b/res/drawable-mdpi/smart_scene_portrait.png differ diff --git a/res/drawable-mdpi/smart_scene_sports.png b/res/drawable-mdpi/smart_scene_sports.png new file mode 100644 index 000000000..4438687f1 Binary files /dev/null and b/res/drawable-mdpi/smart_scene_sports.png differ diff --git a/res/drawable-xhdpi/ic_asd.png b/res/drawable-xhdpi/ic_asd.png new file mode 100755 index 000000000..ffa4a2e7a Binary files /dev/null and b/res/drawable-xhdpi/ic_asd.png differ diff --git a/res/drawable-xhdpi/ic_asd_off.png b/res/drawable-xhdpi/ic_asd_off.png new file mode 100755 index 000000000..ff708a9c0 Binary files /dev/null and b/res/drawable-xhdpi/ic_asd_off.png differ diff --git a/res/drawable-xhdpi/ic_beautify.png b/res/drawable-xhdpi/ic_beautify.png new file mode 100755 index 000000000..5f581efa9 Binary files /dev/null and b/res/drawable-xhdpi/ic_beautify.png differ diff --git a/res/drawable-xhdpi/ic_beautify_off.png b/res/drawable-xhdpi/ic_beautify_off.png new file mode 100755 index 000000000..9d3079fb2 Binary files /dev/null and b/res/drawable-xhdpi/ic_beautify_off.png differ diff --git a/res/drawable-xhdpi/ic_enhance.png b/res/drawable-xhdpi/ic_enhance.png new file mode 100755 index 000000000..9c34ea2e9 Binary files /dev/null and b/res/drawable-xhdpi/ic_enhance.png differ diff --git a/res/drawable-xhdpi/ic_indicator_beautify.png b/res/drawable-xhdpi/ic_indicator_beautify.png new file mode 100755 index 000000000..bc88810df Binary files /dev/null and b/res/drawable-xhdpi/ic_indicator_beautify.png differ diff --git a/res/drawable-xhdpi/ic_indicator_sce_asd.png b/res/drawable-xhdpi/ic_indicator_sce_asd.png new file mode 100755 index 000000000..33e4dacfa Binary files /dev/null and b/res/drawable-xhdpi/ic_indicator_sce_asd.png differ diff --git a/res/drawable-xhdpi/ic_indicator_slowshutter.png b/res/drawable-xhdpi/ic_indicator_slowshutter.png new file mode 100755 index 000000000..fdfbe7f8f Binary files /dev/null and b/res/drawable-xhdpi/ic_indicator_slowshutter.png differ diff --git a/res/drawable-xhdpi/ic_slowshutter.png b/res/drawable-xhdpi/ic_slowshutter.png new file mode 100755 index 000000000..bb0a89a3d Binary files /dev/null and b/res/drawable-xhdpi/ic_slowshutter.png differ diff --git a/res/drawable-xhdpi/ic_slowshutter_off.png b/res/drawable-xhdpi/ic_slowshutter_off.png new file mode 100755 index 000000000..da8c264fd Binary files /dev/null and b/res/drawable-xhdpi/ic_slowshutter_off.png differ diff --git a/res/drawable-xhdpi/ic_tint.png b/res/drawable-xhdpi/ic_tint.png new file mode 100755 index 000000000..5cd73ab43 Binary files /dev/null and b/res/drawable-xhdpi/ic_tint.png differ diff --git a/res/drawable-xhdpi/smart_scene_indoor.png b/res/drawable-xhdpi/smart_scene_indoor.png new file mode 100644 index 000000000..8425c5029 Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_indoor.png differ diff --git a/res/drawable-xhdpi/smart_scene_landscape.png b/res/drawable-xhdpi/smart_scene_landscape.png new file mode 100644 index 000000000..20fa5dacd Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_landscape.png differ diff --git a/res/drawable-xhdpi/smart_scene_macro.png b/res/drawable-xhdpi/smart_scene_macro.png new file mode 100644 index 000000000..eb0fff390 Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_macro.png differ diff --git a/res/drawable-xhdpi/smart_scene_mix_illuminant.png b/res/drawable-xhdpi/smart_scene_mix_illuminant.png new file mode 100644 index 000000000..62e119a2d Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_mix_illuminant.png differ diff --git a/res/drawable-xhdpi/smart_scene_night.png b/res/drawable-xhdpi/smart_scene_night.png new file mode 100644 index 000000000..d96940311 Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_night.png differ diff --git a/res/drawable-xhdpi/smart_scene_portrait.png b/res/drawable-xhdpi/smart_scene_portrait.png new file mode 100644 index 000000000..1ac80236f Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_portrait.png differ diff --git a/res/drawable-xhdpi/smart_scene_sports.png b/res/drawable-xhdpi/smart_scene_sports.png new file mode 100644 index 000000000..6a72b737b Binary files /dev/null and b/res/drawable-xhdpi/smart_scene_sports.png differ 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" /> + android:layout_height="match_parent"> + + 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 @@ + + + + + + off + on + + + + @string/setting_off + @string/setting_on + + + + + @string/pref_camera_burst_entry_20 + @string/pref_camera_burst_entry_15 + @string/pref_camera_burst_entry_10 + @string/pref_camera_burst_entry_5 + @string/pref_camera_burst_entry_off + + + + 20 + 15 + 10 + 5 + 1 + + + + + @string/pref_camera_focustime_entry_infinite + @string/pref_camera_focustime_entry_30 + @string/pref_camera_focustime_entry_20 + @string/pref_camera_focustime_entry_15 + @string/pref_camera_focustime_entry_10 + @string/pref_camera_focustime_entry_5 + + + + + 0 + 30000 + 20000 + 15000 + 10000 + 5000 + + + + + @string/pref_camera_slow_shutter_entry_off + @string/pref_camera_slow_shutter_entry_auto + + + + + slow-shutter-off + slow-shutter-auto + + + + + @drawable/ic_slowshutter_off + @drawable/ic_slowshutter + + + + @drawable/ic_beautify_off + @drawable/ic_beautify + + + + @string/camera_menu_beauty_mode_label + @string/camera_menu_beauty_mode_label + + + + @string/camera_menu_slow_shutter_label + @string/camera_menu_slow_shutter_label + + + + indoor + landscape + macro + mix_illuminant + night + portrait + sports + + + + @drawable/smart_scene_indoor + @drawable/smart_scene_landscape + @drawable/smart_scene_macro + @drawable/smart_scene_mix_illuminant + @drawable/smart_scene_night + @drawable/smart_scene_portrait + @drawable/smart_scene_sports + + + + @string/camera_menu_asd_label + @string/camera_menu_asd_label + + + + @drawable/ic_asd_off + @drawable/ic_asd + + + + @string/setting_off_value + @string/setting_on_value + + + 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 @@ Point red-yellow Cartoonize + + Burst mode + 1 + + + Off + 5 shots + 10 shots + 15 shots + 20 shots + + + Touch focus duration + Select duration for touch focus + 5000 + + + 5s + 10s + 15s + 20s + 30s + Infinite + Red eye RED EYE + + + Beauty mode + off + + + Slow shutter + slow-shutter-off + Off + Auto + 1/2 second + 1 second + 2 seconds + 4 seconds + 8 seconds + + + @string/setting_off_value + + ENHANCE + SLOW SHUTTER + BEAUTIFY + COLORIZE + EFFECTS + SMART SCENE + 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" /> - + + + + + 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"/> - + 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" /> + 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 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 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; } -- cgit v1.2.3