summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/ic_scene_mode_hdr.pngbin0 -> 3144 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_back.pngbin0 -> 1285 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_clean.pngbin0 -> 1739 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_clean_selected.pngbin0 -> 1808 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_custom.pngbin0 -> 1609 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_custom_selected.pngbin0 -> 1627 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_1.pngbin0 -> 18913 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_1_selected.pngbin0 -> 16581 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_2.pngbin0 -> 19141 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_2_selected.pngbin0 -> 16793 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_3.pngbin0 -> 19204 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_3_selected.pngbin0 -> 16921 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_off.pngbin0 -> 18757 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_level_off_selected.pngbin0 -> 16495 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_off.pngbin0 -> 3388 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_on.pngbin0 -> 3670 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_whiten.pngbin0 -> 2146 bytes
-rw-r--r--res/drawable-hdpi/ic_ts_makeup_whiten_selected.pngbin0 -> 2334 bytes
-rw-r--r--res/drawable-mdpi/ic_scene_mode_hdr.pngbin0 -> 2349 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_back.pngbin0 -> 1181 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_clean.pngbin0 -> 1447 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_clean_selected.pngbin0 -> 1526 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_custom.pngbin0 -> 1390 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_custom_selected.pngbin0 -> 1405 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_1.pngbin0 -> 9604 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_1_selected.pngbin0 -> 8412 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_2.pngbin0 -> 9660 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_2_selected.pngbin0 -> 8522 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_3.pngbin0 -> 9722 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_3_selected.pngbin0 -> 8578 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_off.pngbin0 -> 9544 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_level_off_selected.pngbin0 -> 8380 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_off.pngbin0 -> 2284 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_on.pngbin0 -> 2498 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_whiten.pngbin0 -> 1721 bytes
-rw-r--r--res/drawable-mdpi/ic_ts_makeup_whiten_selected.pngbin0 -> 1820 bytes
-rw-r--r--res/drawable-xhdpi/ic_scene_mode_hdr.pngbin0 -> 3967 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_back.pngbin0 -> 1357 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_clean.pngbin0 -> 2037 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_clean_selected.pngbin0 -> 2078 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_custom.pngbin0 -> 1811 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_custom_selected.pngbin0 -> 1828 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_1.pngbin0 -> 31172 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_1_selected.pngbin0 -> 27423 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_2.pngbin0 -> 31547 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_2_selected.pngbin0 -> 27762 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_3.pngbin0 -> 31796 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_3_selected.pngbin0 -> 28008 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_off.pngbin0 -> 30904 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_level_off_selected.pngbin0 -> 27276 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_off.pngbin0 -> 4492 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_on.pngbin0 -> 4814 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_whiten.pngbin0 -> 2569 bytes
-rw-r--r--res/drawable-xhdpi/ic_ts_makeup_whiten_selected.pngbin0 -> 2823 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_back.pngbin0 -> 1433 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_clean.pngbin0 -> 2699 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_clean_selected.pngbin0 -> 2697 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_custom.pngbin0 -> 2227 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_custom_selected.pngbin0 -> 2254 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_1.pngbin0 -> 64076 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_1_selected.pngbin0 -> 56536 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_2.pngbin0 -> 65080 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_2_selected.pngbin0 -> 57244 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_3.pngbin0 -> 65474 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_3_selected.pngbin0 -> 57631 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_off.pngbin0 -> 63595 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_level_off_selected.pngbin0 -> 56150 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_off.pngbin0 -> 6858 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_on.pngbin0 -> 7162 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_whiten.pngbin0 -> 3645 bytes
-rw-r--r--res/drawable-xxhdpi/ic_ts_makeup_whiten_selected.pngbin0 -> 3926 bytes
-rw-r--r--res/drawable/ic_ts_makeup_bg.9.pngbin0 -> 1092 bytes
-rw-r--r--res/drawable/ic_ts_makeup_clean_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_custom_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_hline.pngbin0 -> 946 bytes
-rw-r--r--res/drawable/ic_ts_makeup_level_1_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_level_2_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_level_3_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_level_off_selector.xml22
-rw-r--r--res/drawable/ic_ts_makeup_vline.pngbin0 -> 945 bytes
-rw-r--r--res/drawable/ic_ts_makeup_whiten_selector.xml22
-rw-r--r--res/layout-port/camera_controls.xml6
-rw-r--r--res/layout/panorama_module.xml29
-rw-r--r--res/layout/photo_module.xml6
-rw-r--r--res/layout/ts_makeup_item_view.xml52
-rw-r--r--res/layout/ts_makeup_level_view_land.xml29
-rw-r--r--res/layout/ts_makeup_level_view_port.xml29
-rw-r--r--res/layout/ts_makeup_single_level_view_port.xml154
-rw-r--r--res/values-zh-rCN/strings.xml11
-rw-r--r--res/values/arrays.xml6
-rw-r--r--res/values/config.xml2
-rw-r--r--res/values/dimens.xml2
-rw-r--r--res/values/qcomarrays.xml41
-rw-r--r--res/values/qcomstrings.xml19
-rw-r--r--res/values/strings.xml11
-rw-r--r--res/xml/camera_preferences.xml25
-rw-r--r--res/xml/video_preferences.xml1
-rw-r--r--src/com/android/camera/AndroidCameraManagerImpl.java9
-rw-r--r--src/com/android/camera/CameraActivity.java242
-rw-r--r--src/com/android/camera/CameraSettings.java28
-rw-r--r--src/com/android/camera/ListPreference.java5
-rw-r--r--src/com/android/camera/PhotoMenu.java256
-rw-r--r--src/com/android/camera/PhotoModule.java189
-rw-r--r--src/com/android/camera/PhotoUI.java94
-rw-r--r--src/com/android/camera/TsMakeupManager.java476
-rw-r--r--src/com/android/camera/VideoMenu.java6
-rw-r--r--src/com/android/camera/VideoModule.java89
-rw-r--r--src/com/android/camera/VideoUI.java217
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java19
-rw-r--r--src/com/android/camera/WideAnglePanoramaUI.java43
-rw-r--r--src/com/android/camera/ui/CameraControls.java123
-rw-r--r--src/com/android/camera/ui/FaceView.java43
-rw-r--r--src/com/android/camera/ui/FilmStripView.java11
-rw-r--r--src/com/android/camera/util/CameraUtil.java23
114 files changed, 2095 insertions, 355 deletions
diff --git a/res/drawable-hdpi/ic_scene_mode_hdr.png b/res/drawable-hdpi/ic_scene_mode_hdr.png
new file mode 100644
index 000000000..d6b10af27
--- /dev/null
+++ b/res/drawable-hdpi/ic_scene_mode_hdr.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_back.png b/res/drawable-hdpi/ic_ts_makeup_back.png
new file mode 100644
index 000000000..7adc9bfe9
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_back.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_clean.png b/res/drawable-hdpi/ic_ts_makeup_clean.png
new file mode 100644
index 000000000..1a7d4be21
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_clean.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_clean_selected.png b/res/drawable-hdpi/ic_ts_makeup_clean_selected.png
new file mode 100644
index 000000000..1ead07d6d
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_clean_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_custom.png b/res/drawable-hdpi/ic_ts_makeup_custom.png
new file mode 100644
index 000000000..d818f9554
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_custom.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_custom_selected.png b/res/drawable-hdpi/ic_ts_makeup_custom_selected.png
new file mode 100644
index 000000000..a3a5c04b5
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_custom_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_1.png b/res/drawable-hdpi/ic_ts_makeup_level_1.png
new file mode 100644
index 000000000..56de67f82
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_1.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_1_selected.png b/res/drawable-hdpi/ic_ts_makeup_level_1_selected.png
new file mode 100644
index 000000000..85f989a7b
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_1_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_2.png b/res/drawable-hdpi/ic_ts_makeup_level_2.png
new file mode 100644
index 000000000..bac355cc8
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_2.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_2_selected.png b/res/drawable-hdpi/ic_ts_makeup_level_2_selected.png
new file mode 100644
index 000000000..cf57d3415
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_2_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_3.png b/res/drawable-hdpi/ic_ts_makeup_level_3.png
new file mode 100644
index 000000000..9e04dd412
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_3.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_3_selected.png b/res/drawable-hdpi/ic_ts_makeup_level_3_selected.png
new file mode 100644
index 000000000..3ca366cd9
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_3_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_off.png b/res/drawable-hdpi/ic_ts_makeup_level_off.png
new file mode 100644
index 000000000..9e7e67d80
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_off.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_level_off_selected.png b/res/drawable-hdpi/ic_ts_makeup_level_off_selected.png
new file mode 100644
index 000000000..b7cc7d4f5
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_level_off_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_off.png b/res/drawable-hdpi/ic_ts_makeup_off.png
new file mode 100644
index 000000000..d2c0d94ef
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_off.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_on.png b/res/drawable-hdpi/ic_ts_makeup_on.png
new file mode 100644
index 000000000..34d03b9dc
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_on.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_whiten.png b/res/drawable-hdpi/ic_ts_makeup_whiten.png
new file mode 100644
index 000000000..90b35a9d9
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_whiten.png
Binary files differ
diff --git a/res/drawable-hdpi/ic_ts_makeup_whiten_selected.png b/res/drawable-hdpi/ic_ts_makeup_whiten_selected.png
new file mode 100644
index 000000000..86da7f1d2
--- /dev/null
+++ b/res/drawable-hdpi/ic_ts_makeup_whiten_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_scene_mode_hdr.png b/res/drawable-mdpi/ic_scene_mode_hdr.png
new file mode 100644
index 000000000..caf4601ef
--- /dev/null
+++ b/res/drawable-mdpi/ic_scene_mode_hdr.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_back.png b/res/drawable-mdpi/ic_ts_makeup_back.png
new file mode 100644
index 000000000..7cec89838
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_back.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_clean.png b/res/drawable-mdpi/ic_ts_makeup_clean.png
new file mode 100644
index 000000000..2f65fb692
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_clean.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_clean_selected.png b/res/drawable-mdpi/ic_ts_makeup_clean_selected.png
new file mode 100644
index 000000000..343e6049a
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_clean_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_custom.png b/res/drawable-mdpi/ic_ts_makeup_custom.png
new file mode 100644
index 000000000..adc1b55b9
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_custom.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_custom_selected.png b/res/drawable-mdpi/ic_ts_makeup_custom_selected.png
new file mode 100644
index 000000000..c3d30baca
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_custom_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_1.png b/res/drawable-mdpi/ic_ts_makeup_level_1.png
new file mode 100644
index 000000000..5a6938519
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_1.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_1_selected.png b/res/drawable-mdpi/ic_ts_makeup_level_1_selected.png
new file mode 100644
index 000000000..1cc0387cf
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_1_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_2.png b/res/drawable-mdpi/ic_ts_makeup_level_2.png
new file mode 100644
index 000000000..ac6fc9ec1
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_2.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_2_selected.png b/res/drawable-mdpi/ic_ts_makeup_level_2_selected.png
new file mode 100644
index 000000000..b7dfb7307
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_2_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_3.png b/res/drawable-mdpi/ic_ts_makeup_level_3.png
new file mode 100644
index 000000000..5a777e41e
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_3.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_3_selected.png b/res/drawable-mdpi/ic_ts_makeup_level_3_selected.png
new file mode 100644
index 000000000..9f154b22b
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_3_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_off.png b/res/drawable-mdpi/ic_ts_makeup_level_off.png
new file mode 100644
index 000000000..b08518a9d
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_off.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_level_off_selected.png b/res/drawable-mdpi/ic_ts_makeup_level_off_selected.png
new file mode 100644
index 000000000..a77229f0d
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_level_off_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_off.png b/res/drawable-mdpi/ic_ts_makeup_off.png
new file mode 100644
index 000000000..08cdc12e9
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_off.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_on.png b/res/drawable-mdpi/ic_ts_makeup_on.png
new file mode 100644
index 000000000..82d93f040
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_on.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_whiten.png b/res/drawable-mdpi/ic_ts_makeup_whiten.png
new file mode 100644
index 000000000..5f9bb6681
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_whiten.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_ts_makeup_whiten_selected.png b/res/drawable-mdpi/ic_ts_makeup_whiten_selected.png
new file mode 100644
index 000000000..69fe1ed6b
--- /dev/null
+++ b/res/drawable-mdpi/ic_ts_makeup_whiten_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_scene_mode_hdr.png b/res/drawable-xhdpi/ic_scene_mode_hdr.png
new file mode 100644
index 000000000..d24107512
--- /dev/null
+++ b/res/drawable-xhdpi/ic_scene_mode_hdr.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_back.png b/res/drawable-xhdpi/ic_ts_makeup_back.png
new file mode 100644
index 000000000..136963769
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_back.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_clean.png b/res/drawable-xhdpi/ic_ts_makeup_clean.png
new file mode 100644
index 000000000..e223cd3af
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_clean.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_clean_selected.png b/res/drawable-xhdpi/ic_ts_makeup_clean_selected.png
new file mode 100644
index 000000000..fe0184d60
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_clean_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_custom.png b/res/drawable-xhdpi/ic_ts_makeup_custom.png
new file mode 100644
index 000000000..6594b603d
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_custom.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_custom_selected.png b/res/drawable-xhdpi/ic_ts_makeup_custom_selected.png
new file mode 100644
index 000000000..7845108d5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_custom_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_1.png b/res/drawable-xhdpi/ic_ts_makeup_level_1.png
new file mode 100644
index 000000000..3aa4da0da
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_1.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_1_selected.png b/res/drawable-xhdpi/ic_ts_makeup_level_1_selected.png
new file mode 100644
index 000000000..b10aae7e4
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_1_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_2.png b/res/drawable-xhdpi/ic_ts_makeup_level_2.png
new file mode 100644
index 000000000..92e6bd73a
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_2.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_2_selected.png b/res/drawable-xhdpi/ic_ts_makeup_level_2_selected.png
new file mode 100644
index 000000000..edda58623
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_2_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_3.png b/res/drawable-xhdpi/ic_ts_makeup_level_3.png
new file mode 100644
index 000000000..ad2920908
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_3.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_3_selected.png b/res/drawable-xhdpi/ic_ts_makeup_level_3_selected.png
new file mode 100644
index 000000000..8c043a25e
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_3_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_off.png b/res/drawable-xhdpi/ic_ts_makeup_level_off.png
new file mode 100644
index 000000000..7ecb29e6a
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_off.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_level_off_selected.png b/res/drawable-xhdpi/ic_ts_makeup_level_off_selected.png
new file mode 100644
index 000000000..47ade00c5
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_level_off_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_off.png b/res/drawable-xhdpi/ic_ts_makeup_off.png
new file mode 100644
index 000000000..2de9d8ac8
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_off.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_on.png b/res/drawable-xhdpi/ic_ts_makeup_on.png
new file mode 100644
index 000000000..2178ebf99
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_on.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_whiten.png b/res/drawable-xhdpi/ic_ts_makeup_whiten.png
new file mode 100644
index 000000000..6f2520402
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_whiten.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_ts_makeup_whiten_selected.png b/res/drawable-xhdpi/ic_ts_makeup_whiten_selected.png
new file mode 100644
index 000000000..1b84f9f10
--- /dev/null
+++ b/res/drawable-xhdpi/ic_ts_makeup_whiten_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_back.png b/res/drawable-xxhdpi/ic_ts_makeup_back.png
new file mode 100644
index 000000000..5214f0e1e
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_back.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_clean.png b/res/drawable-xxhdpi/ic_ts_makeup_clean.png
new file mode 100644
index 000000000..5eeea1856
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_clean.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_clean_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_clean_selected.png
new file mode 100644
index 000000000..f3ff4c8d2
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_clean_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_custom.png b/res/drawable-xxhdpi/ic_ts_makeup_custom.png
new file mode 100644
index 000000000..e395f61ab
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_custom.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_custom_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_custom_selected.png
new file mode 100644
index 000000000..fa24b494a
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_custom_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_1.png b/res/drawable-xxhdpi/ic_ts_makeup_level_1.png
new file mode 100644
index 000000000..757c32359
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_1.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_1_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_level_1_selected.png
new file mode 100644
index 000000000..15f500a5a
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_1_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_2.png b/res/drawable-xxhdpi/ic_ts_makeup_level_2.png
new file mode 100644
index 000000000..dd43b4b48
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_2.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_2_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_level_2_selected.png
new file mode 100644
index 000000000..74ca84de0
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_2_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_3.png b/res/drawable-xxhdpi/ic_ts_makeup_level_3.png
new file mode 100644
index 000000000..37aaedb0b
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_3.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_3_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_level_3_selected.png
new file mode 100644
index 000000000..fe701e70c
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_3_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_off.png b/res/drawable-xxhdpi/ic_ts_makeup_level_off.png
new file mode 100644
index 000000000..b72a87614
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_off.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_level_off_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_level_off_selected.png
new file mode 100644
index 000000000..bb9a78371
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_level_off_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_off.png b/res/drawable-xxhdpi/ic_ts_makeup_off.png
new file mode 100644
index 000000000..0455b1c05
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_off.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_on.png b/res/drawable-xxhdpi/ic_ts_makeup_on.png
new file mode 100644
index 000000000..95d7cbf5a
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_on.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_whiten.png b/res/drawable-xxhdpi/ic_ts_makeup_whiten.png
new file mode 100644
index 000000000..1b31ab9dd
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_whiten.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_ts_makeup_whiten_selected.png b/res/drawable-xxhdpi/ic_ts_makeup_whiten_selected.png
new file mode 100644
index 000000000..a6ff05f96
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_ts_makeup_whiten_selected.png
Binary files differ
diff --git a/res/drawable/ic_ts_makeup_bg.9.png b/res/drawable/ic_ts_makeup_bg.9.png
new file mode 100644
index 000000000..57f75a27b
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_bg.9.png
Binary files differ
diff --git a/res/drawable/ic_ts_makeup_clean_selector.xml b/res/drawable/ic_ts_makeup_clean_selector.xml
new file mode 100644
index 000000000..791658dd4
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_clean_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_clean_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_clean" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_custom_selector.xml b/res/drawable/ic_ts_makeup_custom_selector.xml
new file mode 100644
index 000000000..eecc2c7ce
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_custom_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_custom_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_custom" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_hline.png b/res/drawable/ic_ts_makeup_hline.png
new file mode 100644
index 000000000..110ad7150
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_hline.png
Binary files differ
diff --git a/res/drawable/ic_ts_makeup_level_1_selector.xml b/res/drawable/ic_ts_makeup_level_1_selector.xml
new file mode 100644
index 000000000..38e9193ab
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_level_1_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_level_1_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_level_1" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_level_2_selector.xml b/res/drawable/ic_ts_makeup_level_2_selector.xml
new file mode 100644
index 000000000..76d40bd88
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_level_2_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_level_2_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_level_2" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_level_3_selector.xml b/res/drawable/ic_ts_makeup_level_3_selector.xml
new file mode 100644
index 000000000..e26ecdfa5
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_level_3_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_level_3_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_level_3" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_level_off_selector.xml b/res/drawable/ic_ts_makeup_level_off_selector.xml
new file mode 100644
index 000000000..e1939673a
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_level_off_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_level_off_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_level_off" />
+</selector>
diff --git a/res/drawable/ic_ts_makeup_vline.png b/res/drawable/ic_ts_makeup_vline.png
new file mode 100644
index 000000000..89c722c93
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_vline.png
Binary files differ
diff --git a/res/drawable/ic_ts_makeup_whiten_selector.xml b/res/drawable/ic_ts_makeup_whiten_selector.xml
new file mode 100644
index 000000000..f1284b604
--- /dev/null
+++ b/res/drawable/ic_ts_makeup_whiten_selector.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/ic_ts_makeup_whiten_selected" />
+ <item android:drawable="@drawable/ic_ts_makeup_whiten" />
+</selector>
diff --git a/res/layout-port/camera_controls.xml b/res/layout-port/camera_controls.xml
index 121f25b6e..af47a13b6 100644
--- a/res/layout-port/camera_controls.xml
+++ b/res/layout-port/camera_controls.xml
@@ -63,7 +63,7 @@
android:layout_width="@dimen/capture_size"
android:layout_height="@dimen/capture_size"
android:layout_gravity="top|right"
- android:background="@android:color/black"
+ android:background="@android:color/transparent"
android:contentDescription="@string/switch_photo_filmstrip"
android:scaleType="fitCenter" />
@@ -83,6 +83,10 @@
android:id="@+id/filter_mode_switcher"
style="@style/ToggleButton" />
+ <com.android.camera.ui.RotateImageView
+ android:id="@+id/ts_makeup_switcher"
+ style="@style/ToggleButton" />
+
<LinearLayout
android:id="@+id/remaining_photos"
android:layout_width="wrap_content"
diff --git a/res/layout/panorama_module.xml b/res/layout/panorama_module.xml
index 581170f07..db05b806c 100644
--- a/res/layout/panorama_module.xml
+++ b/res/layout/panorama_module.xml
@@ -25,6 +25,35 @@
android:layout_height="match_parent"
android:background="@android:color/black"
android:visibility="gone" />
+
+ <com.android.camera.ui.RotateLayout
+ android:id="@+id/waitingDialog"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center" >
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:background="@color/pano_progress_empty"
+ android:orientation="horizontal"
+ android:padding="10dp" >
+
+ <ProgressBar
+ style="@android:attr/progressBarStyle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:layout_marginRight="12dp" />
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:text="@string/pano_dialog_prepare_preview" />
+ </LinearLayout>
+ </com.android.camera.ui.RotateLayout>
+
<include layout="@layout/pano_module_review" />
<include layout="@layout/camera_controls"
android:layout_gravity="center"
diff --git a/res/layout/photo_module.xml b/res/layout/photo_module.xml
index c6d895771..e0aaa147f 100644
--- a/res/layout/photo_module.xml
+++ b/res/layout/photo_module.xml
@@ -99,4 +99,10 @@
<include layout="@layout/camera_controls"
android:layout_gravity="center"
style="@style/CameraControls"/>
+
+ <RelativeLayout
+ android:id="@+id/id_tsmakeup_level_layout_root"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:visibility="gone" />
</merge>
diff --git a/res/layout/ts_makeup_item_view.xml b/res/layout/ts_makeup_item_view.xml
new file mode 100644
index 000000000..4b5a050cf
--- /dev/null
+++ b/res/layout/ts_makeup_item_view.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<com.android.camera.ui.RotateLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:id="@+id/border"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <ImageView
+ android:id="@+id/image"
+ android:layout_width="48dip"
+ android:layout_height="48dip"
+ android:layout_gravity="center"
+ android:gravity="center" />
+
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:singleLine="true"
+ android:textColor="@android:color/white"
+ android:textSize="13sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+
+</com.android.camera.ui.RotateLayout> \ No newline at end of file
diff --git a/res/layout/ts_makeup_level_view_land.xml b/res/layout/ts_makeup_level_view_land.xml
new file mode 100644
index 000000000..0d02562ff
--- /dev/null
+++ b/res/layout/ts_makeup_level_view_land.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/id_makeup_level_root"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_gravity="right"
+ android:layout_alignParentRight="true"
+ android:alpha="0.85"
+ android:orientation="vertical" >
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/ts_makeup_level_view_port.xml b/res/layout/ts_makeup_level_view_port.xml
new file mode 100644
index 000000000..4ffaba5dd
--- /dev/null
+++ b/res/layout/ts_makeup_level_view_port.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/id_makeup_level_root"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:layout_alignParentBottom="true"
+ android:alpha="0.85"
+ android:orientation="horizontal" >
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/ts_makeup_single_level_view_port.xml b/res/layout/ts_makeup_single_level_view_port.xml
new file mode 100644
index 000000000..fbfafeec3
--- /dev/null
+++ b/res/layout/ts_makeup_single_level_view_port.xml
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2014,2015 Thundersoft Corporation
+ All rights Reserved
+
+ 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/id_makeup_single_level_root"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_gravity="bottom"
+ android:orientation="vertical" >
+
+ <SeekBar
+ android:id="@+id/seekbar_makeup_level"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="8dip"
+ android:visibility="gone" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/tsmakeup_mode_level_size"
+ android:layout_gravity="center"
+ android:gravity="center" >
+
+ <LinearLayout
+ android:id="@+id/id_layout_makeup_back"
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="2.0"
+ android:gravity="center" >
+
+ <ImageView
+ android:id="@+id/id_iv_makeup_back"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_ts_makeup_back" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="1.0"
+ android:gravity="center" >
+
+ <View
+ android:layout_width="1dip"
+ android:layout_height="36dip"
+ android:layout_gravity="center"
+ android:background="@drawable/ic_ts_makeup_vline" />
+ </LinearLayout>
+
+ <com.android.camera.ui.RotateLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="3.5"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:id="@+id/id_layout_makeup_clean"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="2dip" >
+
+ <ImageView
+ android:id="@+id/id_iv_makeup_clean"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_ts_makeup_clean_selector" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:shadowColor="@android:color/black"
+ android:shadowDx="1"
+ android:shadowDy="1"
+ android:shadowRadius="2"
+ android:singleLine="true"
+ android:text="@string/pref_camera_tsmakeup_level_clean"
+ android:textColor="@android:color/white"
+ android:textSize="13sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+ </com.android.camera.ui.RotateLayout>
+
+ <com.android.camera.ui.RotateLayout
+ android:layout_width="0dip"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:layout_weight="3.5"
+ android:gravity="center"
+ android:orientation="vertical" >
+
+ <LinearLayout
+ android:id="@+id/id_layout_makeup_whiten"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:orientation="vertical"
+ android:padding="2dp" >
+
+ <ImageView
+ android:id="@+id/id_iv_makeup_whiten"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:src="@drawable/ic_ts_makeup_whiten_selector" />
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:shadowColor="@android:color/black"
+ android:shadowDx="1"
+ android:shadowDy="1"
+ android:shadowRadius="2"
+ android:singleLine="true"
+ android:text="@string/pref_camera_tsmakeup_level_whiten"
+ android:textColor="@android:color/white"
+ android:textSize="13sp"
+ android:textStyle="bold" />
+ </LinearLayout>
+ </com.android.camera.ui.RotateLayout>
+ </LinearLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml
index e248a4523..af9fdfada 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -529,4 +529,15 @@
<string name="camera_gesture_title">打开相机</string>
<string name="remaining_photos_format">剩余 %d 张</string>
+ <string name="pref_camera_tsmakeup_title">美颜</string>
+ <string name="pref_camera_tsmakeup_entry_on">开</string>
+ <string name="pref_camera_tsmakeup_entry_off">关</string>
+ <string name="pref_camera_tsmakeup_custom">自定义</string>
+ <string name="pref_camera_tsmakeup_level_whiten">美白</string>
+ <string name="pref_camera_tsmakeup_level_clean">磨皮</string>
+ <string name="text_tsmakeup_alert_title">警告</string>
+ <string name="text_tsmakeup_alert_msg">实时美颜需要开启人脸检测功能,是否开启?</string>
+ <string name="text_tsmakeup_alert_continue">继续</string>
+ <string name="text_tsmakeup_alert_quit">退出</string>
+
</resources>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 5ee0c7720..96234eda8 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -209,7 +209,7 @@
size to the first one in the list that is also supported by the
driver -->
<string-array name="pref_camera_picturesize_entryvalues" translatable="false">
- <item>5248x3936</item>
+ <item>5344x4016</item>
<item>4608x3456</item>
<item>4160x3120</item>
<item>4000x3000</item>
@@ -397,6 +397,7 @@
<!-- Camera Preferences Scene Mode dialog box entries -->
<string-array name="pref_camera_scenemode_entries" translatable="false">
<item>@string/pref_camera_scenemode_entry_auto</item>
+ <item>@string/pref_camera_scenemode_entry_hdr</item>
<item>@string/pref_camera_scenemode_entry_refocus</item>
<item>@string/pref_camera_scenemode_entry_portrait</item>
<item>@string/pref_camera_scenemode_entry_landscape</item>
@@ -412,6 +413,7 @@
<array name="scenemode_thumbnails" translatable="false">
<item>@drawable/ic_scene_mode_auto</item>
+ <item>@drawable/ic_scene_mode_hdr</item>
<item>@drawable/ic_scene_mode_refocus</item>
<item>@drawable/ic_scene_mode_portrait</item>
<item>@drawable/ic_scene_mode_landscape</item>
@@ -443,7 +445,7 @@
<string-array name="pref_camera_scenemode_entryvalues" translatable="false">
<item>auto</item>
-
+ <item>hdr</item>
<item>@string/pref_camera_advanced_feature_value_refocus_on</item>
<item>portrait</item>
<item>landscape</item>
diff --git a/res/values/config.xml b/res/values/config.xml
index f83b5d8f4..7ada8d775 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -22,7 +22,7 @@
<!-- This value may be tweaked to save memory on low RAM devices. The value
is the percentage of camera preview height/width to scale to. -->
- <integer name="panorama_frame_size_reduction">100</integer>
+ <integer name="panorama_frame_size_reduction">90</integer>
<!-- This value may be changed to true to enable the warped pano preview overlayed on top
of the fullscreen pano preview. -->
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 64e55adc7..1ba60c825 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -167,6 +167,8 @@
<dimen name="filter_mode_padding">10dp</dimen>
<dimen name="remaining_photos_margin">67dp</dimen>
+ <dimen name="tsmakeup_mode_paddingBottom">96dp</dimen>
+ <dimen name="tsmakeup_mode_level_size">96dp</dimen>
<!-- Margins for 4:3 preview on 16:9 screen with 640dp height -->
<dimen name="preview_top_margin">57dp</dimen>
diff --git a/res/values/qcomarrays.xml b/res/values/qcomarrays.xml
index 23ba3d382..99c4337fd 100644
--- a/res/values/qcomarrays.xml
+++ b/res/values/qcomarrays.xml
@@ -663,6 +663,7 @@
<item>@string/pref_camera_advanced_feature_entry_FSSR</item>
<item>@string/pref_camera_advanced_feature_entry_trueportrait</item>
<item>@string/pref_camera_advanced_feature_entry_multi_touch_focus</item>
+ <item>@string/pref_camera_advanced_feature_entry_stillmore</item>
</string-array>
<string-array name="pref_camera_advanced_features_entryvalues" translatable="false">
@@ -674,6 +675,7 @@
<item>@string/pref_camera_advanced_feature_value_FSSR_on</item>
<item>@string/pref_camera_advanced_feature_value_trueportrait_on</item>
<item>@string/pref_camera_advanced_feature_value_multi_touch_focus_on</item>
+ <item>@string/pref_camera_advanced_feature_value_stillmore_on</item>
</string-array>
<!-- Camera Preferences Long Shot dialog box entries -->
@@ -767,6 +769,45 @@
<item>@string/pref_hdr_need_1x_value_false</item>
<item>@string/pref_hdr_need_1x_value_true</item>
</string-array>
+ <string-array name="pref_camera_tsmakeup_entries">
+ <item>@string/pref_camera_tsmakeup_entry_off</item>
+ <item>@string/pref_camera_tsmakeup_entry_on</item>
+ </string-array>
+
+ <!-- Do not localize entryvalues -->
+ <string-array name="pref_camera_tsmakeup_entryvalues">
+ <item>Off</item>
+ <item>On</item>
+ </string-array>
+
+ <!-- Camera Preferences Color effect dialog box entries -->
+ <string-array name="pref_camera_tsmakeup_level_entries" translatable="false">
+ <item>@string/pref_camera_tsmakeup_entry_off</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>@string/pref_camera_tsmakeup_custom</item>
+ </string-array>
+
+ <array name="tsmakeup_level_thumbnails" translatable="false">
+ <item>@drawable/ic_ts_makeup_level_off_selector</item>
+ <item>@drawable/ic_ts_makeup_level_1_selector</item>
+ <item>@drawable/ic_ts_makeup_level_2_selector</item>
+ <item>@drawable/ic_ts_makeup_level_3_selector</item>
+ <item>@drawable/ic_ts_makeup_custom_selector</item>
+ </array>
+
+ <string-array name="pref_camera_tsmakeup_level_entryvalues" translatable="false">
+ <item>@string/pref_camera_tsmakeup_default</item>
+ <item>20</item>
+ <item>60</item>
+ <item>100</item>
+ <item>none</item>
+ </string-array>
+ <string-array name="pref_ts_makeup_icons" translatable="false">
+ <item>@drawable/ic_ts_makeup_off</item>
+ <item>@drawable/ic_ts_makeup_on</item>
+ </string-array>
</resources>
diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml
index 6ba2af63f..5bab9841b 100644
--- a/res/values/qcomstrings.xml
+++ b/res/values/qcomstrings.xml
@@ -151,6 +151,7 @@
<string name="pref_camera_advanced_feature_entry_FSSR">FSSR</string>
<string name="pref_camera_advanced_feature_entry_trueportrait">True Portrait</string>
<string name="pref_camera_advanced_feature_entry_multi_touch_focus">Multi-touch Focus</string>
+ <string name="pref_camera_advanced_feature_entry_stillmore">Still More</string>
<!-- Auto exposure entry values. Do not translate. -->
<string name="pref_camera_advanced_feature_value_none">none</string>
@@ -161,6 +162,8 @@
<string name="pref_camera_advanced_feature_value_FSSR_on">FSSR-on</string>
<string name="pref_camera_advanced_feature_value_trueportrait_on">true-portrait-on</string>
<string name="pref_camera_advanced_feature_value_multi_touch_focus_on">multi-touch-focus-on</string>
+ <string name="pref_camera_advanced_feature_value_stillmore_on">still-more-on</string>
+
<string name="pref_camera_advanced_feature_value_ubifocus_off">af-bracket-off</string>
<string name="pref_camera_advanced_feature_value_refocus_off">re-focus-off</string>
<string name="pref_camera_advanced_feature_value_chromaflash_off">chroma-flash-off</string>
@@ -168,6 +171,7 @@
<string name="pref_camera_advanced_feature_value_FSSR_off">FSSR-off</string>
<string name="pref_camera_advanced_feature_value_trueportrait_off">true-portrait-off</string>
<string name="pref_camera_advanced_feature_value_multi_touch_focus_off">multi-touch-focus-off</string>
+ <string name="pref_camera_advanced_feature_value_stillmore_off">still-more-off</string>
<!-- Manual exposure control entry values -->
<string name="pref_camera_manual_exp_title">Manual Exposure</string>
@@ -328,6 +332,9 @@
<!-- The message is shown in dialog when the app encounters an unsupported video resolution-->
<string name="error_app_unsupported">Unsupported video resolution for this encoder type</string>
+ <!-- The message is shown in dialog when the app encounters an unsupported video profile-->
+ <string name="error_app_unsupported_profile">Unsupported video profile</string>
+
<!--The message is shown in dialog when the raw snapshot is selected in zsl mode-->
<string name="error_app_unsupported_raw">Raw picture format is not supported
in zsl mode, change to JPEG
@@ -865,6 +872,18 @@
<!-- The alas of CameraActivity for gesture operation -->
<string name="camera_gesture_title">Launch camera</string>
+ <string name="pref_camera_tsmakeup_title">Beautification</string>
+ <string name="pref_camera_tsmakeup_entry_on">On</string>
+ <string name="pref_camera_tsmakeup_entry_off">Off</string>
+ <string name="pref_camera_tsmakeup_default" translatable="false">Off</string>
+ <string name="pref_camera_tsmakeup_level_default" translatable="false">60</string>
+ <string name="pref_camera_tsmakeup_custom">Custom</string>
+ <string name="pref_camera_tsmakeup_level_whiten">Whiten</string>
+ <string name="pref_camera_tsmakeup_level_clean">Soften</string>
+ <string name="text_tsmakeup_alert_title">Warning</string>
+ <string name="text_tsmakeup_alert_msg">The beautification must turn on Face Detection, Continue or Quit?</string>
+ <string name="text_tsmakeup_alert_continue">Continue</string>
+ <string name="text_tsmakeup_alert_quit">Quit</string>
<string name="all_in_focus">All in Focus</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 33597b74b..0477c3dc5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -238,8 +238,6 @@
<!-- The Video quality settings in preference [CHAR LIMIT=21] -->
<string name="pref_video_quality_title">Video quality</string>
- <!-- The default quality value is (CIF) -->
- <string name="pref_video_quality_default" translatable="false">352x288</string>
<!-- Video quality setting entry.
Videos will be recorded in 4k DCI quality. [CHAR LIMIT=24] -->
<string name="pref_video_quality_entry_4kdci" translatable="false">
@@ -434,6 +432,15 @@
<!-- Toast after enable 2k4k video quality to inform IS has disabled -->
<string name="video_quality_4k_disable_IS">Enable 4k video quality will disable IS.</string>
+ <!-- Toast after 2k4k video is enabled to inform SeeMore has been disabled -->
+ <string name="video_quality_4k_disable_SeeMore">SeeMore cannot be enabled during 4k video.</string>
+
+ <!-- Toast after SeeMore has been enabled to show CDS is disabled -->
+ <string name="disable_CDS_during_SeeMore">SeeMore will disable CDS.</string>
+
+ <!-- Toast after SeeMore has been enabled to show TNR is disabled -->
+ <string name="disable_TNR_during_SeeMore">SeeMore will disable TNR.</string>
+
<!-- Exposure settings in preference -->
<string name="pref_exposure_title">Exposure</string>
<string name="pref_exposure_default" translatable="false">0</string>
diff --git a/res/xml/camera_preferences.xml b/res/xml/camera_preferences.xml
index c9008c3a7..6fc88a35f 100644
--- a/res/xml/camera_preferences.xml
+++ b/res/xml/camera_preferences.xml
@@ -231,6 +231,31 @@
camera:singleIcon="@drawable/ic_settings_facerec"
camera:entryValues="@array/pref_camera_facedetection_entryvalues" />
<IconListPreference
+ camera:key="pref_camera_tsmakeup_key"
+ camera:defaultValue="@string/pref_camera_tsmakeup_default"
+ camera:title="@string/pref_camera_tsmakeup_title"
+ camera:entries="@array/pref_camera_tsmakeup_entries"
+ camera:singleIcon="@drawable/ic_ts_makeup_off"
+ camera:icons="@array/pref_ts_makeup_icons"
+ camera:largeIcons="@array/pref_ts_makeup_icons"
+ camera:entryValues="@array/pref_camera_tsmakeup_entryvalues" />
+ <IconListPreference
+ camera:key="pref_camera_tsmakeup_level_key"
+ camera:defaultValue="@string/pref_camera_tsmakeup_default"
+ camera:title="@string/pref_camera_tsmakeup_title"
+ camera:entries="@array/pref_camera_tsmakeup_level_entries"
+ camera:thumbnails="@array/tsmakeup_level_thumbnails"
+ camera:singleIcon="@drawable/ic_ts_makeup_off"
+ camera:entryValues="@array/pref_camera_tsmakeup_level_entryvalues" />
+ <ListPreference
+ camera:key="pref_camera_tsmakeup_whiten"
+ camera:defaultValue="@string/pref_camera_tsmakeup_level_default"
+ camera:title="@string/pref_camera_tsmakeup_title" />
+ <ListPreference
+ camera:key="pref_camera_tsmakeup_clean"
+ camera:defaultValue="@string/pref_camera_tsmakeup_level_default"
+ camera:title="@string/pref_camera_tsmakeup_title" />
+ <IconListPreference
camera:key="pref_camera_redeyereduction_key"
camera:defaultValue="@string/pref_camera_redeyereduction_default"
camera:title="@string/pref_camera_redeyereduction_title"
diff --git a/res/xml/video_preferences.xml b/res/xml/video_preferences.xml
index 12dfc700f..b82ca1ba3 100644
--- a/res/xml/video_preferences.xml
+++ b/res/xml/video_preferences.xml
@@ -19,7 +19,6 @@
camera:title="@string/pref_camcorder_settings_category">
<IconListPreference
camera:key="pref_video_quality_key"
- camera:defaultValue="@string/pref_video_quality_default"
camera:title="@string/pref_video_quality_title"
camera:entries="@array/pref_video_quality_entries"
camera:singleIcon="@drawable/ic_settings_quality"
diff --git a/src/com/android/camera/AndroidCameraManagerImpl.java b/src/com/android/camera/AndroidCameraManagerImpl.java
index 408bf4f55..b2d7c7681 100644
--- a/src/com/android/camera/AndroidCameraManagerImpl.java
+++ b/src/com/android/camera/AndroidCameraManagerImpl.java
@@ -201,7 +201,14 @@ class AndroidCameraManagerImpl implements CameraManager {
try {
switch (msg.what) {
case OPEN_CAMERA:
- mCamera = android.hardware.Camera.open(msg.arg1);
+ try {
+ mCamera = android.hardware.Camera.openLegacy(msg.arg1,
+ android.hardware.Camera.CAMERA_HAL_API_VERSION_1_0);
+ } catch (RuntimeException e) {
+ /* Retry with open if openLegacy fails */
+ Log.v(TAG, "openLegacy failed. Using open instead");
+ mCamera = android.hardware.Camera.open(msg.arg1);
+ }
if (mCamera != null) {
mParametersIsDirty = true;
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index b3a7680a9..49fa4e99d 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -36,7 +36,18 @@ import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.BitmapRegionDecoder;
+import android.graphics.BitmapShader;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.Matrix;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Shader;
import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.media.ThumbnailUtils;
import android.nfc.NfcAdapter;
@@ -86,6 +97,7 @@ import com.android.camera.data.LocalDataAdapter;
import com.android.camera.data.LocalMediaObserver;
import com.android.camera.data.MediaDetails;
import com.android.camera.data.SimpleViewData;
+import com.android.camera.exif.ExifInterface;
import com.android.camera.tinyplanet.TinyPlanetFragment;
import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.DetailsDialog;
@@ -101,6 +113,7 @@ import com.android.camera.util.UsageStatistics;
import org.codeaurora.snapcam.R;
import java.io.File;
+import java.io.IOException;
import static com.android.camera.CameraManager.CameraOpenErrorCallback;
@@ -121,6 +134,9 @@ public class CameraActivity extends Activity
"com.android.camera.action.TRIM";
public static final String MEDIA_ITEM_PATH = "media-item-path";
+ // Used to show whether Gallery was launched from Snapcam
+ private static final String KEY_FROM_SNAPCAM = "from-snapcam";
+
// The intent extra for camera from secure lock screen. True if the gallery
// should only show newly captured pictures. sSecureAlbumId does not
// increment. This is used when switching between camera, camcorder, and
@@ -196,6 +212,7 @@ public class CameraActivity extends Activity
private boolean mIsEditActivityInProgress = false;
private View mPreviewCover;
private FrameLayout mPreviewContentLayout;
+ private boolean mPaused = true;
private Uri[] mNfcPushUris = new Uri[1];
@@ -214,7 +231,12 @@ public class CameraActivity extends Activity
private Intent mImageShareIntent;
public static int SETTING_LIST_WIDTH_1 = 250;
public static int SETTING_LIST_WIDTH_2 = 250;
- private Bitmap mPreviewThumbnailBitmap;
+
+ private ImageView mThumbnail;
+ private CircularDrawable mThumbnailDrawable;
+ // FilmStripView.setDataAdapter fires 2 onDataLoaded calls before any data is actually loaded
+ // Keep track of data request here to avoid creating useless UpdateThumbnailTask.
+ private boolean mDataRequested;
private AudioManager mAudioManager;
private int mShutterVol;
@@ -545,8 +567,22 @@ public class CameraActivity extends Activity
return;
}
}
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(intent);
+ try {
+ Intent intent = IntentHelper.getGalleryIntent(this);
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.setData(uri);
+ intent.putExtra(KEY_FROM_SNAPCAM, true);
+ startActivity(intent);
+ } catch (ActivityNotFoundException ex) {
+ try {
+ Log.w(TAG, "Gallery not found");
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(intent);
+ intent.putExtra(KEY_FROM_SNAPCAM, true);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "No Activity could be found to open image or video");
+ }
+ }
}
/**
@@ -650,48 +686,47 @@ public class CameraActivity extends Activity
return s;
}
- public void setPreviewThumbnailBitmap(Bitmap bitmap) {
- mPreviewThumbnailBitmap = bitmap;
+ public void updateThumbnail(final byte[] jpegData) {
+ (new UpdateThumbnailTask(jpegData, false)).execute();
}
- public Bitmap getPreviewThumbBitmap() {
- return mPreviewThumbnailBitmap;
+ public void updateThumbnail(final Bitmap bitmap) {
+ mThumbnailDrawable = new CircularDrawable(bitmap);
+ if (mThumbnail != null) {
+ mThumbnail.setImageDrawable(mThumbnailDrawable);
+ mThumbnail.setVisibility(View.VISIBLE);
+ }
}
- public void updatePreviewThumbnail() {
- if (mCurrentModule != null) {
- if (mCurrentModule instanceof VideoModule) {
- ((VideoModule) mCurrentModule).updatePreviewThumbnail();
- }
- else if (mCurrentModule instanceof WideAnglePanoramaModule) {
- ((WideAnglePanoramaModule) mCurrentModule).updatePreviewThumbnail();
- }
- else if (mCurrentModule instanceof PhotoModule) {
- ((PhotoModule) mCurrentModule).updatePreviewThumbnail();
- }
+ public void updateThumbnail(ImageView thumbnail) {
+ mThumbnail = thumbnail;
+ if (mThumbnailDrawable != null) {
+ mThumbnail.setImageDrawable(mThumbnailDrawable);
+ mThumbnail.setVisibility(View.VISIBLE);
}
}
- public void updatePreviewThumbnailForVideo() {
- if (mCurrentModule != null) {
- if (mCurrentModule instanceof VideoModule) {
- ((VideoModule) mCurrentModule).updatePreviewThumbnail();
- }
+ public void updateThumbnail(boolean videoOnly) {
+ // Only handle OnDataInserted if it's video.
+ // Photo and Panorama have their own way of updating thumbnail.
+ if (!videoOnly || (mCurrentModule instanceof VideoModule)) {
+ (new UpdateThumbnailTask(null, true)).execute();
}
}
- public class UpdatePreviewThumbnail extends AsyncTask<Void, Void, Bitmap> {
- private ImageView imgView;
- private Bitmap imgBitmap = null;
+ private class UpdateThumbnailTask extends AsyncTask<Void, Void, Bitmap> {
+ private final byte[] mJpegData;
+ private final boolean mCheckOrientation;
- public UpdatePreviewThumbnail(ImageView view) {
- imgView = view;
+ public UpdateThumbnailTask(final byte[] jpegData, boolean checkOrientation) {
+ mJpegData = jpegData;
+ mCheckOrientation = checkOrientation;
}
@Override
protected Bitmap doInBackground(Void... params) {
- if (imgBitmap != null)
- return imgBitmap;
+ if (mJpegData != null)
+ return decodeImageCenter(null);
LocalDataAdapter adapter = getDataAdapter();
ImageData img = adapter.getImageData(1);
@@ -705,22 +740,146 @@ public class CameraActivity extends Activity
}
else {
if (img.isPhoto()) {
- BitmapFactory.Options opt = new BitmapFactory.Options();
- opt.inSampleSize = 4;
- return BitmapFactory.decodeFile(path, opt);
+ return decodeImageCenter(path);
} else {
return ThumbnailUtils
- .createVideoThumbnail(path, MediaStore.Video.Thumbnails.MICRO_KIND);
+ .createVideoThumbnail(path, MediaStore.Video.Thumbnails.MINI_KIND);
}
}
}
@Override
protected void onPostExecute(Bitmap bitmap) {
- if (imgView == null)
- return;
- imgView.setImageBitmap(bitmap);
- setPreviewThumbnailBitmap(bitmap);
+ if (bitmap == null) {
+ if (mThumbnail != null) {
+ mThumbnail.setVisibility(View.GONE);
+ }
+ } else {
+ updateThumbnail(bitmap);
+ }
+ }
+
+ private Bitmap decodeImageCenter(final String path) {
+ // Check photo orientation for Panorama. This is necessary during app launch because
+ // Panorama module generates thumbnail bitmap with orientation adjustment but only
+ // saves jpeg with orientation tag set.
+ int orientation = 0;
+ if (mCheckOrientation) {
+ ExifInterface exif = new ExifInterface();
+ try {
+ if (mJpegData != null) {
+ exif.readExif(mJpegData);
+ } else {
+ exif.readExif(path);
+ }
+ orientation = Exif.getOrientation(exif);
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ final BitmapFactory.Options opt = new BitmapFactory.Options();
+ opt.inJustDecodeBounds = true;
+ if (mJpegData != null) {
+ BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length, opt);
+ } else {
+ BitmapFactory.decodeFile(path, opt);
+ }
+
+ int w = opt.outWidth;
+ int h = opt.outHeight;
+ int d = w > h ? h : w;
+ final Rect rect = w > h ? new Rect((w - h) / 2, 0, (w + h) / 2, h)
+ : new Rect(0, (h - w) / 2, w, (h + w) / 2);
+
+ final int target = getResources().getDimensionPixelSize(R.dimen.capture_size);
+ int sample = 1;
+ if (d > target) {
+ while (d / sample / 2 > target) {
+ sample *= 2;
+ }
+ }
+
+ opt.inJustDecodeBounds = false;
+ opt.inSampleSize = sample;
+ final BitmapRegionDecoder decoder;
+ try {
+ if (mJpegData == null) {
+ decoder = BitmapRegionDecoder.newInstance(path, true);
+ } else {
+ decoder = BitmapRegionDecoder.newInstance(mJpegData, 0, mJpegData.length, true);
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ Bitmap bitmap = decoder.decodeRegion(rect, opt);
+ if (orientation != 0) {
+ Matrix matrix = new Matrix();
+ matrix.setRotate(orientation);
+ bitmap = Bitmap.createBitmap(bitmap, 0, 0,
+ bitmap.getWidth(), bitmap.getHeight(), matrix, false);
+ }
+ return bitmap;
+ }
+ }
+
+ private class CircularDrawable extends Drawable {
+ private final BitmapShader mBitmapShader;
+ private final Paint mPaint;
+ private Rect mRect;
+ private int mLength;
+
+ public CircularDrawable(Bitmap bitmap) {
+ int w = bitmap.getWidth();
+ int h = bitmap.getHeight();
+ if (w > h) {
+ mLength = h;
+ bitmap = Bitmap.createBitmap(bitmap, (w - h) / 2, 0, h, h);
+ } else if (w < h) {
+ mLength = w;
+ bitmap = Bitmap.createBitmap(bitmap, 0, (h - w) / 2, w, w);
+ }
+
+ mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
+ mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ mPaint.setShader(mBitmapShader);
+ }
+
+ @Override
+ protected void onBoundsChange(Rect bounds) {
+ super.onBoundsChange(bounds);
+ mRect = bounds;
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ canvas.drawRoundRect(new RectF(mRect), (mRect.right - mRect.left) / 2,
+ (mRect.bottom - mRect.top) / 2, mPaint);
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ mPaint.setAlpha(alpha);
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter filter) {
+ mPaint.setColorFilter(filter);
+ }
+
+ @Override
+ public int getIntrinsicWidth() {
+ return mLength;
+ }
+
+ @Override
+ public int getIntrinsicHeight() {
+ return mLength;
}
}
@@ -1149,7 +1308,7 @@ public class CameraActivity extends Activity
@Override
protected void onPostExecute(MediaDetails mediaDetails) {
- if (mediaDetails != null) {
+ if ((mediaDetails != null) && !mPaused) {
DetailsDialog.create(CameraActivity.this, mediaDetails).show();
}
}
@@ -1306,6 +1465,7 @@ public class CameraActivity extends Activity
mFilmStripView.setDataAdapter(mDataAdapter);
if (!isCaptureIntent()) {
mDataAdapter.requestLoad(getContentResolver());
+ mDataRequested = true;
}
} else {
// Put a lock placeholder as the last image by setting its date to
@@ -1411,6 +1571,7 @@ public class CameraActivity extends Activity
super.onPause();
mCurrentModule.onPauseAfterSuper();
+ mPaused = true;
mLocalImagesObserver.setActivityPaused(true);
mLocalVideosObserver.setActivityPaused(true);
}
@@ -1436,6 +1597,7 @@ public class CameraActivity extends Activity
mOrientationListener.enable();
mCurrentModule.onResumeBeforeSuper();
super.onResume();
+ mPaused = false;
mCurrentModule.onResumeAfterSuper();
setSwipingEnabled(true);
@@ -1455,7 +1617,7 @@ public class CameraActivity extends Activity
// If it's secure camera, requestLoad() should not be called
// as it will load all the data.
mDataAdapter.requestLoad(getContentResolver());
- setPreviewThumbnailBitmap(null);
+ mThumbnailDrawable = null;
}
}
mLocalImagesObserver.setActivityPaused(false);
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 63581b8ba..fd7274e52 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -132,6 +132,7 @@ public class CameraSettings {
private static final String KEY_QC_SUPPORTED_FACE_RECOGNITION_MODES = "face-recognition-values";
private static final String KEY_QC_SUPPORTED_DIS_MODES = "dis-values";
private static final String KEY_QC_SUPPORTED_SEE_MORE_MODES = "see-more-values";
+ private static final String KEY_QC_SUPPORTED_STILL_MORE_MODES = "still-more-values";
private static final String KEY_QC_SUPPORTED_CDS_MODES = "cds-mode-values";
private static final String KEY_QC_SUPPORTED_VIDEO_CDS_MODES = "video-cds-mode-values";
private static final String KEY_QC_SUPPORTED_TNR_MODES = "tnr-mode-values";
@@ -148,6 +149,7 @@ public class CameraSettings {
public static final String KEY_QC_FSSR = "FSSR";
public static final String KEY_QC_TP = "true-portrait";
public static final String KEY_QC_MULTI_TOUCH_FOCUS = "multi-touch-focus";
+ public static final String KEY_QC_STILL_MORE = "still-more";
public static final String KEY_QC_FACE_RECOGNITION = "face-recognition";
public static final String KEY_QC_DIS_MODE = "dis";
public static final String KEY_QC_CDS_MODE = "cds-mode";
@@ -229,6 +231,14 @@ public class CameraSettings {
public static final String KEY_QC_SUPPORTED_MANUAL_EXPOSURE_MODES = "manual-exposure-modes";
public static final String KEY_QC_SUPPORTED_MANUAL_WB_MODES = "manual-wb-modes";
+ public static final String KEY_TS_MAKEUP_UILABLE = "pref_camera_tsmakeup_key";
+ public static final String KEY_TS_MAKEUP_PARAM = "tsmakeup"; // on/of
+ public static final String KEY_TS_MAKEUP_PARAM_WHITEN = "tsmakeup_whiten"; // 0~100
+ public static final String KEY_TS_MAKEUP_PARAM_CLEAN = "tsmakeup_clean"; // 0~100
+ public static final String KEY_TS_MAKEUP_LEVEL = "pref_camera_tsmakeup_level_key";
+ public static final String KEY_TS_MAKEUP_LEVEL_WHITEN = "pref_camera_tsmakeup_whiten";
+ public static final String KEY_TS_MAKEUP_LEVEL_CLEAN = "pref_camera_tsmakeup_clean";
+
public static final String EXPOSURE_DEFAULT_VALUE = "0";
public static final int CURRENT_VERSION = 5;
@@ -289,15 +299,12 @@ public class CameraSettings {
return group;
}
- public static String getSupportedHighestVideoQuality(int cameraId,
- String defaultQuality,Parameters parameters) {
+ public static String getSupportedHighestVideoQuality(
+ int cameraId, Parameters parameters) {
// When launching the camera app first time, we will set the video quality
// to the first one (i.e. highest quality) in the supported list
List<String> supported = getSupportedVideoQualities(cameraId,parameters);
- if (supported == null) {
- Log.e(TAG, "No supported video quality is found");
- return defaultQuality;
- }
+ assert (supported != null) : "No supported video quality is found";
return supported.get(0);
}
@@ -439,6 +446,7 @@ public class CameraSettings {
str += ',' + params.get(KEY_QC_SUPPORTED_MTF_MODES);
str += ',' + mContext.getString(R.string.pref_camera_advanced_feature_default);
str += ',' + params.get(KEY_QC_SUPPORTED_RE_FOCUS_MODES);
+ str += ',' + params.get(KEY_QC_SUPPORTED_STILL_MORE_MODES);
return split(str);
}
@@ -498,6 +506,14 @@ public class CameraSettings {
return split(str);
}
+ public static List<String> getSupportedStillMoreModes(Parameters params) {
+ String str = params.get(KEY_QC_SUPPORTED_STILL_MORE_MODES);
+ if (str == null) {
+ return null;
+ }
+ return split(str);
+ }
+
// Splits a comma delimited string to an ArrayList of String.
// Return null if the passing string is null or the size is 0.
private static ArrayList<String> split(String str) {
diff --git a/src/com/android/camera/ListPreference.java b/src/com/android/camera/ListPreference.java
index b856d460e..c79d18c1a 100644
--- a/src/com/android/camera/ListPreference.java
+++ b/src/com/android/camera/ListPreference.java
@@ -135,6 +135,11 @@ public class ListPreference extends CameraPreference {
persistStringValue(value);
}
+ public void setMakeupSeekBarValue(String value) {
+ mValue = value;
+ persistStringValue(value);
+ }
+
public void setValueIndex(int index) {
setValue(mEntryValues[index].toString());
}
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index be3a02c1f..1c8815845 100644
--- a/src/com/android/camera/PhotoMenu.java
+++ b/src/com/android/camera/PhotoMenu.java
@@ -20,12 +20,18 @@ import java.util.Locale;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
+import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.hardware.Camera.Parameters;
import android.graphics.Rect;
+import android.os.Handler;
+import android.os.Message;
import android.preference.PreferenceManager;
+import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -42,6 +48,7 @@ import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
+import com.android.camera.TsMakeupManager.MakeupLevelListener;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CountdownTimerPopup;
import com.android.camera.ui.ListSubMenu;
@@ -63,6 +70,7 @@ public class PhotoMenu extends MenuController
private static String TAG = "PhotoMenu";
private final String mSettingOff;
+ private final String mSettingOn;
private String[] mOtherKeys1;
private String[] mOtherKeys2;
@@ -73,14 +81,17 @@ public class PhotoMenu extends MenuController
private static final int POPUP_SECOND_LEVEL = 2;
private static final int POPUP_IN_ANIMATION_SLIDE = 3;
private static final int POPUP_IN_ANIMATION_FADE = 4;
+ private static final int POPUP_IN_MAKEUP = 5;
private static final int PREVIEW_MENU_NONE = 0;
private static final int PREVIEW_MENU_IN_ANIMATION = 1;
private static final int PREVIEW_MENU_ON = 2;
private static final int MODE_SCENE = 0;
private static final int MODE_FILTER = 1;
+ private static final int MODE_MAKEUP = 2;
private static final int DEVELOPER_MENU_TOUCH_COUNT = 10;
private int mSceneStatus;
private View mHdrSwitcher;
+ private View mTsMakeupSwitcher;
private View mFrontBackSwitcher;
private View mSceneModeSwitcher;
private View mFilterModeSwitcher;
@@ -96,16 +107,23 @@ public class PhotoMenu extends MenuController
private static final int ANIMATION_DURATION = 300;
private static final int CLICK_THRESHOLD = 200;
private int previewMenuSize;
+ private TsMakeupManager mTsMakeupManager;
+ private MakeupLevelListener mMakeupListener;
+ private MakeupHandler mHandler = new MakeupHandler();
+ private static final int MAKEUP_MESSAGE_ID = 0;
- public PhotoMenu(CameraActivity activity, PhotoUI ui) {
+ public PhotoMenu(CameraActivity activity, PhotoUI ui, MakeupLevelListener makeupListener) {
super(activity);
mUI = ui;
mSettingOff = activity.getString(R.string.setting_off_value);
+ mSettingOn = activity.getString(R.string.setting_on_value);
mActivity = activity;
mFrontBackSwitcher = ui.getRootView().findViewById(R.id.front_back_switcher);
mHdrSwitcher = ui.getRootView().findViewById(R.id.hdr_switcher);
+ mTsMakeupSwitcher = ui.getRootView().findViewById(R.id.ts_makeup_switcher);
mSceneModeSwitcher = ui.getRootView().findViewById(R.id.scene_mode_switcher);
mFilterModeSwitcher = ui.getRootView().findViewById(R.id.filter_mode_switcher);
+ mMakeupListener = makeupListener;
}
public void initialize(PreferenceGroup group) {
@@ -118,20 +136,38 @@ public class PhotoMenu extends MenuController
Locale locale = res.getConfiguration().locale;
// The order is from left to right in the menu.
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ if(mTsMakeupManager != null) {
+ mTsMakeupManager.removeAllViews();
+ mTsMakeupManager = null;
+ }
+ if(mTsMakeupManager == null) {
+ mTsMakeupManager = new TsMakeupManager(mActivity, this, mUI, mPreferenceGroup, mTsMakeupSwitcher);
+ mTsMakeupManager.setMakeupLevelListener(mMakeupListener);
+ }
+ }
+
initSceneModeButton(mSceneModeSwitcher);
initFilterModeButton(mFilterModeSwitcher);
- mHdrSwitcher.setVisibility(View.INVISIBLE);
-
- mFrontBackSwitcher.setVisibility(View.INVISIBLE);
- // HDR.
- if (group.findPreference(CameraSettings.KEY_CAMERA_HDR) != null) {
- mHdrSwitcher.setVisibility(View.VISIBLE);
- initSwitchItem(CameraSettings.KEY_CAMERA_HDR, mHdrSwitcher);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ initMakeupModeButton(mTsMakeupSwitcher);
} else {
mHdrSwitcher.setVisibility(View.INVISIBLE);
}
+ mFrontBackSwitcher.setVisibility(View.INVISIBLE);
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ // HDR.
+ if (group.findPreference(CameraSettings.KEY_CAMERA_HDR) != null) {
+ mHdrSwitcher.setVisibility(View.VISIBLE);
+ initSwitchItem(CameraSettings.KEY_CAMERA_HDR, mHdrSwitcher);
+ } else {
+ mHdrSwitcher.setVisibility(View.INVISIBLE);
+ }
+ }
+
mOtherKeys1 = new String[] {
+ CameraSettings.KEY_FLASH_MODE,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_PICTURE_SIZE,
CameraSettings.KEY_JPEG_QUALITY,
@@ -142,12 +178,12 @@ public class PhotoMenu extends MenuController
CameraSettings.KEY_ISO,
CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
- CameraSettings.KEY_FLASH_MODE,
CameraSettings.KEY_FOCUS_MODE,
CameraSettings.KEY_REDEYE_REDUCTION
};
mOtherKeys2 = new String[] {
+ CameraSettings.KEY_FLASH_MODE,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_PICTURE_SIZE,
CameraSettings.KEY_JPEG_QUALITY,
@@ -158,7 +194,6 @@ public class PhotoMenu extends MenuController
CameraSettings.KEY_ISO,
CameraSettings.KEY_EXPOSURE,
CameraSettings.KEY_WHITE_BALANCE,
- CameraSettings.KEY_FLASH_MODE,
CameraSettings.KEY_FOCUS_MODE,
CameraSettings.KEY_REDEYE_REDUCTION,
CameraSettings.KEY_AUTO_HDR,
@@ -189,6 +224,18 @@ public class PhotoMenu extends MenuController
initSwitchItem(CameraSettings.KEY_CAMERA_ID, mFrontBackSwitcher);
}
+ protected class MakeupHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MAKEUP_MESSAGE_ID:
+ mTsMakeupManager.showMakeupView();
+ mUI.adjustOrientation();
+ break;
+ }
+ }
+ }
+
@Override
// Hit when an item in a popup gets selected
public void onListPrefChanged(ListPreference pref) {
@@ -198,6 +245,14 @@ public class PhotoMenu extends MenuController
}
public boolean handleBackKey() {
+ if(TsMakeupManager.HAS_TS_MAKEUP && mTsMakeupManager.isShowMakeup()) {
+ mTsMakeupManager.dismissMakeupUI();
+ closeMakeupMode(true);
+ mTsMakeupManager.resetMakeupUIStatus();
+ mPopupStatus = POPUP_NONE;
+ mPreviewMenuStatus = PREVIEW_MENU_NONE;
+ return true;
+ }
if (mPreviewMenuStatus == PREVIEW_MENU_ON) {
animateSlideOut(mPreviewMenu);
return true;
@@ -217,6 +272,10 @@ public class PhotoMenu extends MenuController
mUI.removeSceneModeMenu();
}
+ public void closeMakeupMode(boolean isMakeup) {
+ mUI.removeSceneModeMenu();
+ }
+
public void tryToCloseSubList() {
if (mListMenu != null)
((ListMenu) mListMenu).resetHighlight();
@@ -377,6 +436,13 @@ public class PhotoMenu extends MenuController
}
public void animateSlideOutPreviewMenu() {
+ if(TsMakeupManager.HAS_TS_MAKEUP && mTsMakeupManager.isShowMakeup()) {
+ mPreviewMenuStatus = PREVIEW_MENU_NONE;
+ mTsMakeupManager.dismissMakeupUI();
+ closeMakeupMode(true);
+ mTsMakeupManager.resetMakeupUIStatus();
+ }
+
if (mPreviewMenu == null)
return;
animateSlideOut(mPreviewMenu);
@@ -599,8 +665,10 @@ public class PhotoMenu extends MenuController
mActivity.getString(R.string.pref_camera_advanced_feature_default));
popup1.setPreferenceEnabled(CameraSettings.KEY_ADVANCED_FEATURES, false);
- if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
- buttonSetEnabled(mHdrSwitcher, true);
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
+ buttonSetEnabled(mHdrSwitcher, true);
+ }
}
} else {
if ((advancedFeatures != null) && (advancedFeatures.equals(ubiFocusOn) ||
@@ -620,12 +688,16 @@ public class PhotoMenu extends MenuController
popup1.setPreferenceEnabled(CameraSettings.KEY_SCENE_MODE, false);
setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff);
- if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
- buttonSetEnabled(mHdrSwitcher, false);
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
+ buttonSetEnabled(mHdrSwitcher, false);
+ }
}
} else {
- if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
- buttonSetEnabled(mHdrSwitcher, true);
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ if (mHdrSwitcher.getVisibility() == View.VISIBLE) {
+ buttonSetEnabled(mHdrSwitcher, true);
+ }
}
}
}
@@ -686,6 +758,101 @@ public class PhotoMenu extends MenuController
});
}
+ public void initMakeupModeButton(View button) {
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ return;
+ }
+ button.setVisibility(View.INVISIBLE);
+ final IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE);
+ if (pref == null)
+ return;
+
+ int[] iconIds = pref.getLargeIconIds();
+ int resid = -1;
+ int index = pref.findIndexOfValue(pref.getValue());
+ if (!pref.getUseSingleIcon() && iconIds != null) {
+ // Each entry has a corresponding icon.
+ resid = iconIds[index];
+ } else {
+ // The preference only has a single icon to represent it.
+ resid = pref.getSingleIcon();
+ }
+ ImageView iv = (ImageView) mTsMakeupSwitcher;
+ iv.setImageResource(resid);
+
+ button.setVisibility(View.VISIBLE);
+
+ String makeupOn = pref.getValue();
+ Log.d(TAG, "PhotoMenu.initMakeupModeButton():current init makeupOn is " + makeupOn);
+
+ button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ ListPreference faceDetectPref = mPreferenceGroup.findPreference(CameraSettings.KEY_FACE_DETECTION);
+ String faceDetection = (faceDetectPref != null) ? faceDetectPref.getValue() : null;
+ Log.d(TAG, "initMakeupModeButton().onClick(): faceDetection is " + faceDetection);
+ if ((faceDetection != null) && Parameters.FACE_DETECTION_OFF.equals(faceDetection)) {
+ showAlertDialog(faceDetectPref);
+ } else {
+ toggleMakeupSettings();
+ }
+ }
+ });
+ }
+
+ private void initMakeupMenu() {
+ if(!TsMakeupManager.HAS_TS_MAKEUP) {
+ return;
+ }
+ mPopupStatus = POPUP_NONE;
+ mHandler.removeMessages(MAKEUP_MESSAGE_ID);
+ mSceneStatus = MODE_MAKEUP;
+ mPreviewMenuStatus = PREVIEW_MENU_ON;
+ mHandler.sendEmptyMessageDelayed(MAKEUP_MESSAGE_ID, ANIMATION_DURATION);
+ }
+
+ private void showAlertDialog(final ListPreference faceDetectPref) {
+ if(mActivity.isFinishing()) {
+ return;
+ }
+ new AlertDialog.Builder(mActivity)
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .setMessage(R.string.text_tsmakeup_alert_msg)
+ .setPositiveButton(R.string.text_tsmakeup_alert_continue, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ toggleMakeupSettings();
+
+ faceDetectPref.setValue(Parameters.FACE_DETECTION_ON);
+ onSettingChanged(faceDetectPref);
+ }
+ })
+ .setNegativeButton(R.string.text_tsmakeup_alert_quit, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ }
+ })
+ .show();
+ }
+
+ private void toggleMakeupSettings() {
+ mUI.hideUI();
+ initMakeupMenu();
+ }
+
+ private void closeMakeup() {
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ if(mTsMakeupManager.isShowMakeup()) {
+ mTsMakeupManager.hideMakeupUI();
+ closeMakeupMode(false);
+ mPreviewMenuStatus = PREVIEW_MENU_NONE;
+ } else {
+ mTsMakeupManager.hideMakeupUI();
+ }
+ }
+ }
+
public void initSceneModeButton(View button) {
button.setVisibility(View.INVISIBLE);
final IconListPreference pref = (IconListPreference) mPreferenceGroup
@@ -848,6 +1015,8 @@ public class PhotoMenu extends MenuController
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
+ closeMakeup();
+
addFilterMode();
ViewGroup menuLayout = mUI.getPreviewMenuLayout();
if (menuLayout != null) {
@@ -961,14 +1130,24 @@ public class PhotoMenu extends MenuController
}
public void openFirstLevel() {
- if (isMenuBeingShown() || CameraControls.isAnimating())
+ if (isMenuBeingShown() || CameraControls.isAnimating()) {
return;
+ }
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ if(mTsMakeupManager.isShowMakeup()) {
+ mTsMakeupManager.dismissMakeupUI();
+ closeMakeupMode(false);
+ mPreviewMenuStatus = PREVIEW_MENU_NONE;
+ } else {
+ mTsMakeupManager.dismissMakeupUI();
+ }
+ mTsMakeupManager.resetMakeupUIStatus();
+ }
if (mListMenu == null || mPopupStatus != POPUP_FIRST_LEVEL) {
initializePopup();
mPopupStatus = POPUP_FIRST_LEVEL;
}
mUI.showPopup(mListMenu, 1, true);
-
}
public void popupDismissed(boolean dismissAll) {
@@ -1053,6 +1232,11 @@ public class PhotoMenu extends MenuController
return (key.equals(pref.getKey()) && !value.equals(pref.getValue()));
}
+ // Return true if the preference has the specified key and the value.
+ private static boolean same(ListPreference pref, String key, String value) {
+ return (key.equals(pref.getKey()) && value.equals(pref.getValue()));
+ }
+
public void setPreference(String key, String value) {
ListPreference pref = mPreferenceGroup.findPreference(key);
if (pref != null && !value.equals(pref.getValue())) {
@@ -1065,25 +1249,33 @@ public class PhotoMenu extends MenuController
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.
- if (notSame(pref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)) {
- ListPreference scenePref =
- mPreferenceGroup.findPreference(CameraSettings.KEY_SCENE_MODE);
- if (scenePref != null && notSame(scenePref, CameraSettings.KEY_SCENE_MODE,
- Parameters.SCENE_MODE_AUTO)) {
- RotateTextToast.makeText(mActivity, R.string.hdr_enable_message,
- Toast.LENGTH_LONG).show();
+ if (same(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_HDR)) {
+ ListPreference hdrPref =
+ mPreferenceGroup.findPreference(CameraSettings.KEY_CAMERA_HDR);
+ if (hdrPref != null && same(hdrPref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)) {
+ setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOn);
}
- setPreference(CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO);
- updateSceneModeIcon((IconListPreference) scenePref);
- } else if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)) {
+ } else if (notSame(pref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_HDR)) {
ListPreference hdrPref =
mPreferenceGroup.findPreference(CameraSettings.KEY_CAMERA_HDR);
if (hdrPref != null && notSame(hdrPref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)) {
- RotateTextToast.makeText(mActivity, R.string.scene_enable_message,
- Toast.LENGTH_LONG).show();
+ setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff);
}
- setPreference(CameraSettings.KEY_CAMERA_HDR, mSettingOff);
- } else if (notSame(pref,CameraSettings.KEY_AE_BRACKET_HDR,"Off")) {
+ } else if (same(pref, CameraSettings.KEY_CAMERA_HDR, mSettingOff)) {
+ ListPreference scenePref =
+ mPreferenceGroup.findPreference(CameraSettings.KEY_SCENE_MODE);
+ if (scenePref != null && notSame(scenePref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO)) {
+ setPreference(CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_AUTO);
+ }
+ updateSceneModeIcon((IconListPreference) scenePref);
+ } else if (same(pref, CameraSettings.KEY_CAMERA_HDR, mSettingOn)) {
+ ListPreference scenePref =
+ mPreferenceGroup.findPreference(CameraSettings.KEY_SCENE_MODE);
+ if (scenePref != null && notSame(scenePref, CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_HDR)) {
+ setPreference(CameraSettings.KEY_SCENE_MODE, Parameters.SCENE_MODE_HDR);
+ }
+ updateSceneModeIcon((IconListPreference) scenePref);
+ } else if (notSame(pref,CameraSettings.KEY_AE_BRACKET_HDR,"Off")) {
RotateTextToast.makeText(mActivity,
R.string.flash_aebracket_message,Toast.LENGTH_SHORT).show();
setPreference(CameraSettings.KEY_FLASH_MODE,Parameters.FLASH_MODE_OFF);
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 93aefbe7c..3da138d6a 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -66,6 +66,7 @@ import com.android.camera.CameraManager.CameraPictureCallback;
import com.android.camera.CameraManager.CameraProxy;
import com.android.camera.CameraManager.CameraShutterCallback;
import com.android.camera.PhotoModule.NamedImages.NamedEntity;
+import com.android.camera.TsMakeupManager.MakeupLevelListener;
import com.android.camera.exif.ExifInterface;
import com.android.camera.exif.ExifTag;
import com.android.camera.exif.Rational;
@@ -82,6 +83,7 @@ import android.widget.EditText;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.text.InputType;
+import android.text.TextUtils;
import com.android.internal.util.MemInfoReader;
import android.app.ActivityManager;
@@ -110,7 +112,7 @@ public class PhotoModule
ShutterButton.OnShutterButtonListener,
MediaSaveService.Listener,
OnCountDownFinishedListener,
- SensorEventListener {
+ SensorEventListener, MakeupLevelListener {
private static final String TAG = "CAM_PhotoModule";
@@ -250,6 +252,9 @@ public class PhotoModule
private SoundPool mSoundPool;
private int mRefocusSound;
+ private byte[] mLastJpegData;
+ private int mLastJpegOrientation = 0;
+
private Runnable mDoSnapRunnable = new Runnable() {
@Override
public void run() {
@@ -533,6 +538,9 @@ public class PhotoModule
}
private void onPreviewStarted() {
+ if (mCameraState == SNAPSHOT_IN_PROGRESS) {
+ return;
+ }
mUI.hidePreviewCover();
setCameraState(IDLE);
mFocusManager.onPreviewStarted();
@@ -682,7 +690,7 @@ public class PhotoModule
private void openCameraCommon() {
loadCameraPreferences();
- mUI.onCameraOpened(mPreferenceGroup, mPreferences, mParameters, this);
+ mUI.onCameraOpened(mPreferenceGroup, mPreferences, mParameters, this, this);
if (mIsImageCaptureIntent) {
mUI.overrideSettings(CameraSettings.KEY_CAMERA_HDR_PLUS,
mActivity.getString(R.string.setting_off_value));
@@ -1032,7 +1040,7 @@ public class PhotoModule
@Override
public void onCameraMetaData (byte[] data, android.hardware.Camera camera) {
int metadata[] = new int[3];
- if (data.length <= 12) {
+ if (data.length >= 12) {
for (int i =0;i<3;i++) {
metadata[i] = byteToInt( (byte []) data, i*4);
}
@@ -1311,7 +1319,14 @@ public class PhotoModule
if (mAnimateCapture) {
mUI.animateCapture(jpegData, orientation, mMirror);
}
+ } else {
+ // In long shot mode, we do not want to update the preview thumbnail
+ // for each snapshot, instead, keep the last jpeg data and orientation,
+ // use it to show the final one at the end of long shot.
+ mLastJpegData = jpegData;
+ mLastJpegOrientation = orientation;
}
+
} else {
mJpegImageData = jpegData;
if (!mQuickCapture) {
@@ -1492,6 +1507,10 @@ public class PhotoModule
animateAfterShutter();
}
+ if (mCameraState == LONGSHOT) {
+ mCameraDevice.setLongshot(true);
+ }
+
// Set rotation and gps data.
int orientation = mOrientation;
mJpegRotation = CameraUtil.getJpegRotation(mCameraId, orientation);
@@ -1507,6 +1526,14 @@ public class PhotoModule
mParameters.remove(CameraSettings.KEY_QC_LEGACY_BURST);
}
+ // Unlock AE&AWB, if they continue
+ // to be locked during snapshot, then
+ // side effects could be triggered w.r.t.
+ // flash.
+ mFocusManager.setAeAwbLock(false);
+ setAutoExposureLockIfSupported();
+ setAutoWhiteBalanceLockIfSupported();
+
mCameraDevice.setParameters(mParameters);
mParameters = mCameraDevice.getParameters();
@@ -1675,6 +1702,10 @@ public class PhotoModule
mParameters.get(CameraSettings.KEY_QC_TP);
String multiTouchFocus =
mParameters.get(CameraSettings.KEY_QC_MULTI_TOUCH_FOCUS);
+ String stillMoreOn = mActivity.getString(R.string.
+ pref_camera_advanced_feature_value_stillmore_on);
+ String stillMore =
+ mParameters.get(CameraSettings.KEY_QC_STILL_MORE);
String continuousShot =
mParameters.get("long-shot");
@@ -1703,7 +1734,8 @@ public class PhotoModule
(chromaFlash != null && chromaFlash.equals(chromaFlashOn)) ||
(optiZoom != null && optiZoom.equals(optiZoomOn)) ||
(fssr != null && fssr.equals(fssrOn)) ||
- (truePortrait != null && truePortrait.equals(truPortraitOn))) {
+ (truePortrait != null && truePortrait.equals(truPortraitOn)) ||
+ (stillMore != null && stillMore.equals(stillMoreOn))) {
mSceneMode = sceneMode = Parameters.SCENE_MODE_AUTO;
flashMode = Parameters.FLASH_MODE_OFF;
focusMode = Parameters.FOCUS_MODE_INFINITY;
@@ -1724,10 +1756,10 @@ public class PhotoModule
Toast.LENGTH_LONG).show();
}
- // If scene mode is set, for flash mode, white balance and focus mode
+ // If scene mode is set, for white balance and focus mode
// read settings from preferences so we retain user preferences.
if (!Parameters.SCENE_MODE_AUTO.equals(mSceneMode)) {
- flashMode = mParameters.getFlashMode();
+ flashMode = mParameters.FLASH_MODE_OFF;
String whiteBalance = Parameters.WHITE_BALANCE_AUTO;
focusMode = mFocusManager.getFocusMode();
colorEffect = mParameters.getColorEffect();
@@ -1982,7 +2014,8 @@ public class PhotoModule
if (mCameraDevice == null
|| mPaused || mUI.collapseCameraControls()
|| (mCameraState == SNAPSHOT_IN_PROGRESS)
- || (mCameraState == PREVIEW_STOPPED)) {
+ || (mCameraState == PREVIEW_STOPPED)
+ || (null == mFocusManager)) {
Log.v(TAG, "onShutterButtonFocus error case mCameraState = " + mCameraState
+ "mCameraDevice = " + mCameraDevice + "mPaused =" + mPaused);
return;
@@ -1992,6 +2025,7 @@ public class PhotoModule
if (mCameraState == LONGSHOT) {
mLongshotActive = false;
mCameraDevice.setLongshot(false);
+ mUI.animateCapture(mLastJpegData, mLastJpegOrientation, mMirror);
if (!mFocusManager.isZslEnabled()) {
setupPreview();
} else {
@@ -2024,7 +2058,8 @@ public class PhotoModule
public void onShutterButtonClick() {
if (mPaused || mUI.collapseCameraControls()
|| (mCameraState == SWITCHING_CAMERA)
- || (mCameraState == PREVIEW_STOPPED)) return;
+ || (mCameraState == PREVIEW_STOPPED)
+ || (null == mFocusManager)) return;
// Do not take the picture if there is not enough storage.
if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
@@ -2109,7 +2144,6 @@ public class PhotoModule
return;
}
mLongshotActive = true;
- mCameraDevice.setLongshot(true);
setCameraState(PhotoController.LONGSHOT);
mFocusManager.doSnap();
}
@@ -2547,10 +2581,6 @@ public class PhotoModule
}
}
- public void updatePreviewThumbnail() {
- mUI.updatePreviewThumbnail();
- }
-
private void setDisplayOrientation() {
mDisplayRotation = CameraUtil.getDisplayRotation(mActivity);
mDisplayOrientation = CameraUtil.getDisplayOrientation(mDisplayRotation, mCameraId);
@@ -2604,6 +2634,10 @@ public class PhotoModule
stopPreview();
}
+ if (!mSnapshotOnIdle) {
+ mFocusManager.setAeAwbLock(false); // Unlock AE and AWB.
+ }
+
setCameraParameters(UPDATE_PARAM_ALL);
mCameraDevice.startPreview();
@@ -2617,7 +2651,6 @@ public class PhotoModule
if (CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE.equals(mFocusManager.getFocusMode())) {
mCameraDevice.cancelAutoFocus();
}
- mFocusManager.setAeAwbLock(false); // Unlock AE and AWB.
} else {
mHandler.post(mDoSnapRunnable);
}
@@ -2690,7 +2723,8 @@ public class PhotoModule
String optiZoom,
String fssr,
String truePortrait,
- String multiTouchFocus) {
+ String multiTouchFocus,
+ String stillMore) {
if (CameraUtil.isSupported(ubiFocus,
CameraSettings.getSupportedAFBracketingModes(mParameters))) {
mParameters.set(CameraSettings.KEY_QC_AF_BRACKETING, ubiFocus);
@@ -2719,6 +2753,10 @@ public class PhotoModule
CameraSettings.getSupportedMultiTouchFocusModes(mParameters))) {
mParameters.set(CameraSettings.KEY_QC_MULTI_TOUCH_FOCUS, multiTouchFocus);
}
+ if (CameraUtil.isSupported(stillMore,
+ CameraSettings.getSupportedStillMoreModes(mParameters))) {
+ mParameters.set(CameraSettings.KEY_QC_STILL_MORE, stillMore);
+ }
}
/** This can run on a background thread, so don't do UI updates here.*/
@@ -2966,6 +3004,8 @@ public class PhotoModule
pref_camera_advanced_feature_value_trueportrait_off);
String multiTouchFocusOff = mActivity.getString(R.string.
pref_camera_advanced_feature_value_multi_touch_focus_off);
+ String stillMoreOff = mActivity.getString(R.string.
+ pref_camera_advanced_feature_value_stillmore_off);
if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_ubifocus_on))) {
@@ -2975,7 +3015,8 @@ public class PhotoModule
optiZoomOff,
fssrOff,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_chromaflash_on))) {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -2984,7 +3025,8 @@ public class PhotoModule
optiZoomOff,
fssrOff,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_refocus_on))) {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -2993,7 +3035,8 @@ public class PhotoModule
optiZoomOff,
fssrOff,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
mRefocus = true;
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_optizoom_on))) {
@@ -3003,7 +3046,8 @@ public class PhotoModule
advancedFeature,
fssrOff,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_FSSR_on))) {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -3012,7 +3056,8 @@ public class PhotoModule
optiZoomOff,
advancedFeature,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_trueportrait_on))) {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -3021,7 +3066,8 @@ public class PhotoModule
optiZoomOff,
fssrOff,
advancedFeature,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
} else if (advancedFeature.equals(mActivity.getString(R.string.
pref_camera_advanced_feature_value_multi_touch_focus_on))) {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -3030,6 +3076,17 @@ public class PhotoModule
optiZoomOff,
fssrOff,
truePortraitOff,
+ advancedFeature,
+ stillMoreOff);
+ } else if (advancedFeature.equals(mActivity.getString(R.string.
+ pref_camera_advanced_feature_value_stillmore_on))) {
+ qcomUpdateAdvancedFeatures(ubiFocusOff,
+ chromaFlashOff,
+ reFocusOff,
+ optiZoomOff,
+ fssrOff,
+ truePortraitOff,
+ multiTouchFocusOff,
advancedFeature);
} else {
qcomUpdateAdvancedFeatures(ubiFocusOff,
@@ -3038,7 +3095,8 @@ public class PhotoModule
optiZoomOff,
fssrOff,
truePortraitOff,
- multiTouchFocusOff);
+ multiTouchFocusOff,
+ stillMoreOff);
}
}
// Set auto exposure parameter.
@@ -3499,10 +3557,9 @@ public class PhotoModule
}
} else {
mFocusManager.overrideFocusMode(mParameters.getFocusMode());
- if (hdrOn)
+ if (CameraUtil.isSupported(Parameters.FLASH_MODE_OFF,
+ mParameters.getSupportedFlashModes())) {
mParameters.setFlashMode(Parameters.FLASH_MODE_OFF);
- else {
- mParameters.setFlashMode(Parameters.FLASH_MODE_AUTO);
}
if (CameraUtil.isSupported(Parameters.WHITE_BALANCE_AUTO,
mParameters.getSupportedWhiteBalance())) {
@@ -3513,6 +3570,21 @@ public class PhotoModule
if (mContinuousFocusSupported && ApiHelper.HAS_AUTO_FOCUS_MOVE_CALLBACK) {
updateAutoFocusMoveCallback();
}
+
+ String makeupParamValue = mPreferences.getString(CameraSettings.KEY_TS_MAKEUP_UILABLE,
+ mActivity.getString(R.string.pref_camera_tsmakeup_default));
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM, makeupParamValue);
+ Log.v(TAG,"updateCameraParametersPreference(): TSMakeup " + CameraSettings.KEY_TS_MAKEUP_PARAM +" value = " + makeupParamValue);
+
+ if(TsMakeupManager.MAKEUP_ON.equals(makeupParamValue)) {
+ String makeupWhitenValue = mPreferences.getString(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN,
+ mActivity.getString(R.string.pref_camera_tsmakeup_level_default));
+ String makeupCleanValue = mPreferences.getString(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN,
+ mActivity.getString(R.string.pref_camera_tsmakeup_level_default));
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_WHITEN, makeupWhitenValue);
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_CLEAN, makeupCleanValue);
+ }
+
//QCom related parameters updated here.
qcomUpdateCameraParametersPreference();
return doGcamModeSwitch;
@@ -4301,6 +4373,73 @@ public class PhotoModule
public boolean isRefocus() {
return mLastPhotoTakenWithRefocus;
}
+
+ @Override
+ public void onMakeupLevel(String key, String value) {
+ Log.d(TAG, "PhotoModule.onMakeupLevel(): key is " + key + ", value is " + value);
+
+ if(TextUtils.isEmpty(value)) {
+ return;
+ }
+
+ String prefValue = TsMakeupManager.MAKEUP_ON;
+ if(TsMakeupManager.MAKEUP_OFF.equals(value)) {
+ prefValue = TsMakeupManager.MAKEUP_OFF;
+ }
+
+ Log.d(TAG, "onMakeupLevel(): prefValue is " + prefValue);
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM, prefValue);
+
+ if(!TextUtils.isDigitsOnly(value)) {
+ if(TsMakeupManager.MAKEUP_NONE.equals(value)) {
+ ListPreference pref = mPreferenceGroup.findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN);
+ if(pref != null) {
+ String whitenValue = pref.getValue();
+ if(TextUtils.isEmpty(whitenValue)) {
+ whitenValue = mActivity.getString(R.string.pref_camera_tsmakeup_level_default);
+ }
+ pref.setMakeupSeekBarValue(whitenValue);
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_WHITEN, Integer.parseInt(whitenValue));
+ }
+
+ pref = mPreferenceGroup.findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN);
+ if(pref != null) {
+ String cleanValue = pref.getValue();
+ if(TextUtils.isEmpty(cleanValue)) {
+ cleanValue = mActivity.getString(R.string.pref_camera_tsmakeup_level_default);
+ }
+ pref.setMakeupSeekBarValue(cleanValue);
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_CLEAN, Integer.parseInt(cleanValue));
+ }
+ }
+ } else {
+ if(CameraSettings.KEY_TS_MAKEUP_LEVEL.equals(key)) {
+ if(mParameters != null) {
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_WHITEN, Integer.parseInt(value));
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_CLEAN, Integer.parseInt(value));
+ }
+ ListPreference pref = mPreferenceGroup.findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN);
+ if(pref != null) {
+ pref.setMakeupSeekBarValue(value);
+ }
+ pref = mPreferenceGroup.findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN);
+ if(pref != null) {
+ pref.setMakeupSeekBarValue(value);
+ }
+ } else if(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN.equals(key)) {
+ if(mParameters != null) {
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_WHITEN, Integer.parseInt(value));
+ }
+ } else if(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN.equals(key)) {
+ if(mParameters != null) {
+ mParameters.set(CameraSettings.KEY_TS_MAKEUP_PARAM_CLEAN, Integer.parseInt(value));
+ }
+ }
+ }
+
+ mCameraDevice.setParameters(mParameters);
+ mParameters = mCameraDevice.getParameters();
+ }
}
/* Below is no longer needed, except to get rid of compile error
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 0df2c30ca..65a822d74 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -54,9 +54,9 @@ import android.widget.PopupWindow;
import android.widget.Toast;
import android.graphics.drawable.AnimationDrawable;
-import com.android.camera.CameraActivity.UpdatePreviewThumbnail;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.FocusOverlayManager.FocusUI;
+import com.android.camera.TsMakeupManager.MakeupLevelListener;
import com.android.camera.ui.AbstractSettingPopup;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraRootView;
@@ -130,7 +130,7 @@ public class PhotoUI implements PieListener,
private float mSurfaceTextureUncroppedWidth;
private float mSurfaceTextureUncroppedHeight;
- private ImageView mPreviewThumb;
+ private ImageView mThumbnail;
private View mFlashOverlay;
private SurfaceTextureSizeChangedListener mSurfaceTextureSizeListener;
@@ -145,6 +145,7 @@ public class PhotoUI implements PieListener,
private RotateLayout mMenuLayout;
private RotateLayout mSubMenuLayout;
private LinearLayout mPreviewMenuLayout;
+ private LinearLayout mMakeupMenuLayout;
private boolean mUIhidden = false;
private int mPreviewOrientation = -1;
@@ -229,8 +230,6 @@ public class PhotoUI implements PieListener,
@Override
protected void onPostExecute(Bitmap bitmap) {
- mPreviewThumb.setImageBitmap(bitmap);
- updatePreviewThumbnail(bitmap);
}
}
@@ -309,24 +308,6 @@ public class PhotoUI implements PieListener,
mCameraControls.setMargins(mTopMargin, mBottomMargin);
}
- public void updatePreviewThumbnail() {
- mPreviewThumb.setVisibility(View.VISIBLE);
- Bitmap bitmap = mActivity.getPreviewThumbBitmap();
- if (bitmap != null) {
- mPreviewThumb.setImageBitmap(bitmap);
- }
- else {
- UpdatePreviewThumbnail task = mActivity.new UpdatePreviewThumbnail(mPreviewThumb);
- task.execute();
- }
- }
-
- public void updatePreviewThumbnail(Bitmap bitmap) {
- mPreviewThumb.setVisibility(View.VISIBLE);
- mPreviewThumb.setImageBitmap(bitmap);
- mActivity.setPreviewThumbnailBitmap(bitmap);
- }
-
public void setDownFactor(int factor) {
mDownSampleFactor = factor;
}
@@ -359,7 +340,7 @@ public class PhotoUI implements PieListener,
float scaledTextureWidth, scaledTextureHeight;
int rotation = CameraUtil.getDisplayRotation(mActivity);
if (mScreenRatio == CameraUtil.RATIO_16_9
- && CameraUtil.determineRatio(ratio) == CameraUtil.RATIO_4_3) {
+ && CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) {
int l = (mTopMargin + mBottomMargin) * 4;
int s = l * 9 / 16;
switch (rotation) {
@@ -472,7 +453,7 @@ public class PhotoUI implements PieListener,
// Re-apply transform matrix for new surface texture
setTransformMatrix(mPreviewWidth, mPreviewHeight);
}
- updatePreviewThumbnail();
+ mActivity.updateThumbnail(mThumbnail);
}
@Override
@@ -492,7 +473,7 @@ public class PhotoUI implements PieListener,
}
public void onCameraOpened(PreferenceGroup prefGroup, ComboPreferences prefs,
- Camera.Parameters params, OnPreferenceChangedListener listener) {
+ Camera.Parameters params, OnPreferenceChangedListener listener, MakeupLevelListener makeupListener) {
if (mPieRenderer == null) {
mPieRenderer = new PieRenderer(mActivity);
mPieRenderer.setPieListener(this);
@@ -500,7 +481,7 @@ public class PhotoUI implements PieListener,
}
if (mMenu == null) {
- mMenu = new PhotoMenu(mActivity, this);
+ mMenu = new PhotoMenu(mActivity, this, makeupListener);
mMenu.setListener(listener);
}
mMenu.initialize(prefGroup);
@@ -529,8 +510,7 @@ public class PhotoUI implements PieListener,
public void animateCapture(final byte[] jpegData, int orientation, boolean mirror) {
// Decode jpeg byte array and then animate the jpeg
- DecodeTask task = new DecodeTask(jpegData, orientation, mirror);
- task.execute();
+ mActivity.updateThumbnail(jpegData);
}
public void showRefocusToast(boolean show) {
@@ -549,8 +529,8 @@ public class PhotoUI implements PieListener,
}
public void initializeControlByIntent() {
- mPreviewThumb = (ImageView) mRootView.findViewById(R.id.preview_thumb);
- mPreviewThumb.setOnClickListener(new OnClickListener() {
+ mThumbnail = (ImageView) mRootView.findViewById(R.id.preview_thumb);
+ mThumbnail.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!CameraControls.isAnimating())
@@ -820,16 +800,27 @@ public class PhotoUI implements PieListener,
return mPreviewMenuLayout;
}
+ public void setMakeupMenuLayout(LinearLayout layout) {
+ mMakeupMenuLayout = layout;
+ }
+
public void showPopup(ListView popup, int level, boolean animate) {
+ FrameLayout.LayoutParams params;
hideUI();
popup.setVisibility(View.VISIBLE);
if (level == 1) {
if (mMenuLayout == null) {
mMenuLayout = new RotateLayout(mActivity, null);
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ params = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.LEFT | Gravity.TOP);
+ } else {
+ params = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.RIGHT | Gravity.TOP);
+ }
mMenuLayout.setLayoutParams(params);
((ViewGroup) mRootView).addView(mMenuLayout);
}
@@ -841,10 +832,15 @@ public class PhotoUI implements PieListener,
mSubMenuLayout = new RotateLayout(mActivity, null);
((ViewGroup) mRootView).addView(mSubMenuLayout);
}
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
-
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ params = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.LEFT | Gravity.TOP);
+ } else {
+ params = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.RIGHT | Gravity.TOP);
+ }
int screenHeight = (mOrientation == 0 || mOrientation == 180)
? mRootView.getHeight() : mRootView.getWidth();
int height = ((ListSubMenu) popup).getPreCalculatedHeight();
@@ -1277,9 +1273,33 @@ public class PhotoUI implements PieListener,
}
}
}
+ if(mMakeupMenuLayout != null) {
+ View view = mMakeupMenuLayout.getChildAt(0);
+ if(view instanceof RotateLayout) {
+ for(int i = mMakeupMenuLayout.getChildCount() -1; i >= 0; --i) {
+ RotateLayout l = (RotateLayout) mMakeupMenuLayout.getChildAt(i);
+ l.setOrientation(orientation, animation);
+ }
+ } else {
+ ViewGroup vg = (ViewGroup) mMakeupMenuLayout.getChildAt(1);
+ if(vg != null) {
+ for (int i = vg.getChildCount() - 1; i >= 0; --i) {
+ ViewGroup vewiGroup = (ViewGroup) vg.getChildAt(i);
+ if(vewiGroup instanceof RotateLayout) {
+ RotateLayout l = (RotateLayout) vewiGroup;
+ l.setOrientation(orientation, animation);
+ }
+ }
+ }
+ }
+
+ }
if (mCountDownView != null)
mCountDownView.setOrientation(orientation);
RotateTextToast.setOrientation(orientation);
+ if (mFaceView != null) {
+ mFaceView.setDisplayRotation(orientation);
+ }
}
public int getOrientation() {
diff --git a/src/com/android/camera/TsMakeupManager.java b/src/com/android/camera/TsMakeupManager.java
new file mode 100644
index 000000000..db3505b45
--- /dev/null
+++ b/src/com/android/camera/TsMakeupManager.java
@@ -0,0 +1,476 @@
+/*
+* Copyright (C) 2014,2015 Thundersoft Corporation
+* All rights Reserved
+*
+* 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.
+*/
+
+package com.android.camera;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.Display;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.SeekBar;
+import android.widget.TextView;
+import android.widget.LinearLayout.LayoutParams;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+
+import com.android.camera.ui.RotateLayout;
+import com.android.camera.util.CameraUtil;
+
+import org.codeaurora.snapcam.R;
+
+public class TsMakeupManager implements OnSeekBarChangeListener {
+ private static final String TAG = "TsMakeupManager";
+ private PhotoUI mUI;
+ private PhotoMenu mMenu;
+ private CameraActivity mActivity;
+ private PreferenceGroup mPreferenceGroup;
+ private View mTsMakeupSwitcher;
+
+ private RelativeLayout mMakeupLayoutRoot;
+ private LinearLayout mMakeupLevelRoot;
+ private LinearLayout mMakeupSingleRoot;
+
+ public static final String MAKEUP_ON = "On";
+ public static final String MAKEUP_OFF = "Off";
+ public static final String MAKEUP_NONE = "none";
+
+ private static final int MODE_NONE = 0;
+ private static final int MODE_WHITEN = 1;
+ private static final int MODE_CLEAN = 2;
+ private int mMode = MODE_NONE;
+ private int mSingleSelectedIndex = MODE_NONE;
+
+ private static final int MAKEUP_UI_STATUS_NONE = 0;
+ private static final int MAKEUP_UI_STATUS_ON = 1;
+ private static final int MAKEUP_UI_STATUS_OFF = 2;
+ private static final int MAKEUP_UI_STATUS_DISMISS = 3;
+ private int mMakeupUIStatus = MAKEUP_UI_STATUS_NONE;
+
+ private static final int CLICK_THRESHOLD = 200;
+
+ public static final boolean HAS_TS_MAKEUP = android.os.SystemProperties.getBoolean("persist.ts.rtmakeup", false);
+
+ private MakeupLevelListener mMakeupLevelListener;
+ interface MakeupLevelListener {
+ void onMakeupLevel(String key, String value);
+ }
+
+ public void setMakeupLevelListener(MakeupLevelListener l) {
+ mMakeupLevelListener = l;
+ }
+
+ public TsMakeupManager(CameraActivity activity, PhotoMenu menu, PhotoUI ui, PreferenceGroup preferenceGroup, View makeupSwitcher) {
+ mActivity = activity;
+ mUI = ui;
+ mMenu = menu;
+ mPreferenceGroup = preferenceGroup;
+ mTsMakeupSwitcher = makeupSwitcher;
+
+ mMakeupLayoutRoot = (RelativeLayout) mUI.getRootView().findViewById(R.id.id_tsmakeup_level_layout_root);
+
+ mMakeupUIStatus = MAKEUP_UI_STATUS_NONE;
+ }
+
+ public View getMakeupLayoutRoot() {
+ return mMakeupLayoutRoot;
+ }
+
+ public boolean isShowMakeup() {
+ return mMakeupLayoutRoot != null && mMakeupLayoutRoot.isShown();
+ }
+
+ public void removeAllViews() {
+ if(mMakeupSingleRoot != null) {
+ mMakeupSingleRoot.removeAllViews();
+ mMakeupSingleRoot = null;
+ }
+ if(mMakeupLevelRoot != null) {
+ mMakeupLevelRoot.removeAllViews();
+ mMakeupLevelRoot = null;
+ }
+ if(mMakeupLayoutRoot != null) {
+ mMakeupLayoutRoot.removeAllViews();
+ }
+ }
+
+ public void dismissMakeupUI() {
+ mMakeupUIStatus = MAKEUP_UI_STATUS_DISMISS;
+ removeAllViews();
+ if(mMakeupLayoutRoot != null) {
+ mMakeupLayoutRoot.setVisibility(View.GONE);
+ }
+ }
+
+ public void resetMakeupUIStatus() {
+ mMakeupUIStatus = MAKEUP_UI_STATUS_NONE;
+ }
+
+ private void changeMakeupIcon(String value) {
+ if( !TextUtils.isEmpty(value) ) {
+ String prefValue = MAKEUP_ON;
+ if(MAKEUP_OFF.equals(value)) {
+ prefValue = MAKEUP_OFF;
+ }
+ final IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE);
+ if(pref == null)
+ return;
+ pref.setValue(prefValue);
+ int index = pref.getCurrentIndex();
+ ImageView iv = (ImageView) mTsMakeupSwitcher;
+ iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]);
+ pref.setMakeupSeekBarValue(prefValue);
+ }
+ }
+
+ public void hideMakeupUI() {
+ final IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE);
+ if(pref == null)
+ return;
+ mMakeupUIStatus = MAKEUP_UI_STATUS_NONE;
+ String tsMakeupOn = pref.getValue();
+ Log.d(TAG, "TsMakeupManager.hideMakeupUI(): tsMakeupOn is " + tsMakeupOn);
+ if(MAKEUP_ON.equals(tsMakeupOn)) {
+ int index = pref.findIndexOfValue(pref.getValue());
+ CharSequence[] values = pref.getEntryValues();
+ index = (index + 1) % values.length;
+ pref.setMakeupSeekBarValue((String)values[index]);
+ ImageView iv = (ImageView) mTsMakeupSwitcher;
+ iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]);
+ mMakeupLevelListener.onMakeupLevel(CameraSettings.KEY_TS_MAKEUP_LEVEL, pref.getValue());
+
+ IconListPreference levelPref = (IconListPreference) mPreferenceGroup
+ .findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL);
+ levelPref.setValueIndex(0); //Turn Off the Makeup feature;
+
+
+ mMakeupLayoutRoot.setVisibility(View.GONE);
+ mMakeupLayoutRoot.removeAllViews();
+ if(mMakeupSingleRoot != null) {
+ mMakeupSingleRoot.removeAllViews();
+ mMakeupSingleRoot = null;
+ }
+ if(mMakeupLevelRoot != null) {
+ mMakeupLevelRoot.removeAllViews();
+ mMakeupLevelRoot = null;
+ }
+ }
+ }
+
+ public void showMakeupView() {
+ mMakeupUIStatus = MAKEUP_UI_STATUS_OFF;
+ mMakeupLayoutRoot.setVisibility(View.GONE);
+ mMakeupLayoutRoot.removeAllViews();
+ if(mMakeupSingleRoot != null) {
+ mMakeupSingleRoot.removeAllViews();
+ mMakeupSingleRoot = null;
+ }
+ if(mMakeupLevelRoot != null) {
+ mMakeupLevelRoot.removeAllViews();
+ mMakeupLevelRoot = null;
+ }
+
+ if(mMakeupSingleRoot != null && mMakeupSingleRoot.getVisibility() == View.VISIBLE) {
+ showSingleView(MAKEUP_NONE);
+ return;
+ }
+
+ if(mMakeupUIStatus == MAKEUP_UI_STATUS_DISMISS)
+ return;
+
+ mMakeupLayoutRoot.setVisibility(View.VISIBLE);
+ final IconListPreference pref = (IconListPreference) mPreferenceGroup
+ .findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL);
+ if (pref == null)
+ return;
+
+ if(mMakeupLevelRoot != null) {
+ mMakeupLevelRoot.removeAllViews();
+ mMakeupLevelRoot = null;
+ }
+ mMakeupLayoutRoot.removeAllViews();
+
+ mMakeupUIStatus = MAKEUP_UI_STATUS_ON;
+
+ int rotation = CameraUtil.getDisplayRotation(mActivity);
+ boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity);
+ if (!mIsDefaultToPortrait) {
+ rotation = (rotation + 90) % 360;
+ }
+ CharSequence[] entries = pref.getEntries();
+ int[] thumbnails = pref.getThumbnailIds();
+
+ WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
+ Display display = wm.getDefaultDisplay();
+ int width = display.getWidth();
+ int height = display.getHeight();
+ Resources r = mActivity.getResources();
+ int margin = (int) (r.getDimension(R.dimen.tsmakeup_mode_paddingBottom));
+ int levelBgSize = (int) (r.getDimension(R.dimen.tsmakeup_mode_level_size));
+
+ Log.d(TAG, "TsMakeupManager.showMakeupView(): rotation is " + rotation + ", WH is (" + width + ", " + height + "), margin is "
+ + margin + ", levelBgSize is " + levelBgSize);
+
+ int gridRes = 0;
+ boolean portrait = (rotation == 0) || (rotation == 180);
+ int size = height;
+ if (portrait) {
+ gridRes = R.layout.ts_makeup_level_view_port;
+ size = width;
+ } else {
+ gridRes = R.layout.ts_makeup_level_view_land;
+ size = height;
+ }
+ int itemWidth = size / entries.length;
+
+ LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ LinearLayout layout = (LinearLayout) inflater.inflate(gridRes, null, false);
+ mMakeupLevelRoot = layout;
+ mUI.setMakeupMenuLayout(layout);
+
+ LinearLayout.LayoutParams params = null;
+ if(portrait) {
+ params = new LayoutParams(itemWidth, itemWidth);
+ params.gravity = Gravity.CENTER_VERTICAL;
+ } else {
+ params = new LayoutParams(itemWidth, itemWidth);
+ params.gravity = Gravity.CENTER_HORIZONTAL;
+ }
+
+ RelativeLayout.LayoutParams rootParams = null;
+ if(rotation == 0) {
+ rootParams = new RelativeLayout.LayoutParams(size, levelBgSize);
+// rootParams.bottomMargin = margin;
+ rootParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+ } else if(rotation == 90) {
+ rootParams = new RelativeLayout.LayoutParams(levelBgSize, size);
+// rootParams.rightMargin = margin;
+ rootParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ } else if(rotation == 180) {
+ rootParams = new RelativeLayout.LayoutParams(size, levelBgSize);
+// rootParams.topMargin = margin;
+ rootParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
+ } else if(rotation == 270) {
+ rootParams = new RelativeLayout.LayoutParams(levelBgSize, size);
+// rootParams.leftMargin = margin;
+ rootParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
+ }
+
+ final View[] views = new View[entries.length];
+ int init = pref.getCurrentIndex();
+ for (int i = 0; i < entries.length; i++) {
+ RotateLayout layout2 = (RotateLayout) inflater.inflate(
+ R.layout.ts_makeup_item_view, null, false);
+
+ ImageView imageView = (ImageView) layout2.findViewById(R.id.image);
+ TextView label = (TextView) layout2.findViewById(R.id.label);
+ final int j = i;
+
+ layout2.setOnTouchListener(new View.OnTouchListener() {
+ private long startTime;
+
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ if (event.getAction() == MotionEvent.ACTION_DOWN) {
+ startTime = System.currentTimeMillis();
+ } else if (event.getAction() == MotionEvent.ACTION_UP) {
+ if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) {
+ pref.setValueIndex(j);
+ changeMakeupIcon(pref.getValue());
+ mMakeupLevelListener.onMakeupLevel(pref.getKey(), pref.getValue());
+ for (View v1 : views) {
+ v1.setSelected(false);
+ }
+ View border = v.findViewById(R.id.image);
+ border.setSelected(true);
+
+ showSingleView(pref.getValue());
+ mUI.adjustOrientation();
+ }
+ }
+ return true;
+ }
+ });
+
+ View border = layout2.findViewById(R.id.image);
+ views[j] = border;
+ if (i == init) {
+ border.setSelected(true);
+ }
+ imageView.setImageResource(thumbnails[i]);
+ label.setText(entries[i]);
+ layout.addView(layout2, params);
+ }
+ mMakeupLayoutRoot.addView(layout, rootParams);
+ }
+
+ private void showSingleView(String value) {
+ if(MAKEUP_NONE.equals(value)) {
+ if(mMakeupSingleRoot != null) {
+ mMakeupSingleRoot.removeAllViews();
+ mMakeupSingleRoot = null;
+ }
+ mMakeupLayoutRoot.removeAllViews();
+ int rotation = CameraUtil.getDisplayRotation(mActivity);
+ boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity);
+ if (!mIsDefaultToPortrait) {
+ rotation = (rotation + 90) % 360;
+ }
+
+ WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE);
+ Display display = wm.getDefaultDisplay();
+ int width = display.getWidth();
+ int height = display.getHeight();
+ Resources r = mActivity.getResources();
+ int margin = (int) (r.getDimension(R.dimen.tsmakeup_mode_paddingBottom));
+ int levelBgSize = (int) (r.getDimension(R.dimen.tsmakeup_mode_level_size));
+
+ Log.d(TAG, "TsMakeupManager.showSingleView(): rotation is " + rotation + ", WH is (" + width + ", " + height + "), margin is "
+ + margin + ", levelBgSize is " + levelBgSize);
+
+ int gridRes = R.layout.ts_makeup_single_level_view_port;
+ int size = width;
+
+ LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ final LinearLayout layout = (LinearLayout) inflater.inflate(gridRes, null, false);
+ mMakeupSingleRoot = layout;
+ mUI.setMakeupMenuLayout(layout);
+
+ RelativeLayout.LayoutParams rootParams = new RelativeLayout.LayoutParams(size, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
+ rootParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
+
+ mMakeupLayoutRoot.addView(layout, rootParams);
+ final SeekBar seekBar = (SeekBar) layout.findViewById(R.id.seekbar_makeup_level);
+ seekBar.setOnSeekBarChangeListener(this);
+ setSingleView(layout);
+
+ mMode = MODE_NONE;
+
+ layout.findViewById(R.id.id_layout_makeup_back).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mMakeupSingleRoot.removeAllViews();
+ mMakeupLayoutRoot.removeView(mMakeupSingleRoot);
+ mMakeupSingleRoot = null;
+
+ mSingleSelectedIndex = MODE_NONE;
+ mMode = MODE_NONE;
+
+ showMakeupView();
+ mUI.adjustOrientation();
+ }
+ });
+
+ layout.findViewById(R.id.id_layout_makeup_whiten).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if(mMode == MODE_WHITEN) {
+ seekBar.setVisibility(View.GONE);
+ mMode = MODE_NONE;
+ return;
+ }
+ mSingleSelectedIndex = MODE_WHITEN;
+ seekBar.setVisibility(View.VISIBLE);
+ seekBar.setProgress(getPrefValue(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN));
+ mMode = MODE_WHITEN;
+ setSingleView(layout);
+ }
+ });
+
+ layout.findViewById(R.id.id_layout_makeup_clean).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if(mMode == MODE_CLEAN) {
+ seekBar.setVisibility(View.GONE);
+ mMode = MODE_NONE;
+ return;
+ }
+ mSingleSelectedIndex = MODE_CLEAN;
+ seekBar.setVisibility(View.VISIBLE);
+ seekBar.setProgress(getPrefValue(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN));
+ mMode = MODE_CLEAN;
+ setSingleView(layout);
+ }
+ });
+ }
+ }
+
+ private void setSingleView(LinearLayout layout) {
+ if(mSingleSelectedIndex == MODE_WHITEN) {
+ layout.findViewById(R.id.id_iv_makeup_whiten).setSelected(true);
+ layout.findViewById(R.id.id_iv_makeup_clean).setSelected(false);
+ } else if(mSingleSelectedIndex == MODE_CLEAN) {
+ layout.findViewById(R.id.id_iv_makeup_whiten).setSelected(false);
+ layout.findViewById(R.id.id_iv_makeup_clean).setSelected(true);
+ }
+ }
+
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ setSeekbarValue(seekBar.getProgress());
+ }
+
+ private void setSeekbarValue(int value) {
+ String key = CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN;
+ if(mMode == MODE_CLEAN) {
+ key = CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN;
+ }
+ Log.d(TAG, "TsMakeupManager.onStopTrackingTouch(): value is " + value + ", key is " + key);
+ setEffectValue(key, String.valueOf(value));
+ }
+
+ private void setEffectValue(String key, String value) {
+ final ListPreference pref = (ListPreference) mPreferenceGroup.findPreference(key);
+ if (pref == null)
+ return;
+
+ pref.setMakeupSeekBarValue(value);
+ mMakeupLevelListener.onMakeupLevel(key, value);
+ }
+
+ private int getPrefValue(String key) {
+ ListPreference pref = mPreferenceGroup.findPreference(key);
+ String value = pref.getValue();
+ Log.d(TAG, "TsMakeupManager.getPrefValue(): value is " + value + ", key is " + key);
+ if(TextUtils.isEmpty(value)) {
+ value = mActivity.getString(R.string.pref_camera_tsmakeup_level_default);
+ }
+ return Integer.parseInt(value);
+ }
+}
diff --git a/src/com/android/camera/VideoMenu.java b/src/com/android/camera/VideoMenu.java
index 63d255715..2706357ef 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -103,15 +103,16 @@ public class VideoMenu extends MenuController
initFilterModeButton(mFilterModeSwitcher);
// settings popup
mOtherKeys1 = new String[] {
+ CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.KEY_VIDEO_DURATION,
CameraSettings.KEY_RECORD_LOCATION,
CameraSettings.KEY_CAMERA_SAVEPATH,
CameraSettings.KEY_WHITE_BALANCE,
- CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE,
- CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE
+ CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE
};
mOtherKeys2 = new String[] {
+ CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
CameraSettings.KEY_VIDEO_QUALITY,
CameraSettings.KEY_VIDEO_DURATION,
CameraSettings.KEY_RECORD_LOCATION,
@@ -119,7 +120,6 @@ public class VideoMenu extends MenuController
CameraSettings.KEY_WHITE_BALANCE,
CameraSettings.KEY_VIDEO_HIGH_FRAME_RATE,
CameraSettings.KEY_SEE_MORE,
- CameraSettings.KEY_VIDEOCAMERA_FLASH_MODE,
CameraSettings.KEY_DIS,
CameraSettings.KEY_VIDEO_EFFECT,
CameraSettings.KEY_VIDEO_TIME_LAPSE_FRAME_INTERVAL,
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 20d6db15a..17b8ce1ce 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -317,6 +317,7 @@ public class VideoModule implements CameraModule,
private boolean mUnsupportedHSRVideoSize = false;
private boolean mUnsupportedHFRVideoCodec = false;
private String mDefaultAntibanding = null;
+ boolean mUnsupportedProfile = false;
// This Handler is used to post message back onto the main thread of the
// application
@@ -779,17 +780,9 @@ public class VideoModule implements CameraModule,
null);
if (videoQuality == null) {
mParameters = mCameraDevice.getParameters();
- String defaultQuality = mActivity.getResources().getString(
- R.string.pref_video_quality_default);
- boolean hasProfile = CamcorderProfile.hasProfile(
- CameraSettings.VIDEO_QUALITY_TABLE.get(defaultQuality));
- if (hasProfile == true){
- videoQuality = defaultQuality;
- } else {
- // check for highest quality if default quality is not supported
- videoQuality = CameraSettings.getSupportedHighestVideoQuality(mCameraId,
- defaultQuality, mParameters);
- }
+ // check for highest quality supported
+ videoQuality = CameraSettings.getSupportedHighestVideoQuality(
+ mCameraId, mParameters);
mPreferences.edit().putString(CameraSettings.KEY_VIDEO_QUALITY, videoQuality);
}
int quality = CameraSettings.VIDEO_QUALITY_TABLE.get(videoQuality);
@@ -824,6 +817,12 @@ public class VideoModule implements CameraModule,
mCaptureTimeLapse = (mTimeBetweenTimeLapseFrameCaptureMs != 0);
// TODO: This should be checked instead directly +1000.
if (mCaptureTimeLapse) quality += 1000;
+ mUnsupportedProfile = false;
+ boolean hasProfile = CamcorderProfile.hasProfile(quality);
+ if (!hasProfile) {
+ mUnsupportedProfile = true;
+ return;
+ }
mProfile = CamcorderProfile.get(mCameraId, quality);
getDesiredPreviewSize();
qcomReadVideoPreferences();
@@ -1529,10 +1528,6 @@ public class VideoModule implements CameraModule,
mCurrentVideoValues = null;
}
- public void updatePreviewThumbnail() {
- mUI.updateWithNewPreviewThumbnail();
- }
-
private void deleteVideoFile(String fileName) {
Log.v(TAG, "Deleting video " + fileName);
File f = new File(fileName);
@@ -1636,6 +1631,13 @@ public class VideoModule implements CameraModule,
mStartRecPending = false;
return;
}
+ if (mUnsupportedProfile == true) {
+ Log.e(TAG, "Unsupported video profile");
+ RotateTextToast.makeText(mActivity, R.string.error_app_unsupported_profile,
+ Toast.LENGTH_SHORT).show();
+ mStartRecPending = false;
+ return;
+ }
//??
//if (!mCameraDevice.waitDone()) return;
mCurrentVideoUri = null;
@@ -2061,15 +2063,6 @@ public class VideoModule implements CameraModule,
}
Log.d(TAG, "antiBanding value = " + mParameters.getAntibanding());
- String seeMoreMode = mPreferences.getString(
- CameraSettings.KEY_SEE_MORE,
- mActivity.getString(R.string.pref_camera_see_more_default));
- Log.v(TAG, "See More value =" + seeMoreMode);
- if (isSupported(seeMoreMode,
- CameraSettings.getSupportedSeeMoreModes(mParameters))) {
- mParameters.set(CameraSettings.KEY_QC_SEE_MORE_MODE, seeMoreMode);
- }
-
mUnsupportedHFRVideoSize = false;
mUnsupportedHFRVideoCodec = false;
mUnsupportedHSRVideoSize = false;
@@ -2234,6 +2227,54 @@ public class VideoModule implements CameraModule,
mUI.overrideSettings(CameraSettings.KEY_QC_VIDEO_TNR_MODE, video_tnr);
}
+ String seeMoreMode = mPreferences.getString(
+ CameraSettings.KEY_SEE_MORE,
+ mActivity.getString(R.string.pref_camera_see_more_default));
+ Log.v(TAG, "See More value =" + seeMoreMode);
+
+ if (isSupported(seeMoreMode,
+ CameraSettings.getSupportedSeeMoreModes(mParameters))) {
+ if (is4KEnabled() && seeMoreMode.equals(mActivity.getString(R.string.
+ pref_camera_see_more_value_on))) {
+ /* Disable SeeMore during 4K resolution */
+ mParameters.set(CameraSettings.KEY_QC_SEE_MORE_MODE,
+ mActivity.getString(R.string.pref_camera_see_more_value_off));
+ mUI.overrideSettings(CameraSettings.KEY_SEE_MORE,
+ mActivity.getString(R.string.pref_camera_see_more_value_off));
+ Toast.makeText(mActivity, R.string.video_quality_4k_disable_SeeMore,
+ Toast.LENGTH_LONG).show();
+ } else {
+ /* Disable CDS */
+ if (seeMoreMode.equals(
+ mActivity.getString(R.string.pref_camera_see_more_value_on)) &&
+ video_cds.equals(mActivity.getString(R.string.
+ pref_camera_video_cds_value_on))) {
+ mParameters.set(CameraSettings.KEY_QC_VIDEO_CDS_MODE,
+ mActivity.getString(R.string.pref_camera_video_cds_value_off));
+ mUI.overrideSettings(CameraSettings.KEY_QC_VIDEO_CDS_MODE,
+ mActivity.getString(R.string.pref_camera_video_cds_value_off));
+ Toast.makeText(mActivity, R.string.disable_CDS_during_SeeMore,
+ Toast.LENGTH_LONG).show();
+ }
+
+ /* Disable TNR */
+ if (seeMoreMode.equals(
+ mActivity.getString(R.string.pref_camera_see_more_value_on)) &&
+ video_tnr.equals(mActivity.getString(R.string.
+ pref_camera_video_tnr_value_on))) {
+ mParameters.set(CameraSettings.KEY_QC_VIDEO_TNR_MODE,
+ mActivity.getString(R.string.pref_camera_video_tnr_value_off));
+ mUI.overrideSettings(CameraSettings.KEY_QC_VIDEO_TNR_MODE,
+ mActivity.getString(R.string.pref_camera_video_tnr_value_off));
+ Toast.makeText(mActivity, R.string.disable_TNR_during_SeeMore,
+ Toast.LENGTH_LONG).show();
+ }
+
+ /* Set SeeMore mode */
+ mParameters.set(CameraSettings.KEY_QC_SEE_MORE_MODE, seeMoreMode);
+ }
+ }
+
// Set Video HDR.
String videoHDR = mPreferences.getString(
CameraSettings.KEY_VIDEO_HDR,
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index 8362d0590..cc06e7b79 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -46,7 +46,6 @@ import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.TextView;
-import com.android.camera.CameraActivity.UpdatePreviewThumbnail;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.ui.AbstractSettingPopup;
import com.android.camera.ui.CameraControls;
@@ -98,7 +97,7 @@ public class VideoUI implements PieRenderer.PieListener,
private VideoController mController;
private int mZoomMax;
private List<Integer> mZoomRatios;
- private ImageView mPreviewThumb;
+ private ImageView mThumbnail;
private View mFlashOverlay;
private boolean mOrientationResize;
private boolean mPrevOrientationResize;
@@ -121,37 +120,14 @@ public class VideoUI implements PieRenderer.PieListener,
private int mPreviewOrientation = -1;
private int mOrientation;
+ private int mScreenRatio = CameraUtil.RATIO_UNKNOWN;
+ private int mTopMargin = 0;
+ private int mBottomMargin = 0;
+
// temporary variables for updating SurfaceView
private int mTempWidth;
private int mTempHeight;
- private final Handler mHandler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case UPDATE_TRANSFORM_MATRIX:
- setTransformMatrix(mPreviewWidth, mPreviewHeight);
- break;
- default:
- break;
- }
- }
- };
-
- private final Handler mSurfaceViewUpdateHandler = new Handler();
-
- private Runnable updateSurfaceView = new Runnable() {
-
- @Override
- public void run() {
- FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurfaceView
- .getLayoutParams();
- params.width = mTempWidth;
- params.height = mTempHeight;
- mSurfaceView.setLayoutParams(params);
- }
- };
-
private OnLayoutChangeListener mLayoutListener = new OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right,
@@ -181,7 +157,7 @@ public class VideoUI implements PieRenderer.PieListener,
if (mOriginalPreviewHeight == 0) mOriginalPreviewHeight = height;
mPreviewWidth = width;
mPreviewHeight = height;
- setTransformMatrix(mOriginalPreviewWidth, mOriginalPreviewHeight);
+ setTransformMatrix(mPreviewWidth, mPreviewHeight);
mAspectRatioResize = false;
}
mVideoMenu.tryToCloseSubList();
@@ -260,28 +236,18 @@ public class VideoUI implements PieRenderer.PieListener,
Point size = new Point();
mActivity.getWindowManager().getDefaultDisplay().getSize(size);
- int l = size.x > size.y ? size.x : size.y;
- int tm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_top_margin);
- int bm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_bottom_margin);
- int topMargin = l / 4 * tm / (tm + bm);
- mCameraControls.setMargins(topMargin, l / 4 - topMargin);
- }
-
- public void updatePreviewThumbnail() {
- mPreviewThumb.setVisibility(View.VISIBLE);
- Bitmap bitmap = mActivity.getPreviewThumbBitmap();
- if (bitmap != null)
- mPreviewThumb.setImageBitmap(bitmap);
- else {
- UpdatePreviewThumbnail task = mActivity.new UpdatePreviewThumbnail(mPreviewThumb);
- task.execute();
+ mScreenRatio = CameraUtil.determineRatio(size.x, size.y);
+ if (mScreenRatio == CameraUtil.RATIO_16_9) {
+ int l = size.x > size.y ? size.x : size.y;
+ int tm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_top_margin);
+ int bm = mActivity.getResources().getDimensionPixelSize(R.dimen.preview_bottom_margin);
+ mTopMargin = l / 4 * tm / (tm + bm);
+ mBottomMargin = l / 4 - mTopMargin;
}
- }
+ mCameraControls.setMargins(mTopMargin, mBottomMargin);
- public void updateWithNewPreviewThumbnail() {
- mPreviewThumb.setVisibility(View.VISIBLE);
- UpdatePreviewThumbnail task = mActivity.new UpdatePreviewThumbnail(mPreviewThumb);
- task.execute();
+ mOriginalPreviewWidth = size.x;
+ mOriginalPreviewHeight = size.y;
}
public void cameraOrientationPreviewResize(boolean orientation){
@@ -365,11 +331,8 @@ public class VideoUI implements PieRenderer.PieListener,
mAspectRatio = ratio;
}
- if (mPreviewWidth > 0 && mPreviewHeight > 0) {
- mHandler.sendEmptyMessage(UPDATE_TRANSFORM_MATRIX);
- }
- // ensure a semi-transparent background for now
- mCameraControls.setPreviewRatio(1.0f, false);
+ mCameraControls.setPreviewRatio(mAspectRatio, false);
+ layoutPreview((float)ratio);
}
public int getPreviewWidth() {
@@ -380,33 +343,89 @@ public class VideoUI implements PieRenderer.PieListener,
return mPreviewHeight;
}
- private void setTransformMatrix(int width, int height) {
- mMatrix = mSurfaceView.getMatrix();
+ private void layoutPreview(float ratio) {
+ FrameLayout.LayoutParams lp;
float scaledTextureWidth, scaledTextureHeight;
- if (mOrientationResize) {
- scaledTextureWidth = height * mAspectRatio;
- if (scaledTextureWidth > width) {
- scaledTextureWidth = width;
- scaledTextureHeight = scaledTextureWidth / mAspectRatio;
- } else {
- scaledTextureHeight = height;
+ int rotation = CameraUtil.getDisplayRotation(mActivity);
+ if (mScreenRatio == CameraUtil.RATIO_16_9
+ && CameraUtil.determinCloseRatio(ratio) == CameraUtil.RATIO_4_3) {
+ int l = (mTopMargin + mBottomMargin) * 4;
+ int s = l * 9 / 16;
+ switch (rotation) {
+ case 90:
+ lp = new FrameLayout.LayoutParams(l * 3 / 4, s);
+ lp.setMargins(mTopMargin, 0, mBottomMargin, 0);
+ scaledTextureWidth = l * 3 / 4;
+ scaledTextureHeight = s;
+ break;
+ case 180:
+ lp = new FrameLayout.LayoutParams(s, l * 3 / 4);
+ lp.setMargins(0, mBottomMargin, 0, mTopMargin);
+ scaledTextureWidth = s;
+ scaledTextureHeight = l * 3 / 4;
+ break;
+ case 270:
+ lp = new FrameLayout.LayoutParams(l * 3 / 4, s);
+ lp.setMargins(mBottomMargin, 0, mTopMargin, 0);
+ scaledTextureWidth = l * 3 / 4;
+ scaledTextureHeight = s;
+ break;
+ default:
+ lp = new FrameLayout.LayoutParams(s, l * 3 / 4);
+ lp.setMargins(0, mTopMargin, 0, mBottomMargin);
+ scaledTextureWidth = s;
+ scaledTextureHeight = l * 3 / 4;
+ break;
}
} else {
- if (width > height) {
- scaledTextureWidth = Math.max(width, height * mAspectRatio);
- scaledTextureHeight = Math.max(height, width / mAspectRatio);
+ float width = mOriginalPreviewWidth, height = mOriginalPreviewHeight;
+ if (mOrientationResize) {
+ scaledTextureWidth = height * mAspectRatio;
+ if (scaledTextureWidth > width) {
+ scaledTextureWidth = width;
+ scaledTextureHeight = scaledTextureWidth / mAspectRatio;
+ } else {
+ scaledTextureHeight = height;
+ }
+ } else {
+ if (width > height) {
+ scaledTextureWidth = Math.max(width, height * mAspectRatio);
+ scaledTextureHeight = Math.max(height, width / mAspectRatio);
+ } else {
+ scaledTextureWidth = Math.max(width, height / mAspectRatio);
+ scaledTextureHeight = Math.max(height, width * mAspectRatio);
+ }
+ }
+
+ Log.v(TAG, "setTransformMatrix: scaledTextureWidth = " + scaledTextureWidth
+ + ", scaledTextureHeight = " + scaledTextureHeight);
+
+ int orientation = mActivity.getResources().getConfiguration().orientation;
+ if (((rotation == 0 || rotation == 180) && scaledTextureWidth > scaledTextureHeight)
+ || ((rotation == 90 || rotation == 270)
+ && scaledTextureWidth < scaledTextureHeight)) {
+ lp = new FrameLayout.LayoutParams((int) scaledTextureHeight,
+ (int) scaledTextureWidth, Gravity.CENTER);
} else {
- scaledTextureWidth = Math.max(width, height / mAspectRatio);
- scaledTextureHeight = Math.max(height, width * mAspectRatio);
+ lp = new FrameLayout.LayoutParams((int) scaledTextureWidth,
+ (int) scaledTextureHeight, Gravity.CENTER);
}
}
+ mSurfaceView.setLayoutParams(lp);
+ }
+
+ private void setTransformMatrix(int width, int height) {
+ if (width == 0 || height == 0) return;
+ mMatrix = mSurfaceView.getMatrix();
- Log.v(TAG, "setTransformMatrix: scaledTextureWidth = " + scaledTextureWidth
- + ", scaledTextureHeight = " + scaledTextureHeight);
- mTempWidth = (int) scaledTextureWidth;
- mTempHeight = (int) scaledTextureHeight;
- mHandler.post(updateSurfaceView);
+ mTempWidth = (int) width;
+ mTempHeight = (int) height;
+ FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) mSurfaceView
+ .getLayoutParams();
+ params.width = mTempWidth;
+ params.height = mTempHeight;
+ mSurfaceView.setLayoutParams(params);
}
/**
@@ -433,8 +452,8 @@ public class VideoUI implements PieRenderer.PieListener,
Log.e(TAG, "No valid bitmap for capture animation.");
return;
}
- mPreviewThumb.setImageBitmap(bitmap);
- mAnimationManager.startCaptureAnimation(mPreviewThumb);
+ mActivity.updateThumbnail(bitmap);
+ mAnimationManager.startCaptureAnimation(mThumbnail);
}
/**
@@ -577,8 +596,8 @@ public class VideoUI implements PieRenderer.PieListener,
mGestures.setRenderOverlay(mRenderOverlay);
- mPreviewThumb = (ImageView) mRootView.findViewById(R.id.preview_thumb);
- mPreviewThumb.setOnClickListener(new OnClickListener() {
+ mThumbnail = (ImageView) mRootView.findViewById(R.id.preview_thumb);
+ mThumbnail.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Do not allow navigation to filmstrip during video recording
@@ -635,11 +654,8 @@ public class VideoUI implements PieRenderer.PieListener,
mAspectRatio = (float)ratio;
}
- mSurfaceView.requestLayout();
-
- if (mPreviewWidth > 0 && mPreviewHeight > 0) {
- mHandler.sendEmptyMessage(UPDATE_TRANSFORM_MATRIX);
- }
+ mCameraControls.setPreviewRatio(mAspectRatio, false);
+ layoutPreview((float)ratio);
}
public void showTimeLapseUI(boolean enable) {
@@ -729,16 +745,23 @@ public class VideoUI implements PieRenderer.PieListener,
}
public void showPopup(ListView popup, int level, boolean animate) {
+ FrameLayout.LayoutParams layoutParams;
hideUI();
popup.setVisibility(View.VISIBLE);
if (level == 1) {
if (mMenuLayout == null) {
mMenuLayout = new RotateLayout(mActivity, null);
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
- mMenuLayout.setLayoutParams(params);
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ layoutParams = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.LEFT | Gravity.TOP);
+ } else {
+ layoutParams = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_1, LayoutParams.WRAP_CONTENT,
+ Gravity.RIGHT | Gravity.TOP);
+ }
+ mMenuLayout.setLayoutParams(layoutParams);
((ViewGroup) mRootView).addView(mMenuLayout);
}
mMenuLayout.setOrientation(mOrientation, true);
@@ -753,9 +776,15 @@ public class VideoUI implements PieRenderer.PieListener,
((ViewGroup) mRootView).addView(mSubMenuLayout);
}
- FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
- CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
- Gravity.LEFT | Gravity.TOP);
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ layoutParams = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.LEFT | Gravity.TOP);
+ } else {
+ layoutParams = new FrameLayout.LayoutParams(
+ CameraActivity.SETTING_LIST_WIDTH_2, LayoutParams.WRAP_CONTENT,
+ Gravity.RIGHT | Gravity.TOP);
+ }
int screenHeight = (mOrientation == 0 || mOrientation == 180)
? mRootView.getHeight() : mRootView.getWidth();
@@ -764,10 +793,10 @@ public class VideoUI implements PieRenderer.PieListener,
int y = Math.max(0, yBase);
if (yBase + height > screenHeight)
y = Math.max(0, screenHeight - height);
- params.setMargins(0, y, 0, 0);
- params.setMarginStart(CameraActivity.SETTING_LIST_WIDTH_1);
+ layoutParams.setMargins(0, y, 0, 0);
+ layoutParams.setMarginStart(CameraActivity.SETTING_LIST_WIDTH_1);
- mSubMenuLayout.setLayoutParams(params);
+ mSubMenuLayout.setLayoutParams(layoutParams);
mSubMenuLayout.addView(popup);
mSubMenuLayout.setOrientation(mOrientation, true);
}
@@ -1031,7 +1060,7 @@ public class VideoUI implements PieRenderer.PieListener,
// Re-apply transform matrix for new surface texture
setTransformMatrix(mPreviewWidth, mPreviewHeight);
}
- updatePreviewThumbnail();
+ mActivity.updateThumbnail(mThumbnail);
}
@Override
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index e5ba57eb2..e7025a1a7 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -557,6 +557,10 @@ public class WideAnglePanoramaModule
} else {
float panningRateXInDegree = panningRateX * mHorizontalViewAngle;
float panningRateYInDegree = panningRateY * mVerticalViewAngle;
+ if (mDeviceOrientation == 180 || mDeviceOrientation == 90) {
+ accumulatedHorizontalAngle = -accumulatedHorizontalAngle;
+ accumulatedVerticalAngle = -accumulatedVerticalAngle;
+ }
mUI.updateCaptureProgress(panningRateXInDegree, panningRateYInDegree,
accumulatedHorizontalAngle, accumulatedVerticalAngle,
PANNING_SPEED_THRESHOLD);
@@ -751,10 +755,6 @@ public class WideAnglePanoramaModule
}
}
- public void updatePreviewThumbnail() {
- mUI.updatePreviewThumbnail();
- }
-
// This function will be called upon the first camera frame is available.
private void reset() {
mCaptureState = CAPTURE_STATE_VIEWFINDER;
@@ -850,9 +850,14 @@ public class WideAnglePanoramaModule
perct = mActivity.getResources().getInteger(R.integer.panorama_frame_size_reduction);
}
- mMosaicFrameProcessor.initialize(mCameraPreviewWidth * perct / 100,
- mCameraPreviewHeight * perct / 100, getPreviewBufSize());
- mMosaicFrameProcessorInitialized = true;
+ int width = (mCameraPreviewWidth * perct) / 100;
+ int height = (mCameraPreviewHeight * perct) / 100;
+ if ((0 < width) && (0 < height)) {
+ mMosaicFrameProcessor.initialize(width, height, getPreviewBufSize());
+ mMosaicFrameProcessorInitialized = true;
+ } else {
+ throw new RuntimeException("Invalid preview dimension");
+ }
}
@Override
diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java
index 7941ea88c..230c31c86 100644
--- a/src/com/android/camera/WideAnglePanoramaUI.java
+++ b/src/com/android/camera/WideAnglePanoramaUI.java
@@ -46,10 +46,10 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.android.camera.CameraActivity.UpdatePreviewThumbnail;
import com.android.camera.ui.CameraControls;
import com.android.camera.ui.CameraRootView;
import com.android.camera.ui.ModuleSwitcher;
+import com.android.camera.ui.RotateLayout;
import com.android.camera.ui.RotateTextToast;
import com.android.camera.util.CameraUtil;
import org.codeaurora.snapcam.R;
@@ -86,7 +86,7 @@ public class WideAnglePanoramaUI implements
private TextureView mTextureView;
private ShutterButton mShutterButton;
private CameraControls mCameraControls;
- private ImageView mPreviewThumb;
+ private ImageView mThumbnail;
private Matrix mProgressDirectionMatrix = new Matrix();
private float[] mProgressAngle = new float[2];
@@ -102,6 +102,7 @@ public class WideAnglePanoramaUI implements
private int mOrientation;
private int mPreviewYOffset;
+ private RotateLayout mWaitingDialog;
/** Constructor. */
public WideAnglePanoramaUI(
@@ -116,8 +117,8 @@ public class WideAnglePanoramaUI implements
mSwitcher = (ModuleSwitcher) mRootView.findViewById(R.id.camera_switcher);
mSwitcher.setCurrentIndex(ModuleSwitcher.WIDE_ANGLE_PANO_MODULE_INDEX);
mSwitcher.setSwitchListener(mActivity);
- mPreviewThumb = (ImageView) mRootView.findViewById(R.id.preview_thumb);
- mPreviewThumb.setOnClickListener(new OnClickListener() {
+ mThumbnail = (ImageView) mRootView.findViewById(R.id.preview_thumb);
+ mThumbnail.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (!CameraControls.isAnimating())
@@ -230,23 +231,6 @@ public class WideAnglePanoramaUI implements
mProgressDirectionMatrix.postRotate(orientation);
}
- public void updatePreviewThumbnail(Bitmap bitmap) {
- mPreviewThumb.setVisibility(View.VISIBLE);
- mPreviewThumb.setImageBitmap(bitmap);
- mActivity.setPreviewThumbnailBitmap(bitmap);
- }
-
- public void updatePreviewThumbnail() {
- mPreviewThumb.setVisibility(View.VISIBLE);
- Bitmap bitmap = mActivity.getPreviewThumbBitmap();
- if (bitmap != null)
- mPreviewThumb.setImageBitmap(bitmap);
- else {
- UpdatePreviewThumbnail task = mActivity.new UpdatePreviewThumbnail(mPreviewThumb);
- task.execute();
- }
- }
-
public void showDirectionIndicators(int direction) {
switch (direction) {
case PanoProgressBar.DIRECTION_NONE:
@@ -272,7 +256,7 @@ public class WideAnglePanoramaUI implements
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
mSurfaceTexture = surfaceTexture;
mController.onPreviewUIReady();
- updatePreviewThumbnail();
+ mActivity.updateThumbnail(mThumbnail);
}
@Override
@@ -329,8 +313,7 @@ public class WideAnglePanoramaUI implements
// a framework bug. Call requestLayout() as a workaround.
mSavingProgressBar.requestLayout();
- updatePreviewThumbnail(Bitmap.createScaledBitmap(bitmap,
- bitmap.getWidth() / 2, bitmap.getHeight() / 2, false));
+ mActivity.updateThumbnail(bitmap);
}
public void onConfigurationChanged(
@@ -478,6 +461,7 @@ public class WideAnglePanoramaUI implements
mCameraControls = (CameraControls) mRootView.findViewById(R.id.camera_controls);
setPanoramaPreviewView();
+ mWaitingDialog = (RotateLayout) mRootView.findViewById(R.id.waitingDialog);
mDialogHelper = new DialogHelper();
setViews(appRes);
}
@@ -552,11 +536,9 @@ public class WideAnglePanoramaUI implements
}
private class DialogHelper {
- private ProgressDialog mProgressDialog;
private AlertDialog mAlertDialog;
DialogHelper() {
- mProgressDialog = null;
mAlertDialog = null;
}
@@ -565,9 +547,8 @@ public class WideAnglePanoramaUI implements
mAlertDialog.dismiss();
mAlertDialog = null;
}
- if (mProgressDialog != null) {
- mProgressDialog.dismiss();
- mProgressDialog = null;
+ if (mWaitingDialog != null) {
+ mWaitingDialog.setVisibility(View.INVISIBLE);
}
}
@@ -589,7 +570,7 @@ public class WideAnglePanoramaUI implements
public void showWaitingDialog(CharSequence message) {
dismissAll();
- mProgressDialog = ProgressDialog.show(mActivity, null, message, true, false);
+ mWaitingDialog.setVisibility(View.VISIBLE);
}
}
@@ -702,7 +683,7 @@ public class WideAnglePanoramaUI implements
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) button.getLayoutParams();
lp.gravity = g;
button.setLayoutParams(lp);
-
+ mWaitingDialog.setRotation(-orientation);
mReview.setRotation(-orientation);
mTooFastPrompt.setRotation(-orientation);
mCameraControls.setOrientation(orientation, animation);
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index 59222b929..c0defea06 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -42,6 +42,7 @@ import com.android.camera.ui.ModuleSwitcher;
import com.android.camera.ui.RotateImageView;
import com.android.camera.ShutterButton;
import com.android.camera.util.CameraUtil;
+import com.android.camera.TsMakeupManager;
public class CameraControls extends RotatableLayout {
@@ -53,6 +54,7 @@ public class CameraControls extends RotatableLayout {
private View mMenu;
private View mFrontBackSwitcher;
private View mHdrSwitcher;
+ private View mTsMakeupSwitcher;
private View mIndicators;
private View mPreview;
private View mSceneModeSwitcher;
@@ -66,6 +68,7 @@ public class CameraControls extends RotatableLayout {
private ArrayList<View> mViewList;
private static final int FRONT_BACK_INDEX = 0;
private static final int HDR_INDEX = 1;
+ private static final int TS_MAKEUP_INDEX = 1;
private static final int SCENE_MODE_INDEX = 2;
private static final int FILTER_MODE_INDEX = 3;
private static final int MENU_INDEX = 4;
@@ -104,7 +107,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(0, 0);
mFrontBackSwitcher.setVisibility(View.INVISIBLE);
- mHdrSwitcher.setVisibility(View.INVISIBLE);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setVisibility(View.INVISIBLE);
+ } else {
+ mHdrSwitcher.setVisibility(View.INVISIBLE);
+ }
mSceneModeSwitcher.setVisibility(View.INVISIBLE);
mFilterModeSwitcher.setVisibility(View.INVISIBLE);
@@ -122,7 +129,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(0, 0);
mFrontBackSwitcher.setVisibility(View.INVISIBLE);
- mHdrSwitcher.setVisibility(View.INVISIBLE);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setVisibility(View.INVISIBLE);
+ } else {
+ mHdrSwitcher.setVisibility(View.INVISIBLE);
+ }
mSceneModeSwitcher.setVisibility(View.INVISIBLE);
mFilterModeSwitcher.setVisibility(View.INVISIBLE);
@@ -188,7 +199,11 @@ public class CameraControls extends RotatableLayout {
mSwitcher.setPressed(false);
mMenu.setPressed(false);
mFrontBackSwitcher.setPressed(false);
- mHdrSwitcher.setPressed(false);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setPressed(false);
+ } else {
+ mHdrSwitcher.setPressed(false);
+ }
mSceneModeSwitcher.setPressed(false);
mFilterModeSwitcher.setPressed(false);
} else {
@@ -198,7 +213,11 @@ public class CameraControls extends RotatableLayout {
((ModuleSwitcher) mSwitcher).enableTouch(enable);
mMenu.setEnabled(enable);
mFrontBackSwitcher.setEnabled(enable);
- mHdrSwitcher.setEnabled(enable);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setEnabled(enable);
+ } else {
+ mHdrSwitcher.setEnabled(enable);
+ }
mSceneModeSwitcher.setEnabled(enable);
mPreview.setEnabled(enable);
mFilterModeSwitcher.setEnabled(enable && mTempEnabled[FILTER_MODE_INDEX]);
@@ -208,8 +227,13 @@ public class CameraControls extends RotatableLayout {
mViewList = new ArrayList<View>();
if (mFrontBackSwitcher.getVisibility() == View.VISIBLE)
mViewList.add(mFrontBackSwitcher);
- if (mHdrSwitcher.getVisibility() == View.VISIBLE)
- mViewList.add(mHdrSwitcher);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ if (mTsMakeupSwitcher.getVisibility() == View.VISIBLE)
+ mViewList.add(mTsMakeupSwitcher);
+ } else {
+ if (mHdrSwitcher.getVisibility() == View.VISIBLE)
+ mViewList.add(mHdrSwitcher);
+ }
if (mSceneModeSwitcher.getVisibility() == View.VISIBLE)
mViewList.add(mSceneModeSwitcher);
if (mFilterModeSwitcher.getVisibility() == View.VISIBLE)
@@ -229,7 +253,11 @@ public class CameraControls extends RotatableLayout {
mSwitcher = findViewById(R.id.camera_switcher);
mShutter = findViewById(R.id.shutter_button);
mFrontBackSwitcher = findViewById(R.id.front_back_switcher);
- mHdrSwitcher = findViewById(R.id.hdr_switcher);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher = findViewById(R.id.ts_makeup_switcher);
+ } else {
+ mHdrSwitcher = findViewById(R.id.hdr_switcher);
+ }
mMenu = findViewById(R.id.menu);
mIndicators = findViewById(R.id.on_screen_indicators);
mPreview = findViewById(R.id.preview_thumb);
@@ -307,7 +335,11 @@ public class CameraControls extends RotatableLayout {
toIndex(mIndicators, w, h, rotation, 0, 6, INDICATOR_INDEX);
toIndex(mFrontBackSwitcher, w, h, rotation, 2, 0, FRONT_BACK_INDEX);
toIndex(mPreview, w, h, rotation, 0, 6, PREVIEW_INDEX);
- toIndex(mHdrSwitcher, w, h, rotation, 3, 0, HDR_INDEX);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ toIndex(mTsMakeupSwitcher, w, h, rotation, 3, 0, TS_MAKEUP_INDEX);
+ } else {
+ toIndex(mHdrSwitcher, w, h, rotation, 3, 0, HDR_INDEX);
+ }
toIndex(mFilterModeSwitcher, w, h, rotation, 1, 0, FILTER_MODE_INDEX);
toIndex(mSceneModeSwitcher, w, h, rotation, 0, 0, SCENE_MODE_INDEX);
layoutToast(mRefocusToast, w, h, rotation);
@@ -401,7 +433,11 @@ public class CameraControls extends RotatableLayout {
int idx1 = rotation / 90;
mFrontBackSwitcher.setX(mLocX[idx1][FRONT_BACK_INDEX] + x);
- mHdrSwitcher.setX(mLocX[idx1][HDR_INDEX] + x);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setX(mLocX[idx1][TS_MAKEUP_INDEX] + x);
+ } else {
+ mHdrSwitcher.setX(mLocX[idx1][HDR_INDEX] + x);
+ }
mSceneModeSwitcher.setX(mLocX[idx1][SCENE_MODE_INDEX] + x);
mFilterModeSwitcher.setX(mLocX[idx1][FILTER_MODE_INDEX] + x);
mMenu.setX(mLocX[idx1][MENU_INDEX] + x);
@@ -411,7 +447,11 @@ public class CameraControls extends RotatableLayout {
mPreview.setX(mLocX[idx1][PREVIEW_INDEX] - x);
mFrontBackSwitcher.setY(mLocY[idx1][FRONT_BACK_INDEX] + y);
- mHdrSwitcher.setY(mLocY[idx1][HDR_INDEX] + y);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.setY(mLocY[idx1][TS_MAKEUP_INDEX] + y);
+ } else {
+ mHdrSwitcher.setY(mLocY[idx1][HDR_INDEX] + y);
+ }
mSceneModeSwitcher.setY(mLocY[idx1][SCENE_MODE_INDEX] + y);
mFilterModeSwitcher.setY(mLocY[idx1][FILTER_MODE_INDEX] + y);
mMenu.setY(mLocY[idx1][MENU_INDEX] + y);
@@ -426,7 +466,11 @@ public class CameraControls extends RotatableLayout {
enableTouch(false);
int rotation = getUnifiedRotation();
mFrontBackSwitcher.animate().cancel();
- mHdrSwitcher.animate().cancel();
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().cancel();
+ } else {
+ mHdrSwitcher.animate().cancel();
+ }
mSceneModeSwitcher.animate().cancel();
mFilterModeSwitcher.animate().cancel();
mSwitcher.animate().cancel();
@@ -441,7 +485,11 @@ public class CameraControls extends RotatableLayout {
switch (rotation) {
case 0:
mFrontBackSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
@@ -453,7 +501,11 @@ public class CameraControls extends RotatableLayout {
break;
case 90:
mFrontBackSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
@@ -465,7 +517,11 @@ public class CameraControls extends RotatableLayout {
break;
case 180:
mFrontBackSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
@@ -477,7 +533,11 @@ public class CameraControls extends RotatableLayout {
break;
case 270:
mFrontBackSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
@@ -497,7 +557,11 @@ public class CameraControls extends RotatableLayout {
enableTouch(false);
int rotation = getUnifiedRotation();
mFrontBackSwitcher.animate().cancel();
- mHdrSwitcher.animate().cancel();
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().cancel();
+ } else {
+ mHdrSwitcher.animate().cancel();
+ }
mSceneModeSwitcher.animate().cancel();
mFilterModeSwitcher.animate().cancel();
mSwitcher.animate().cancel();
@@ -524,7 +588,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(0, -mSize);
mFrontBackSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationYBy(mSize).setDuration(ANIME_DURATION);
@@ -538,7 +606,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(-mSize, 0);
mFrontBackSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
@@ -552,7 +624,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(0, mSize);
mFrontBackSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationYBy(-mSize).setDuration(ANIME_DURATION);
@@ -566,7 +642,11 @@ public class CameraControls extends RotatableLayout {
resetLocation(mSize, 0);
mFrontBackSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
- mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ if(TsMakeupManager.HAS_TS_MAKEUP) {
+ mTsMakeupSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ } else {
+ mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
+ }
mSceneModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
mFilterModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
mMenu.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
@@ -827,7 +907,8 @@ public class CameraControls extends RotatableLayout {
mOrientation = orientation;
View[] views = {
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
- mHdrSwitcher, mMenu, mShutter, mPreview, mSwitcher
+ TsMakeupManager.HAS_TS_MAKEUP ? mTsMakeupSwitcher : mHdrSwitcher,
+ mMenu, mShutter, mPreview, mSwitcher
};
for (View v : views) {
((RotateImageView) v).setOrientation(orientation, animation);
diff --git a/src/com/android/camera/ui/FaceView.java b/src/com/android/camera/ui/FaceView.java
index 8013520a9..4ab74e4cf 100644
--- a/src/com/android/camera/ui/FaceView.java
+++ b/src/com/android/camera/ui/FaceView.java
@@ -72,6 +72,7 @@ public class FaceView extends View
private static final int MSG_SWITCH_FACES = 1;
private static final int SWITCH_DELAY = 70;
+ private int mDisplayRotation = 0;
private boolean mStateSwitchPending = false;
private Handler mHandler = new Handler() {
@Override
@@ -194,6 +195,9 @@ public class FaceView extends View
mBlocked = block;
}
+ public void setDisplayRotation(int orientation) {
+ mDisplayRotation = orientation;
+ }
@Override
protected void onDraw(Canvas canvas) {
if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
@@ -236,8 +240,8 @@ public class FaceView extends View
Log.e(TAG, "blink: (" + face.getLeftEyeBlinkDegree()+ ", " +
face.getRightEyeBlinkDegree() + ")");
if (face.leftEye != null) {
- if ((mDisplayOrientation == 90) ||
- (mDisplayOrientation == 270)) {
+ if ((mDisplayRotation == 0) ||
+ (mDisplayRotation == 180)) {
point[0] = face.leftEye.x;
point[1] = face.leftEye.y - delta_y / 2;
point[2] = face.leftEye.x;
@@ -256,8 +260,8 @@ public class FaceView extends View
}
}
if (face.rightEye != null) {
- if ((mDisplayOrientation == 90) ||
- (mDisplayOrientation == 270)) {
+ if ((mDisplayRotation == 0) ||
+ (mDisplayRotation == 180)) {
point[0] = face.rightEye.x;
point[1] = face.rightEye.y - delta_y / 2;
point[2] = face.rightEye.x;
@@ -306,8 +310,8 @@ public class FaceView extends View
(-length) + 0.5);
if (face.getLeftEyeBlinkDegree() < blink_threshold) {
- if ((mDisplayOrientation == 90) ||
- (mDisplayOrientation == 270)) {
+ if ((mDisplayRotation == 90) ||
+ (mDisplayRotation == 270)) {
point[0] = face.leftEye.x;
point[1] = face.leftEye.y;
point[2] = face.leftEye.x + gazeRollX;
@@ -324,8 +328,8 @@ public class FaceView extends View
}
if (face.getRightEyeBlinkDegree() < blink_threshold) {
- if ((mDisplayOrientation == 90) ||
- (mDisplayOrientation == 270)) {
+ if ((mDisplayRotation == 90) ||
+ (mDisplayRotation == 270)) {
point[0] = face.rightEye.x;
point[1] = face.rightEye.y;
point[2] = face.rightEye.x + gazeRollX;
@@ -347,17 +351,17 @@ public class FaceView extends View
Log.e(TAG, "smile: " + face.getSmileDegree() + "," +
face.getSmileScore());
if (face.getSmileDegree() < smile_threashold_no_smile) {
- if ((mDisplayOrientation == 90) ||
- (mDisplayOrientation == 270)) {
- point[0] = face.mouth.x;
- point[1] = face.mouth.y - delta_y + dy;
- point[2] = face.mouth.x;
- point[3] = face.mouth.y + delta_y + dy;
- } else {
+ if ((mDisplayRotation == 90) ||
+ (mDisplayRotation == 270)) {
point[0] = face.mouth.x + dx - delta_x;
point[1] = face.mouth.y;
- point[2] = face.mouth.x + dx + delta_x ;
+ point[2] = face.mouth.x + dx + delta_x;
point[3] = face.mouth.y;
+ } else {
+ point[0] = face.mouth.x;
+ point[1] = face.mouth.y + dy - delta_y;
+ point[2] = face.mouth.x ;
+ point[3] = face.mouth.y + dy + delta_y;
}
Matrix faceMatrix = new Matrix(mMatrix);
faceMatrix.preRotate(face.getRollDirection(),
@@ -368,12 +372,7 @@ public class FaceView extends View
} else if (face.getSmileDegree() <
smile_threashold_small_smile) {
- int rotation_mouth = mDisplayOrientation -
- face.getRollDirection();
- if (0 > rotation_mouth) {
- rotation_mouth = 360 + rotation_mouth;
- }
-
+ int rotation_mouth = 360 - mDisplayRotation;
mRect.set(face.mouth.x-delta_x,
face.mouth.y-delta_y, face.mouth.x+delta_x,
face.mouth.y+delta_y);
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index bc40b06b3..46267a941 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -107,6 +107,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
private boolean mSendToMenu;
private boolean mReset;
private boolean mIsLoaded = false;
+ private boolean initialClampX = false;
/**
* Common interface for all images in the filmstrip.
@@ -994,7 +995,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
}
boolean stopScroll = false;
- if (curr.getId() == 0 && mCenterX < curr.getCenterX()
+ if (curr.getId() == 0 && (mCenterX < curr.getCenterX() || initialClampX)
&& mDataIdOnUserScrolling <= 1) {
// Stop at the first ViewItem.
stopScroll = true;
@@ -1735,7 +1736,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
mDataAdapter.setListener(new DataAdapter.Listener() {
@Override
public void onDataLoaded() {
- mActivity.updatePreviewThumbnail();
+ mActivity.updateThumbnail(false);
if (!mIsLoaded)
reload();
mIsLoaded = true;
@@ -1754,7 +1755,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
return;
}
updateInsertion(dataID);
- mActivity.updatePreviewThumbnailForVideo();
+ mActivity.updateThumbnail(true);
}
@Override
@@ -1786,7 +1787,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
if (!inFullScreen() || mController.isScrolling()) {
return true;
}
-
+ initialClampX = false;
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN) {
mCheckToIntercept = true;
mDown = MotionEvent.obtain(ev);
@@ -2076,7 +2077,7 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
// center of the display upon a reload.
mCenterX = -1;
mScale = FULL_SCREEN_SCALE;
-
+ initialClampX = true;
adjustChildZOrder();
invalidate();
diff --git a/src/com/android/camera/util/CameraUtil.java b/src/com/android/camera/util/CameraUtil.java
index debc04939..51c91cfe5 100644
--- a/src/com/android/camera/util/CameraUtil.java
+++ b/src/com/android/camera/util/CameraUtil.java
@@ -1093,4 +1093,27 @@ public class CameraUtil {
return RATIO_UNKNOWN;
}
}
+
+ public static int determinCloseRatio(float ratio) {
+ if (ratio < 1) {
+ ratio = 1 / ratio;
+ }
+
+ float diffFrom_4_3 = ((float) 4 / 3) / ratio;
+ if (diffFrom_4_3 < 1) {
+ diffFrom_4_3 = 1 / diffFrom_4_3;
+ }
+
+ float diffFrom_16_9 = ((float) 16 / 9) / ratio;
+ if (diffFrom_16_9 < 1) {
+ diffFrom_16_9 = 1 / diffFrom_16_9;
+ }
+
+ if (diffFrom_4_3 < diffFrom_16_9) {
+ return RATIO_4_3;
+ } else {
+ return RATIO_16_9;
+ }
+ }
+
}