summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml1
-rw-r--r--jni/feature_mos/src/mosaic/Blend.cpp3
-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_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_whiten_selector.xml22
-rw-r--r--res/layout/camera_controls.xml (renamed from res/layout-port/camera_controls.xml)4
-rw-r--r--res/layout/list_sub_menu_item.xml2
-rw-r--r--res/layout/pano_review_control.xml (renamed from res/layout-port/pano_review_control.xml)0
-rw-r--r--res/layout/panorama_module.xml73
-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.xml12
-rw-r--r--res/values/dimens.xml2
-rw-r--r--res/values/qcomarrays.xml41
-rw-r--r--res/values/qcomstrings.xml18
-rw-r--r--res/values/strings.xml2
-rw-r--r--res/xml/camera_preferences.xml25
-rw-r--r--res/xml/video_preferences.xml2
-rw-r--r--src/com/android/camera/CameraActivity.java22
-rw-r--r--src/com/android/camera/CameraErrorCallback.java42
-rw-r--r--src/com/android/camera/CameraSettings.java43
-rw-r--r--src/com/android/camera/ListPreference.java5
-rw-r--r--src/com/android/camera/PanoProgressBar.java12
-rw-r--r--src/com/android/camera/PhotoMenu.java329
-rw-r--r--src/com/android/camera/PhotoModule.java126
-rw-r--r--src/com/android/camera/PhotoUI.java41
-rw-r--r--src/com/android/camera/TsMakeupManager.java476
-rw-r--r--src/com/android/camera/VideoMenu.java121
-rw-r--r--src/com/android/camera/VideoModule.java12
-rw-r--r--src/com/android/camera/VideoUI.java7
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java17
-rw-r--r--src/com/android/camera/WideAnglePanoramaUI.java31
-rw-r--r--src/com/android/camera/ui/CameraControls.java123
-rw-r--r--src/com/android/camera/ui/FaceView.java4
-rw-r--r--src/com/android/camera/ui/FilmStripView.java8
42 files changed, 1855 insertions, 173 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 677be80e5..97b8cf7aa 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -33,6 +33,7 @@
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
+ <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<supports-screens
android:anyDensity="true"
diff --git a/jni/feature_mos/src/mosaic/Blend.cpp b/jni/feature_mos/src/mosaic/Blend.cpp
index ef983ff67..fce89c6e1 100644
--- a/jni/feature_mos/src/mosaic/Blend.cpp
+++ b/jni/feature_mos/src/mosaic/Blend.cpp
@@ -304,6 +304,7 @@ int Blend::runBlend(MosaicFrame **oframes, MosaicFrame **rframes,
mosaicHeight = Mheight;
}
+ free(imgMos);
return ret;
}
@@ -874,7 +875,7 @@ void Blend::ComputeMask(CSite *csite, BlendRect &vcrect, BlendRect &brect, Mosai
{
double d1 = hypotSq(m_AllSites[ce->second].getVCenter().x - si,
m_AllSites[ce->second].getVCenter().y - sj);
- if (d1 < dself)
+ if (d1 - dself < -1e-5)
{
break;
}
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_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_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/camera_controls.xml
index bc85432d9..af47a13b6 100644
--- a/res/layout-port/camera_controls.xml
+++ b/res/layout/camera_controls.xml
@@ -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/list_sub_menu_item.xml b/res/layout/list_sub_menu_item.xml
index a79628b5d..f2b043692 100644
--- a/res/layout/list_sub_menu_item.xml
+++ b/res/layout/list_sub_menu_item.xml
@@ -42,7 +42,7 @@
<TextView
android:id="@+id/text"
style="@style/CustomSettingItemTitle"
- android:shadowColor="@android:color/black"
+ android:shadowColor="@android:color/transparent"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
diff --git a/res/layout-port/pano_review_control.xml b/res/layout/pano_review_control.xml
index eeb2ebee4..eeb2ebee4 100644
--- a/res/layout-port/pano_review_control.xml
+++ b/res/layout/pano_review_control.xml
diff --git a/res/layout/panorama_module.xml b/res/layout/panorama_module.xml
index db05b806c..5ae300272 100644
--- a/res/layout/panorama_module.xml
+++ b/res/layout/panorama_module.xml
@@ -55,6 +55,79 @@
</com.android.camera.ui.RotateLayout>
<include layout="@layout/pano_module_review" />
+
+ <com.android.camera.ui.RotateLayout
+ android:id="@+id/pano_dialog_layout"
+ android:gravity="center"
+ android:layout_gravity="center"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_gravity="center"
+ android:background="@color/popup_background"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <LinearLayout android:id="@+id/pano_dialog_title_layout"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView android:id="@+id/pano_dialog_title"
+ style="@style/TextAppearance.DialogWindowTitle"
+ android:gravity="center_vertical"
+ android:layout_marginLeft="16dip"
+ android:layout_marginRight="16dip"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/pano_dialog_title"
+ android:minHeight="64dp"/>
+ <View style="@style/PopupTitleSeparator" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:background="@color/popup_background"
+ android:padding="9dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+
+ <TextView
+ style="@style/TextAppearance.Medium"
+ android:id="@+id/pano_dialog_text"
+ android:layout_gravity="center_vertical"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/pano_dialog_panorama_failed" />
+ </LinearLayout>
+
+ <ImageView android:background="@drawable/list_divider"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <LinearLayout android:id="@+id/pano_dialog_button_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center"
+ android:minHeight="48dp"
+ android:orientation="horizontal">
+
+ <Button android:id="@+id/pano_dialog_button1"
+ style="@style/Widget.Button.Borderless"
+ android:gravity="center"
+ android:maxLines="1"
+ android:minHeight="48dp"
+ android:textSize="14sp"
+ android:text="@string/dialog_ok"
+ android:layout_weight="1"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content" />
+ </LinearLayout>
+ </LinearLayout>
+ </com.android.camera.ui.RotateLayout>
+
<include layout="@layout/camera_controls"
android:layout_gravity="center"
style="@style/CameraControls"/>
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..37128e275 100644
--- a/res/values-zh-rCN/strings.xml
+++ b/res/values-zh-rCN/strings.xml
@@ -491,6 +491,7 @@
<string name="error_app_unsupported_dis">DIS不支持当前的分辨率设置</string>
<string name="pref_camera_longshot_title">连拍</string>
+ <string name="msg_cancel_longshot_for_limited_memory">内存不足, 取消连拍</string>
<string name="pref_camera_skinToneEnhancement_title">肤色增强</string>
<!-- The message is shown in toast when HDR or scene mode is enabled -->
@@ -529,4 +530,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/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 96db5ea49..d4855b9c6 100644
--- a/res/values/qcomarrays.xml
+++ b/res/values/qcomarrays.xml
@@ -435,6 +435,7 @@
<item>@string/pref_camera_hfr_entry_2x</item>
<item>@string/pref_camera_hfr_entry_3x</item>
<item>@string/pref_camera_hfr_entry_4x</item>
+ <item>@string/pref_camera_hfr_entry_8x</item>
<item>@string/pref_camera_hfr_entry_hsr_60</item>
<item>@string/pref_camera_hfr_entry_hsr_90</item>
<item>@string/pref_camera_hfr_entry_hsr_120</item>
@@ -446,6 +447,7 @@
<item>@string/pref_camera_hfr_value_2x</item>
<item>@string/pref_camera_hfr_value_3x</item>
<item>@string/pref_camera_hfr_value_4x</item>
+ <item>@string/pref_camera_hfr_value_8x</item>
<item>@string/pref_camera_hfr_value_hsr_60</item>
<item>@string/pref_camera_hfr_value_hsr_90</item>
<item>@string/pref_camera_hfr_value_hsr_120</item>
@@ -769,6 +771,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 ca50da013..157546b43 100644
--- a/res/values/qcomstrings.xml
+++ b/res/values/qcomstrings.xml
@@ -378,6 +378,7 @@
<string name="pref_camera_hfr_entry_2x">HFR 60</string>
<string name="pref_camera_hfr_entry_3x">HFR 90</string>
<string name="pref_camera_hfr_entry_4x">HFR 120</string>
+ <string name="pref_camera_hfr_entry_8x">HFR 240</string>
<string name="pref_camera_hfr_entry_hsr_60">HSR 60</string>
<string name="pref_camera_hfr_entry_hsr_90">HSR 90</string>
<string name="pref_camera_hfr_entry_hsr_120">HSR 120</string>
@@ -387,6 +388,7 @@
<string name="pref_camera_hfr_value_2x">hfr60</string>
<string name="pref_camera_hfr_value_3x">hfr90</string>
<string name="pref_camera_hfr_value_4x">hfr120</string>
+ <string name="pref_camera_hfr_value_8x">hfr240</string>
<string name="pref_camera_hfr_value_hsr_60">hsr60</string>
<string name="pref_camera_hfr_value_hsr_90">hsr90</string>
<string name="pref_camera_hfr_value_hsr_120">hsr120</string>
@@ -872,7 +874,23 @@
<!-- 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>
+
+ <string name="camera_thermal_shutdown">Phone overheated, closing camera.</string>
+ <string name="camera_server_died">Media server died, closing camera.</string>
+ <string name="camera_unknown_error">Unknown error, closing camera.</string>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0477c3dc5..d2c3a7036 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -238,6 +238,8 @@
<!-- The Video quality settings in preference [CHAR LIMIT=21] -->
<string name="pref_video_quality_title">Video quality</string>
+ <!-- The default quality value is NULL -->
+ <string name="pref_video_quality_default" translatable="false"></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">
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 b82ca1ba3..31b2d4c31 100644
--- a/res/xml/video_preferences.xml
+++ b/res/xml/video_preferences.xml
@@ -47,7 +47,7 @@
camera:title="@string/pref_camera_video_tnr_title"
camera:entries="@array/pref_camera_video_tnr_entries"
camera:entryValues="@array/pref_camera_video_tnr_entryvalues" />
- <ListPreference
+ <IconListPreference
camera:key="pref_camera_video_duration_key"
camera:defaultValue="@string/pref_camera_video_duration_default"
camera:title="@string/pref_camera_video_duration_title"
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 49fa4e99d..e7f9754ba 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -133,6 +133,7 @@ public class CameraActivity extends Activity
public static final String ACTION_TRIM_VIDEO =
"com.android.camera.action.TRIM";
public static final String MEDIA_ITEM_PATH = "media-item-path";
+ public static final String KEY_TOTAL_NUMBER = "total-number";
// Used to show whether Gallery was launched from Snapcam
private static final String KEY_FROM_SNAPCAM = "from-snapcam";
@@ -309,6 +310,24 @@ public class CameraActivity extends Activity
}
};
+ // update the status of storage space when SD card status changed.
+ private BroadcastReceiver mSDcardMountedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(TAG, "SDcard status changed, update storage space");
+ updateStorageSpaceAndHint();
+ }
+ };
+
+ private void registerSDcardMountedReceiver() {
+ // filter for SDcard status
+ IntentFilter filter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
+ filter.addAction(Intent.ACTION_MEDIA_SHARED);
+ filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
+ filter.addDataScheme("file");
+ registerReceiver(mSDcardMountedReceiver, filter);
+ }
+
// close activity when screen turns off
private BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() {
@Override
@@ -572,6 +591,7 @@ public class CameraActivity extends Activity
intent.setAction(Intent.ACTION_VIEW);
intent.setData(uri);
intent.putExtra(KEY_FROM_SNAPCAM, true);
+ intent.putExtra(KEY_TOTAL_NUMBER, (adapter.getTotalNumber() -1));
startActivity(intent);
} catch (ActivityNotFoundException ex) {
try {
@@ -1523,6 +1543,7 @@ public class CameraActivity extends Activity
int offset = lower * 10 / 100;
SETTING_LIST_WIDTH_1 = lower / 2 + offset;
SETTING_LIST_WIDTH_2 = lower / 2 - offset;
+ registerSDcardMountedReceiver();
}
private void setRotationAnimation() {
@@ -1659,6 +1680,7 @@ public class CameraActivity extends Activity
}
getContentResolver().unregisterContentObserver(mLocalImagesObserver);
getContentResolver().unregisterContentObserver(mLocalVideosObserver);
+ unregisterReceiver(mSDcardMountedReceiver);
super.onDestroy();
}
diff --git a/src/com/android/camera/CameraErrorCallback.java b/src/com/android/camera/CameraErrorCallback.java
index 7029ac427..dd627bd0a 100644
--- a/src/com/android/camera/CameraErrorCallback.java
+++ b/src/com/android/camera/CameraErrorCallback.java
@@ -17,20 +17,50 @@
package com.android.camera;
import android.util.Log;
+import android.widget.Toast;
+import com.android.camera.ui.RotateTextToast;
+import org.codeaurora.snapcam.R;
public class CameraErrorCallback
implements android.hardware.Camera.ErrorCallback {
private static final String TAG = "CameraErrorCallback";
+ public CameraActivity mActivity = null;
+ //custom error code for thermal shutdown. This should be in sync
+ //with HAL.
+ private static final int THERMAL_SHUTDOWN = 50;
+
+ public void setActivity(CameraActivity activity) {
+ mActivity = activity;
+ }
@Override
public void onError(int error, android.hardware.Camera camera) {
Log.e(TAG, "Got camera error callback. error=" + error);
- if (error == android.hardware.Camera.CAMERA_ERROR_SERVER_DIED
- || error == android.hardware.Camera.CAMERA_ERROR_UNKNOWN) {
- // We are not sure about the current state of the app (in preview or
- // snapshot or recording). Closing the app is better than creating a
- // new Camera object.
- throw new RuntimeException("Media server died.");
+ // We are not sure about the current state of the app (in preview or
+ // snapshot or recording). Closing the app is better than creating a
+ // new Camera object.
+ if (mActivity != null) {
+ final int resId;
+ switch (error) {
+ case android.hardware.Camera.CAMERA_ERROR_SERVER_DIED:
+ resId = R.string.camera_server_died;
+ break;
+ case THERMAL_SHUTDOWN:
+ resId = R.string.camera_thermal_shutdown;
+ break;
+ case android.hardware.Camera.CAMERA_ERROR_UNKNOWN:
+ default:
+ resId = R.string.camera_unknown_error;
+ break;
+ }
+ mActivity.runOnUiThread(new Runnable() {
+ public void run() {
+ RotateTextToast.makeText(mActivity, resId, Toast.LENGTH_LONG).show();
+ mActivity.finish();
+ }
+ });
+ } else {
+ throw new RuntimeException("Unknown error");
}
}
}
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index 5a4012a5f..cfc52a7ea 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -44,6 +44,7 @@ import java.util.List;
import java.util.Locale;
import android.os.Build;
import java.util.StringTokenizer;
+import android.os.SystemProperties;
/**
* Provides utilities and keys for Camera settings.
@@ -231,6 +232,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;
@@ -828,6 +837,30 @@ public class CameraSettings {
!GcamHelper.hasGcamCapture() || isFrontCamera)) {
removePreference(group, cameraHdrPlus.getKey());
}
+
+ if (SystemProperties.getBoolean("persist.env.camera.saveinsd", false)) {
+ final String CAMERA_SAVEPATH_SDCARD = "1";
+ final int CAMERA_SAVEPATH_SDCARD_IDX = 1;
+ final int CAMERA_SAVEPATH_PHONE_IDX = 0;
+ ListPreference savePath = group.findPreference(KEY_CAMERA_SAVEPATH);
+ SharedPreferences pref = group.getSharedPreferences();
+ String savePathValue = null;
+ if (pref != null) {
+ savePathValue = pref.getString(KEY_CAMERA_SAVEPATH, CAMERA_SAVEPATH_SDCARD);
+ }
+ if (savePath != null && CAMERA_SAVEPATH_SDCARD.equals(savePathValue)) {
+ // If sdCard is present, set sdCard as default save path.
+ // Only for the first time when camera start.
+ if (SDCard.instance().isWriteable()) {
+ Log.d(TAG, "set Sdcard as save path.");
+ savePath.setValueIndex(CAMERA_SAVEPATH_SDCARD_IDX);
+ } else {
+ Log.d(TAG, "set Phone as save path when sdCard is unavailable.");
+ savePath.setValueIndex(CAMERA_SAVEPATH_PHONE_IDX);
+ }
+ }
+ }
+
qcomInitPreferences(group);
}
@@ -961,12 +994,12 @@ public class CameraSettings {
editor.apply();
}
- public static void upgradeGlobalPreferences(SharedPreferences pref) {
- upgradeOldVersion(pref);
+ public static void upgradeGlobalPreferences(SharedPreferences pref, Context context) {
+ upgradeOldVersion(pref, context);
upgradeCameraId(pref);
}
- private static void upgradeOldVersion(SharedPreferences pref) {
+ private static void upgradeOldVersion(SharedPreferences pref, Context context) {
int version;
try {
version = pref.getInt(KEY_VERSION, 0);
@@ -989,7 +1022,7 @@ public class CameraSettings {
} else if (quality.equals("75")) {
quality = "fine";
} else {
- quality = "superfine";
+ quality = context.getString(R.string.pref_camera_jpegquality_default);
}
editor.putString(KEY_JPEG_QUALITY, quality);
version = 2;
@@ -1076,7 +1109,7 @@ public class CameraSettings {
// we may write the preference to wrong camera later.
preferences.setLocalId(context, currentCameraId);
- upgradeGlobalPreferences(preferences.getGlobal());
+ upgradeGlobalPreferences(preferences.getGlobal(), context);
upgradeLocalPreferences(preferences.getLocal());
// Write back the current camera id because parameters are related to
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/PanoProgressBar.java b/src/com/android/camera/PanoProgressBar.java
index 2a0589066..d20878a84 100644
--- a/src/com/android/camera/PanoProgressBar.java
+++ b/src/com/android/camera/PanoProgressBar.java
@@ -44,6 +44,8 @@ class PanoProgressBar extends ImageView {
private RectF mDrawBounds;
private OnDirectionChangeListener mListener = null;
+ private int mOldProgress = 0;
+
public interface OnDirectionChangeListener {
public void onDirectionChange(int direction);
}
@@ -137,6 +139,12 @@ class PanoProgressBar extends ImageView {
setRightIncreasing(false);
}
}
+ // When user move to the opposite direction more than 10 degrees,
+ // change the direction and stop the capture progress in PanoramaModule.
+ if (Math.abs(mOldProgress) - Math.abs(progress) > 10) {
+ mListener.onDirectionChange(mDirection/2 + 1);
+ return;
+ }
// mDirection might be modified by setRightIncreasing() above. Need to check again.
if (mDirection != DIRECTION_NONE) {
mProgress = progress * mWidth / mMaxProgress + mProgressOffset;
@@ -152,11 +160,15 @@ class PanoProgressBar extends ImageView {
}
invalidate();
}
+ if (Math.abs(mOldProgress) < Math.abs(progress)) {
+ mOldProgress = progress;
+ }
}
public void reset() {
mProgress = 0;
mProgressOffset = 0;
+ mOldProgress = 0;
setDirection(DIRECTION_NONE);
invalidate();
}
diff --git a/src/com/android/camera/PhotoMenu.java b/src/com/android/camera/PhotoMenu.java
index 3bf0b3a88..534924281 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;
@@ -55,6 +62,7 @@ import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.Display;
import com.android.camera.util.CameraUtil;
+import java.util.Locale;
public class PhotoMenu extends MenuController
implements ListMenu.Listener,
@@ -74,14 +82,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;
@@ -97,8 +108,12 @@ 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);
@@ -106,8 +121,10 @@ public class PhotoMenu extends MenuController
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) {
@@ -120,19 +137,36 @@ 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,
@@ -191,6 +225,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) {
@@ -200,6 +246,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;
@@ -219,6 +273,10 @@ public class PhotoMenu extends MenuController
mUI.removeSceneModeMenu();
}
+ public void closeMakeupMode(boolean isMakeup) {
+ mUI.removeSceneModeMenu();
+ }
+
public void tryToCloseSubList() {
if (mListMenu != null)
((ListMenu) mListMenu).resetHighlight();
@@ -284,19 +342,37 @@ public class PhotoMenu extends MenuController
mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
ViewPropertyAnimator vp = v.animate();
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(-v.getWidth());
- break;
- case 90:
- vp.translationYBy(2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(-v.getHeight());
- break;
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(v.getWidth());
+ break;
+ case 90:
+ vp.translationYBy(-2 * v.getHeight());
+ break;
+ case 180:
+ vp.translationXBy(-2 * v.getWidth());
+ break;
+ case 270:
+ vp.translationYBy(v.getHeight());
+ break;
+ }
+ } else {
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(-v.getWidth());
+ break;
+ case 90:
+ vp.translationYBy(2 * v.getHeight());
+ break;
+ case 180:
+ vp.translationXBy(2 * v.getWidth());
+ break;
+ case 270:
+ vp.translationYBy(-v.getHeight());
+ break;
+ }
}
vp.setListener(new AnimatorListener() {
@Override
@@ -353,32 +429,65 @@ public class PhotoMenu extends MenuController
ViewPropertyAnimator vp = v.animate();
float dest;
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(dest - delta);
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(dest + delta);
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(dest + delta);
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(dest - delta);
- vp.translationY(dest);
- break;
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX(-(dest - delta));
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY(-(dest + delta));
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX(-(dest + delta));
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY(-(dest - delta));
+ vp.translationY(dest);
+ break;
+ }
+ } else {
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX(dest - delta);
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY(dest + delta);
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX(dest + delta);
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY(dest - delta);
+ vp.translationY(dest);
+ break;
+ }
}
vp.setDuration(ANIMATION_DURATION).start();
}
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);
@@ -390,7 +499,12 @@ public class PhotoMenu extends MenuController
mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
ViewPropertyAnimator vp = v.animate();
- vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
+ } else {
+ vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
+ }
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -601,8 +715,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) ||
@@ -622,12 +738,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);
+ }
}
}
}
@@ -688,6 +808,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
@@ -850,6 +1065,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) {
@@ -963,14 +1180,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) {
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 9c3cd4858..e2fc34b0c 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";
@@ -483,7 +485,7 @@ public class PhotoModule
mActivity = activity;
mRootView = parent;
mPreferences = new ComboPreferences(mActivity);
- CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal());
+ CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mCameraId = getPreferredCameraId(mPreferences);
mContentResolver = mActivity.getContentResolver();
@@ -688,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));
@@ -793,7 +795,13 @@ public class PhotoModule
@Override
public void onSwitchSavePath() {
- mUI.setPreference(CameraSettings.KEY_CAMERA_SAVEPATH, "1");
+ if (mUI.mMenuInitialized) {
+ mUI.setPreference(CameraSettings.KEY_CAMERA_SAVEPATH, "1");
+ } else {
+ mPreferences.edit()
+ .putString(CameraSettings.KEY_CAMERA_SAVEPATH, "1")
+ .apply();
+ }
RotateTextToast.makeText(mActivity, R.string.on_switch_save_path_to_sdcard,
Toast.LENGTH_SHORT).show();
}
@@ -1038,7 +1046,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);
}
@@ -1524,12 +1532,13 @@ public class PhotoModule
mParameters.remove(CameraSettings.KEY_QC_LEGACY_BURST);
}
- // Unlock AE&AWB during longshot
- if (LONGSHOT == mCameraState) {
- mFocusManager.setAeAwbLock(false);
- setAutoExposureLockIfSupported();
- setAutoWhiteBalanceLockIfSupported();
- }
+ // 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();
@@ -1873,10 +1882,9 @@ public class PhotoModule
if (orientation == OrientationEventListener.ORIENTATION_UNKNOWN) return;
int oldOrientation = mOrientation;
mOrientation = CameraUtil.roundOrientation(orientation, mOrientation);
- if (oldOrientation != mOrientation &&
- oldOrientation != OrientationEventListener.ORIENTATION_UNKNOWN) {
- Log.v(TAG, "onOrientationChanged, update parameters");
- if (mParameters != null && mCameraDevice != null) {
+ if (oldOrientation != mOrientation) {
+ if (mParameters != null && mCameraDevice != null && mCameraState == IDLE) {
+ Log.v(TAG, "onOrientationChanged, update parameters");
setFlipValue();
mCameraDevice.setParameters(mParameters);
}
@@ -2623,6 +2631,7 @@ public class PhotoModule
Log.w(TAG, "startPreview: parameters for preview are not ready.");
return;
}
+ mErrorCallback.setActivity(mActivity);
mCameraDevice.setErrorCallback(mErrorCallback);
// ICS camera frameworks has a bug. Face detection state is not cleared 1589
// after taking a picture. Stop the preview to work around it. The bug
@@ -2631,6 +2640,10 @@ public class PhotoModule
stopPreview();
}
+ if (!mSnapshotOnIdle) {
+ mFocusManager.setAeAwbLock(false); // Unlock AE and AWB.
+ }
+
setCameraParameters(UPDATE_PARAM_ALL);
mCameraDevice.startPreview();
@@ -2644,7 +2657,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);
}
@@ -3564,6 +3576,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;
@@ -4352,6 +4379,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 3f2000cd9..d2e2345e6 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -56,6 +56,7 @@ import android.graphics.drawable.AnimationDrawable;
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;
@@ -144,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;
@@ -471,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);
@@ -479,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);
@@ -531,7 +533,8 @@ public class PhotoUI implements PieListener,
mThumbnail.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- if (!CameraControls.isAnimating())
+ if (!CameraControls.isAnimating()
+ && mController.getCameraState() != PhotoController.SNAPSHOT_IN_PROGRESS)
mActivity.gotoGallery();
}
});
@@ -798,6 +801,10 @@ 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();
@@ -842,8 +849,11 @@ public class PhotoUI implements 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);
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ params.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
+ } else {
+ params.setMargins(0, y, CameraActivity.SETTING_LIST_WIDTH_1, 0);
+ }
mSubMenuLayout.setLayoutParams(params);
@@ -1267,6 +1277,27 @@ 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);
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 de8d5e4e2..da5c062e8 100644
--- a/src/com/android/camera/VideoMenu.java
+++ b/src/com/android/camera/VideoMenu.java
@@ -51,6 +51,8 @@ import android.view.WindowManager;
import android.view.Display;
import com.android.camera.ui.RotateLayout;
import com.android.camera.util.CameraUtil;
+import android.text.TextUtils;
+import java.util.Locale;
public class VideoMenu extends MenuController
implements ListMenu.Listener,
@@ -222,19 +224,37 @@ public class VideoMenu extends MenuController
mPopupStatus = POPUP_IN_ANIMATION_SLIDE;
ViewPropertyAnimator vp = v.animate();
- switch (mUI.getOrientation()) {
- case 0:
- vp.translationXBy(-v.getWidth());
- break;
- case 90:
- vp.translationYBy(2 * v.getHeight());
- break;
- case 180:
- vp.translationXBy(2 * v.getWidth());
- break;
- case 270:
- vp.translationYBy(-v.getHeight());
- break;
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(v.getWidth());
+ break;
+ case 90:
+ vp.translationYBy(-2 * v.getHeight());
+ break;
+ case 180:
+ vp.translationXBy(-2 * v.getWidth());
+ break;
+ case 270:
+ vp.translationYBy(v.getHeight());
+ break;
+ }
+ } else {
+ switch (mUI.getOrientation()) {
+ case 0:
+ vp.translationXBy(-v.getWidth());
+ break;
+ case 90:
+ vp.translationYBy(2 * v.getHeight());
+ break;
+ case 180:
+ vp.translationXBy(2 * v.getWidth());
+ break;
+ case 270:
+ vp.translationYBy(-v.getHeight());
+ break;
+ }
}
vp.setListener(new AnimatorListener() {
@@ -292,27 +312,53 @@ public class VideoMenu extends MenuController
ViewPropertyAnimator vp = v.animate();
float dest;
- switch (orientation) {
- case 0:
- dest = v.getX();
- v.setX(dest - delta);
- vp.translationX(dest);
- break;
- case 90:
- dest = v.getY();
- v.setY(dest + delta);
- vp.translationY(dest);
- break;
- case 180:
- dest = v.getX();
- v.setX(dest + delta);
- vp.translationX(dest);
- break;
- case 270:
- dest = v.getY();
- v.setY(dest - delta);
- vp.translationY(dest);
- break;
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX(-(dest - delta));
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY(-(dest + delta));
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX(-(dest + delta));
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY(-(dest - delta));
+ vp.translationY(dest);
+ break;
+ }
+ } else {
+ switch (orientation) {
+ case 0:
+ dest = v.getX();
+ v.setX(dest - delta);
+ vp.translationX(dest);
+ break;
+ case 90:
+ dest = v.getY();
+ v.setY(dest + delta);
+ vp.translationY(dest);
+ break;
+ case 180:
+ dest = v.getX();
+ v.setX(dest + delta);
+ vp.translationX(dest);
+ break;
+ case 270:
+ dest = v.getY();
+ v.setY(dest - delta);
+ vp.translationY(dest);
+ break;
+ }
}
vp.setDuration(ANIMATION_DURATION).start();
@@ -330,7 +376,12 @@ public class VideoMenu extends MenuController
mPreviewMenuStatus = PREVIEW_MENU_IN_ANIMATION;
ViewPropertyAnimator vp = v.animate();
- vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
+ if (View.LAYOUT_DIRECTION_RTL == TextUtils
+ .getLayoutDirectionFromLocale(Locale.getDefault())) {
+ vp.translationXBy(v.getWidth()).setDuration(ANIMATION_DURATION);
+ } else {
+ vp.translationXBy(-v.getWidth()).setDuration(ANIMATION_DURATION);
+ }
vp.setListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 680a7fa68..92b5a10eb 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -429,7 +429,7 @@ public class VideoModule implements CameraModule,
mActivity = activity;
mUI = new VideoUI(activity, this, root);
mPreferences = new ComboPreferences(mActivity);
- CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal());
+ CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mCameraId = getPreferredCameraId(mPreferences);
mPreferences.setLocalId(mActivity, mCameraId);
@@ -780,10 +780,16 @@ public class VideoModule implements CameraModule,
null);
if (videoQuality == null) {
mParameters = mCameraDevice.getParameters();
+ String defaultQuality = mActivity.getResources().getString(
+ R.string.pref_video_quality_default);
+ if (!defaultQuality.equals("")){
+ videoQuality = defaultQuality;
+ } else {
// check for highest quality supported
videoQuality = CameraSettings.getSupportedHighestVideoQuality(
mCameraId, mParameters);
- mPreferences.edit().putString(CameraSettings.KEY_VIDEO_QUALITY, videoQuality);
+ }
+ mPreferences.edit().putString(CameraSettings.KEY_VIDEO_QUALITY, videoQuality).apply();
}
int quality = CameraSettings.VIDEO_QUALITY_TABLE.get(videoQuality);
@@ -1073,7 +1079,7 @@ public class VideoModule implements CameraModule,
mStartPrevPending = false;
return;
}
-
+ mErrorCallback.setActivity(mActivity);
mCameraDevice.setErrorCallback(mErrorCallback);
if (mPreviewing == true) {
stopPreview();
diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java
index cc06e7b79..8fbae5ee6 100644
--- a/src/com/android/camera/VideoUI.java
+++ b/src/com/android/camera/VideoUI.java
@@ -793,8 +793,11 @@ public class VideoUI implements PieRenderer.PieListener,
int y = Math.max(0, yBase);
if (yBase + height > screenHeight)
y = Math.max(0, screenHeight - height);
- layoutParams.setMargins(0, y, 0, 0);
- layoutParams.setMarginStart(CameraActivity.SETTING_LIST_WIDTH_1);
+ if (mRootView.getLayoutDirection() != View.LAYOUT_DIRECTION_RTL) {
+ layoutParams.setMargins(CameraActivity.SETTING_LIST_WIDTH_1, y, 0, 0);
+ } else {
+ layoutParams.setMargins(0, y, CameraActivity.SETTING_LIST_WIDTH_1, 0);
+ }
mSubMenuLayout.setLayoutParams(layoutParams);
mSubMenuLayout.addView(popup);
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index e7025a1a7..e7285fa6a 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -153,6 +153,8 @@ public class WideAnglePanoramaModule
private boolean mPreviewFocused = true;
private boolean mPreviewLayoutChanged = false;
+ private boolean mDirectionChanged = false;
+
@Override
public void onPreviewUIReady() {
configMosaicPreview();
@@ -225,9 +227,16 @@ public class WideAnglePanoramaModule
new PanoProgressBar.OnDirectionChangeListener() {
@Override
public void onDirectionChange(int direction) {
+ if (mDirectionChanged) {
+ stopCapture(false);
+ return;
+ }
if (mCaptureState == CAPTURE_STATE_MOSAIC) {
mUI.showDirectionIndicators(direction);
}
+ if (direction != PanoProgressBar.DIRECTION_NONE) {
+ mDirectionChanged = true;
+ }
}
});
@@ -282,7 +291,7 @@ public class WideAnglePanoramaModule
mDialogWaitingPreviousString = appRes.getString(R.string.pano_dialog_waiting_previous);
mPreferences = new ComboPreferences(mActivity);
- CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal());
+ CameraSettings.upgradeGlobalPreferences(mPreferences.getGlobal(), activity);
mLocationManager = new LocationManager(mActivity, null);
mMainHandler = new Handler() {
@@ -583,6 +592,7 @@ public class WideAnglePanoramaModule
}
private void stopCapture(boolean aborted) {
+ mDirectionChanged = false;
mCaptureState = CAPTURE_STATE_VIEWFINDER;
mUI.onStopCapture();
Parameters parameters = mCameraDevice.getParameters();
@@ -758,6 +768,7 @@ public class WideAnglePanoramaModule
// This function will be called upon the first camera frame is available.
private void reset() {
mCaptureState = CAPTURE_STATE_VIEWFINDER;
+ mDirectionChanged = false;
mOrientationLocked = false;
mUI.setOrientation(mDeviceOrientation, true);
@@ -921,7 +932,7 @@ public class WideAnglePanoramaModule
@Override
public void onSwitchSavePath() {
- mPreferences.edit().putString(CameraSettings.KEY_CAMERA_SAVEPATH, "1").apply();
+ mPreferences.getGlobal().edit().putString(CameraSettings.KEY_CAMERA_SAVEPATH, "1").apply();
RotateTextToast.makeText(mActivity, R.string.on_switch_save_path_to_sdcard,
Toast.LENGTH_SHORT).show();
}
@@ -1038,7 +1049,7 @@ public class WideAnglePanoramaModule
// UI is not ready.
return;
}
-
+ mErrorCallback.setActivity(mActivity);
mCameraDevice.setErrorCallback(mErrorCallback);
// This works around a driver issue. startPreview may fail if
diff --git a/src/com/android/camera/WideAnglePanoramaUI.java b/src/com/android/camera/WideAnglePanoramaUI.java
index 230c31c86..862e4d2ba 100644
--- a/src/com/android/camera/WideAnglePanoramaUI.java
+++ b/src/com/android/camera/WideAnglePanoramaUI.java
@@ -41,6 +41,7 @@ import android.view.TextureView;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -103,6 +104,8 @@ public class WideAnglePanoramaUI implements
private int mOrientation;
private int mPreviewYOffset;
private RotateLayout mWaitingDialog;
+ private RotateLayout mPanoFailedDialog;
+ private Button mPanoFailedButton;
/** Constructor. */
public WideAnglePanoramaUI(
@@ -462,6 +465,8 @@ public class WideAnglePanoramaUI implements
setPanoramaPreviewView();
mWaitingDialog = (RotateLayout) mRootView.findViewById(R.id.waitingDialog);
+ mPanoFailedDialog = (RotateLayout) mRootView.findViewById(R.id.pano_dialog_layout);
+ mPanoFailedButton = (Button) mRootView.findViewById(R.id.pano_dialog_button1);
mDialogHelper = new DialogHelper();
setViews(appRes);
}
@@ -536,16 +541,13 @@ public class WideAnglePanoramaUI implements
}
private class DialogHelper {
- private AlertDialog mAlertDialog;
DialogHelper() {
- mAlertDialog = null;
}
public void dismissAll() {
- if (mAlertDialog != null) {
- mAlertDialog.dismiss();
- mAlertDialog = null;
+ if (mPanoFailedDialog != null) {
+ mPanoFailedDialog.setVisibility(View.INVISIBLE);
}
if (mWaitingDialog != null) {
mWaitingDialog.setVisibility(View.INVISIBLE);
@@ -556,16 +558,14 @@ public class WideAnglePanoramaUI implements
CharSequence title, CharSequence message,
CharSequence buttonMessage, final Runnable buttonRunnable) {
dismissAll();
- mAlertDialog = (new AlertDialog.Builder(mActivity))
- .setTitle(title)
- .setMessage(message)
- .setNeutralButton(buttonMessage, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialogInterface, int i) {
- buttonRunnable.run();
- }
- })
- .show();
+ mPanoFailedButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ buttonRunnable.run();
+ mPanoFailedDialog.setVisibility(View.INVISIBLE);
+ }
+ });
+ mPanoFailedDialog.setVisibility(View.VISIBLE);
}
public void showWaitingDialog(CharSequence message) {
@@ -684,6 +684,7 @@ public class WideAnglePanoramaUI implements
lp.gravity = g;
button.setLayoutParams(lp);
mWaitingDialog.setRotation(-orientation);
+ mPanoFailedDialog.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 4ab74e4cf..167aec030 100644
--- a/src/com/android/camera/ui/FaceView.java
+++ b/src/com/android/camera/ui/FaceView.java
@@ -212,8 +212,8 @@ public class FaceView extends View
rh = temp;
}
CameraUtil.prepareMatrix(mMatrix, mMirror, mDisplayOrientation, rw, rh);
- int dx = 0;
- int dy = 0;
+ int dx = (getWidth() - rw) / 2;;
+ int dy = (getHeight() - rh) / 2;
// Focus indicator is directional. Rotate the matrix and the canvas
// so it looks correctly in all orientations.
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index 46267a941..3edb23d3c 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -1273,12 +1273,8 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
return;
}
- // If the layout changed, we need to adjust the current position so
- // that if an item is centered before the change, it's still centered.
- if (layoutChanged) {
- mViewItem[mCurrentItem].setLeftPosition(
- mCenterX - mViewItem[mCurrentItem].getView().getMeasuredWidth() / 2);
- }
+ mViewItem[mCurrentItem].setLeftPosition(
+ mCenterX - mViewItem[mCurrentItem].getView().getMeasuredWidth() / 2);
if (mController.isZoomStarted()) {
return;