summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/aspect_ratio_16x9_selected.pngbin0 -> 3253 bytes
-rw-r--r--res/drawable-hdpi/aspect_ratio_16x9_unselected.pngbin0 -> 2507 bytes
-rw-r--r--res/drawable-hdpi/aspect_ratio_4x3_selected.pngbin0 -> 3292 bytes
-rw-r--r--res/drawable-hdpi/aspect_ratio_4x3_unselected.pngbin0 -> 2523 bytes
-rw-r--r--res/drawable-hdpi/geo_opt_in_graphic.pngbin0 -> 8375 bytes
-rw-r--r--res/drawable-mdpi/aspect_ratio_16x9_selected.pngbin0 -> 2308 bytes
-rw-r--r--res/drawable-mdpi/aspect_ratio_16x9_unselected.pngbin0 -> 1735 bytes
-rw-r--r--res/drawable-mdpi/aspect_ratio_4x3_selected.pngbin0 -> 2322 bytes
-rw-r--r--res/drawable-mdpi/aspect_ratio_4x3_unselected.pngbin0 -> 1747 bytes
-rw-r--r--res/drawable-mdpi/geo_opt_in_graphic.pngbin0 -> 5995 bytes
-rw-r--r--res/drawable-xhdpi/aspect_ratio_16x9_selected.pngbin0 -> 4897 bytes
-rw-r--r--res/drawable-xhdpi/aspect_ratio_16x9_unselected.pngbin0 -> 3557 bytes
-rw-r--r--res/drawable-xhdpi/aspect_ratio_4x3_selected.pngbin0 -> 4840 bytes
-rw-r--r--res/drawable-xhdpi/aspect_ratio_4x3_unselected.pngbin0 -> 3598 bytes
-rw-r--r--res/drawable-xhdpi/geo_opt_in_graphic.pngbin0 -> 12549 bytes
-rw-r--r--res/drawable-xxhdpi/aspect_ratio_16x9_selected.pngbin0 -> 5875 bytes
-rw-r--r--res/drawable-xxhdpi/aspect_ratio_16x9_unselected.pngbin0 -> 4950 bytes
-rw-r--r--res/drawable-xxhdpi/aspect_ratio_4x3_selected.pngbin0 -> 5919 bytes
-rw-r--r--res/drawable-xxhdpi/aspect_ratio_4x3_unselected.pngbin0 -> 5003 bytes
-rw-r--r--res/drawable-xxhdpi/geo_opt_in_graphic.pngbin0 -> 15387 bytes
-rw-r--r--res/drawable/aspect_ratio_16x9.xml20
-rw-r--r--res/drawable/aspect_ratio_4x3.xml20
-rw-r--r--res/layout-land/aspect_ratio_dialog_content.xml63
-rw-r--r--res/layout-land/aspect_ratio_selector.xml65
-rw-r--r--res/layout-land/location_dialog_content.xml78
-rw-r--r--res/layout-port/aspect_ratio_dialog_content.xml54
-rw-r--r--res/layout-port/aspect_ratio_selector.xml66
-rw-r--r--res/layout-port/location_dialog_content.xml66
-rw-r--r--res/layout/aspect_ratio_dialog_layout.xml22
-rw-r--r--res/layout/location_dialog_layout.xml22
-rw-r--r--res/values/colors.xml3
-rw-r--r--res/values/strings.xml12
-rw-r--r--src/com/android/camera/CameraActivity.java8
-rw-r--r--src/com/android/camera/PhotoModule.java177
-rw-r--r--src/com/android/camera/PhotoUI.java85
-rw-r--r--src/com/android/camera/settings/SettingsCache.java6
-rw-r--r--src/com/android/camera/settings/SettingsManager.java16
-rw-r--r--src/com/android/camera/widget/AspectRatioDialogLayout.java97
-rw-r--r--src/com/android/camera/widget/AspectRatioSelector.java88
-rw-r--r--src/com/android/camera/widget/LocationDialogLayout.java100
40 files changed, 1053 insertions, 15 deletions
diff --git a/res/drawable-hdpi/aspect_ratio_16x9_selected.png b/res/drawable-hdpi/aspect_ratio_16x9_selected.png
new file mode 100644
index 000000000..4511078bb
--- /dev/null
+++ b/res/drawable-hdpi/aspect_ratio_16x9_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/aspect_ratio_16x9_unselected.png b/res/drawable-hdpi/aspect_ratio_16x9_unselected.png
new file mode 100644
index 000000000..f0cb71a42
--- /dev/null
+++ b/res/drawable-hdpi/aspect_ratio_16x9_unselected.png
Binary files differ
diff --git a/res/drawable-hdpi/aspect_ratio_4x3_selected.png b/res/drawable-hdpi/aspect_ratio_4x3_selected.png
new file mode 100644
index 000000000..da3dd1fb0
--- /dev/null
+++ b/res/drawable-hdpi/aspect_ratio_4x3_selected.png
Binary files differ
diff --git a/res/drawable-hdpi/aspect_ratio_4x3_unselected.png b/res/drawable-hdpi/aspect_ratio_4x3_unselected.png
new file mode 100644
index 000000000..d52516b11
--- /dev/null
+++ b/res/drawable-hdpi/aspect_ratio_4x3_unselected.png
Binary files differ
diff --git a/res/drawable-hdpi/geo_opt_in_graphic.png b/res/drawable-hdpi/geo_opt_in_graphic.png
new file mode 100644
index 000000000..3648610ae
--- /dev/null
+++ b/res/drawable-hdpi/geo_opt_in_graphic.png
Binary files differ
diff --git a/res/drawable-mdpi/aspect_ratio_16x9_selected.png b/res/drawable-mdpi/aspect_ratio_16x9_selected.png
new file mode 100644
index 000000000..09b0b5b43
--- /dev/null
+++ b/res/drawable-mdpi/aspect_ratio_16x9_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/aspect_ratio_16x9_unselected.png b/res/drawable-mdpi/aspect_ratio_16x9_unselected.png
new file mode 100644
index 000000000..87b4aca1a
--- /dev/null
+++ b/res/drawable-mdpi/aspect_ratio_16x9_unselected.png
Binary files differ
diff --git a/res/drawable-mdpi/aspect_ratio_4x3_selected.png b/res/drawable-mdpi/aspect_ratio_4x3_selected.png
new file mode 100644
index 000000000..f99503099
--- /dev/null
+++ b/res/drawable-mdpi/aspect_ratio_4x3_selected.png
Binary files differ
diff --git a/res/drawable-mdpi/aspect_ratio_4x3_unselected.png b/res/drawable-mdpi/aspect_ratio_4x3_unselected.png
new file mode 100644
index 000000000..601418329
--- /dev/null
+++ b/res/drawable-mdpi/aspect_ratio_4x3_unselected.png
Binary files differ
diff --git a/res/drawable-mdpi/geo_opt_in_graphic.png b/res/drawable-mdpi/geo_opt_in_graphic.png
new file mode 100644
index 000000000..d640d3635
--- /dev/null
+++ b/res/drawable-mdpi/geo_opt_in_graphic.png
Binary files differ
diff --git a/res/drawable-xhdpi/aspect_ratio_16x9_selected.png b/res/drawable-xhdpi/aspect_ratio_16x9_selected.png
new file mode 100644
index 000000000..9dc774b81
--- /dev/null
+++ b/res/drawable-xhdpi/aspect_ratio_16x9_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/aspect_ratio_16x9_unselected.png b/res/drawable-xhdpi/aspect_ratio_16x9_unselected.png
new file mode 100644
index 000000000..5cdce3fab
--- /dev/null
+++ b/res/drawable-xhdpi/aspect_ratio_16x9_unselected.png
Binary files differ
diff --git a/res/drawable-xhdpi/aspect_ratio_4x3_selected.png b/res/drawable-xhdpi/aspect_ratio_4x3_selected.png
new file mode 100644
index 000000000..801f40445
--- /dev/null
+++ b/res/drawable-xhdpi/aspect_ratio_4x3_selected.png
Binary files differ
diff --git a/res/drawable-xhdpi/aspect_ratio_4x3_unselected.png b/res/drawable-xhdpi/aspect_ratio_4x3_unselected.png
new file mode 100644
index 000000000..87c29f079
--- /dev/null
+++ b/res/drawable-xhdpi/aspect_ratio_4x3_unselected.png
Binary files differ
diff --git a/res/drawable-xhdpi/geo_opt_in_graphic.png b/res/drawable-xhdpi/geo_opt_in_graphic.png
new file mode 100644
index 000000000..95ceabb38
--- /dev/null
+++ b/res/drawable-xhdpi/geo_opt_in_graphic.png
Binary files differ
diff --git a/res/drawable-xxhdpi/aspect_ratio_16x9_selected.png b/res/drawable-xxhdpi/aspect_ratio_16x9_selected.png
new file mode 100644
index 000000000..da656e4fe
--- /dev/null
+++ b/res/drawable-xxhdpi/aspect_ratio_16x9_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/aspect_ratio_16x9_unselected.png b/res/drawable-xxhdpi/aspect_ratio_16x9_unselected.png
new file mode 100644
index 000000000..cfb9ad049
--- /dev/null
+++ b/res/drawable-xxhdpi/aspect_ratio_16x9_unselected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/aspect_ratio_4x3_selected.png b/res/drawable-xxhdpi/aspect_ratio_4x3_selected.png
new file mode 100644
index 000000000..9364b9afa
--- /dev/null
+++ b/res/drawable-xxhdpi/aspect_ratio_4x3_selected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/aspect_ratio_4x3_unselected.png b/res/drawable-xxhdpi/aspect_ratio_4x3_unselected.png
new file mode 100644
index 000000000..2e7024eca
--- /dev/null
+++ b/res/drawable-xxhdpi/aspect_ratio_4x3_unselected.png
Binary files differ
diff --git a/res/drawable-xxhdpi/geo_opt_in_graphic.png b/res/drawable-xxhdpi/geo_opt_in_graphic.png
new file mode 100644
index 000000000..6144b1b62
--- /dev/null
+++ b/res/drawable-xxhdpi/geo_opt_in_graphic.png
Binary files differ
diff --git a/res/drawable/aspect_ratio_16x9.xml b/res/drawable/aspect_ratio_16x9.xml
new file mode 100644
index 000000000..1a5e99310
--- /dev/null
+++ b/res/drawable/aspect_ratio_16x9.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/aspect_ratio_16x9_selected" />
+ <item android:drawable="@drawable/aspect_ratio_16x9_unselected"/>
+</selector> \ No newline at end of file
diff --git a/res/drawable/aspect_ratio_4x3.xml b/res/drawable/aspect_ratio_4x3.xml
new file mode 100644
index 000000000..0671aa3c2
--- /dev/null
+++ b/res/drawable/aspect_ratio_4x3.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_selected="true" android:drawable="@drawable/aspect_ratio_4x3_selected" />
+ <item android:drawable="@drawable/aspect_ratio_4x3_unselected"/>
+</selector> \ No newline at end of file
diff --git a/res/layout-land/aspect_ratio_dialog_content.xml b/res/layout-land/aspect_ratio_dialog_content.xml
new file mode 100644
index 000000000..db1270cb4
--- /dev/null
+++ b/res/layout-land/aspect_ratio_dialog_content.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:background="@color/start_up_dialog_background_color"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <FrameLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_weight="1">
+ <include layout="@layout/aspect_ratio_selector"/>
+ </FrameLayout>
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:layout_marginLeft="16dp"
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:layout_weight="1">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/photo_size_selection_title"
+ android:textSize="22sp"
+ android:textColor="@color/dialog_text_color"
+ android:layout_marginBottom="28dp" />
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="56dp"
+ android:layout_weight="1"
+ android:textSize="20sp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center_horizontal"
+ android:text="@string/photo_aspect_ratio_selection_content"/>
+ <Button
+ android:id="@+id/confirm_button"
+ android:layout_width="144dp"
+ android:layout_height="48dp"
+ android:background="@color/dialog_button_color"
+ android:text="@string/confirm_button_text"
+ android:textColor="@android:color/white"/>
+ </LinearLayout>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-land/aspect_ratio_selector.xml b/res/layout-land/aspect_ratio_selector.xml
new file mode 100644
index 000000000..c834d5c90
--- /dev/null
+++ b/res/layout-land/aspect_ratio_selector.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.camera.widget.AspectRatioSelector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/aspect_ratio_selector"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center">
+ <ImageView
+ android:id="@+id/aspect_ratio_4x3_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/aspect_ratio_4x3"
+ android:layout_marginRight="28dp"/>
+ <ImageView
+ android:id="@+id/aspect_ratio_16x9_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/aspect_ratio_16x9" />
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="28dp"
+ android:layout_marginLeft="28dp"
+ android:layout_marginRight="28dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/text_4x3"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center"
+ android:layout_weight="1"/>
+ <TextView
+ android:id="@+id/text_16x9"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center"
+ android:layout_weight="1"/>
+ </LinearLayout>
+</com.android.camera.widget.AspectRatioSelector> \ No newline at end of file
diff --git a/res/layout-land/location_dialog_content.xml b/res/layout-land/location_dialog_content.xml
new file mode 100644
index 000000000..e5e418daf
--- /dev/null
+++ b/res/layout-land/location_dialog_content.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:gravity="center_horizontal"
+ android:background="@color/start_up_dialog_background_color"
+ android:paddingTop="28dp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <LinearLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:gravity="center"
+ android:layout_marginLeft="16dp"
+ android:layout_weight="1">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/remember_location_title"
+ android:textSize="22sp"
+ android:textColor="@color/dialog_text_color"
+ android:layout_marginBottom="28dp" />
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/geo_opt_in_graphic" />
+ </LinearLayout>
+
+ <FrameLayout
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_marginLeft="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_weight="1">
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical">
+ <CheckBox
+ android:id="@+id/check_box"
+ android:layout_width="44dp"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/check_box_touch_delegate"
+ android:layout_width="match_parent"
+ android:layout_height="141dp"
+ android:layout_marginLeft="44dp"
+ android:layout_marginBottom="104dp"
+ android:text="@string/remember_location_prompt"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"/>
+ <Button
+ android:id="@+id/confirm_button"
+ android:layout_width="144dp"
+ android:layout_height="48dp"
+ android:text="@string/startup_dialog_button_next"
+ android:textColor="@android:color/white"
+ android:background="@color/dialog_button_color"
+ android:layout_gravity="bottom|center_horizontal" />
+ </FrameLayout>
+ </FrameLayout>
+
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-port/aspect_ratio_dialog_content.xml b/res/layout-port/aspect_ratio_dialog_content.xml
new file mode 100644
index 000000000..4a277d49f
--- /dev/null
+++ b/res/layout-port/aspect_ratio_dialog_content.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:paddingLeft="16dp"
+ android:paddingRight="16dp"
+ android:background="@color/start_up_dialog_background_color"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/photo_size_selection_title"
+ android:textSize="22sp"
+ android:textColor="@color/dialog_text_color"
+ android:layout_marginTop="28dp"
+ android:layout_marginBottom="56dp" />
+ <include layout="@layout/aspect_ratio_selector"/>
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginTop="56dp"
+ android:layout_weight="1"
+ android:textSize="20sp"
+ android:layout_marginLeft="28dp"
+ android:layout_marginRight="28dp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center_horizontal"
+ android:text="@string/photo_aspect_ratio_selection_content"/>
+ <Button
+ android:id="@+id/confirm_button"
+ android:layout_width="144dp"
+ android:layout_height="48dp"
+ android:layout_marginTop="28dp"
+ android:layout_marginBottom="28dp"
+ android:background="@color/dialog_button_color"
+ android:text="@string/confirm_button_text"
+ android:textColor="@android:color/white"/>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout-port/aspect_ratio_selector.xml b/res/layout-port/aspect_ratio_selector.xml
new file mode 100644
index 000000000..3e688bcf2
--- /dev/null
+++ b/res/layout-port/aspect_ratio_selector.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.camera.widget.AspectRatioSelector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/aspect_ratio_selector"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center">
+ <ImageView
+ android:id="@+id/aspect_ratio_4x3_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/aspect_ratio_4x3"
+ android:layout_marginRight="28dp"/>
+ <ImageView
+ android:id="@+id/aspect_ratio_16x9_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/aspect_ratio_16x9"
+ android:layout_marginLeft="28dp"/>
+ </LinearLayout>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="28dp"
+ android:layout_marginLeft="28dp"
+ android:layout_marginRight="28dp"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/text_4x3"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center"
+ android:layout_weight="1"/>
+ <TextView
+ android:id="@+id/text_16x9"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"
+ android:gravity="center"
+ android:layout_weight="1"/>
+ </LinearLayout>
+</com.android.camera.widget.AspectRatioSelector> \ No newline at end of file
diff --git a/res/layout-port/location_dialog_content.xml b/res/layout-port/location_dialog_content.xml
new file mode 100644
index 000000000..4239eab4f
--- /dev/null
+++ b/res/layout-port/location_dialog_content.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:gravity="center_horizontal"
+ android:background="@color/start_up_dialog_background_color"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/remember_location_title"
+ android:textSize="22sp"
+ android:textColor="@color/dialog_text_color"
+ android:layout_marginTop="28dp"
+ android:layout_marginBottom="28dp" />
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/geo_opt_in_graphic"
+ android:layout_marginBottom="56dp"/>
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_marginLeft="44dp"
+ android:layout_marginRight="44dp"
+ android:orientation="horizontal"
+ android:layout_weight="1">
+ <CheckBox
+ android:id="@+id/check_box"
+ android:layout_width="44dp"
+ android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/check_box_touch_delegate"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:text="@string/remember_location_prompt"
+ android:textSize="16sp"
+ android:textColor="@color/dialog_text_color"
+ android:layout_weight="1"/>
+
+ </LinearLayout>
+ <Button
+ android:id="@+id/confirm_button"
+ android:layout_width="144dp"
+ android:layout_height="48dp"
+ android:text="@string/startup_dialog_button_next"
+ android:textColor="@android:color/white"
+ android:background="@color/dialog_button_color"
+ android:layout_marginBottom="28dp"
+ android:layout_marginTop="28dp"/>
+</LinearLayout> \ No newline at end of file
diff --git a/res/layout/aspect_ratio_dialog_layout.xml b/res/layout/aspect_ratio_dialog_layout.xml
new file mode 100644
index 000000000..7e0338cfd
--- /dev/null
+++ b/res/layout/aspect_ratio_dialog_layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.camera.widget.AspectRatioDialogLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <include layout="@layout/aspect_ratio_dialog_content" />
+</com.android.camera.widget.AspectRatioDialogLayout> \ No newline at end of file
diff --git a/res/layout/location_dialog_layout.xml b/res/layout/location_dialog_layout.xml
new file mode 100644
index 000000000..f542818ae
--- /dev/null
+++ b/res/layout/location_dialog_layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<com.android.camera.widget.LocationDialogLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <include layout="@layout/location_dialog_content"/>
+</com.android.camera.widget.LocationDialogLayout> \ No newline at end of file
diff --git a/res/values/colors.xml b/res/values/colors.xml
index c78c2bc80..4fd29355c 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -99,4 +99,7 @@
<color name="grid_line">#33FFFFFF</color>
<color name="focus_outer_ring_color">#4CFFFFFF</color>
+ <color name="start_up_dialog_background_color">#D6D6D6</color>
+ <color name="dialog_button_color">#FF76A7F9</color>
+ <color name="dialog_text_color">#6D6D6D</color>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ca847c039..913f095c5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -906,4 +906,16 @@ CHAR LIMIT=NONE] -->
<!-- Shown above the intent chooser when the user is about to edit an item. [CHAR LIMIT=20] -->
<string name="edit_with">Edit with</string>
+ <!-- Text on the button to take user to the next page of the on-screen instructions. [CHAR LIMIT=20] -->
+ <string name="startup_dialog_button_next">NEXT</string>
+
+ <!-- Text on the button to confirm that user understands the on-screen instructions. [CHAR LIMIT=20] -->
+ <string name="confirm_button_text">OK, GOT IT</string>
+
+ <!-- Text on the photo size selection page for the megapixel count of the 4:3 picture size. [CHAR LIMIT=20] -->
+ <string name="megapixel_text_for_4x3_aspect_ratio">%d Megapixel \n(4:3)</string>
+
+ <!-- Text on the photo size selection page for the megapixel count of the 16:9 picture size. [CHAR LIMIT=20] -->
+ <string name="megapixel_text_for_16x9_aspect_ratio">%d Megapixel \n(16:9)</string>
+
</resources>
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 684463891..fbfd7eff4 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1387,6 +1387,14 @@ public class CameraActivity extends Activity
|| MediaStore.ACTION_IMAGE_CAPTURE_SECURE.equals(getIntent().getAction())) {
modeIndex = mSettingsManager.getInt(
SettingsManager.SETTING_KEY_CAMERA_MODULE_LAST_USED_INDEX);
+
+ // For upgraders who have not seen the aspect ratio selection screen,
+ // we need to drop them back in the photo module and have them select
+ // aspect ratio.
+ // TODO: Move this to SettingsManager as an upgrade procedure.
+ if (!mSettingsManager.getBoolean(SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO)) {
+ modeIndex = photoIndex;
+ }
} else {
// If the activity has not been started using an explicit intent,
// read the module index from the last time the user changed modes
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index b4b26f59f..4dc0cdbd4 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -21,6 +21,7 @@ import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.SurfaceTexture;
@@ -77,6 +78,7 @@ import com.android.camera.util.GcamHelper;
import com.android.camera.util.SessionStatsCollector;
import com.android.camera.util.Size;
import com.android.camera.util.UsageStatistics;
+import com.android.camera.widget.AspectRatioSelector;
import com.android.camera2.R;
import com.google.common.logging.eventprotos;
@@ -269,6 +271,48 @@ public class PhotoModule
}
};
+ /**
+ * This callback gets called when user select whether or not to
+ * turn on geo-tagging.
+ */
+ public interface LocationDialogCallback {
+ /**
+ * Gets called after user selected/unselected geo-tagging feature.
+ *
+ * @param selected whether or not geo-tagging feature is selected
+ */
+ public void onLocationTaggingSelected(boolean selected);
+ }
+
+ /**
+ * This callback defines the text that is shown in the aspect ratio selection
+ * dialog, provides the current aspect ratio, and gets notified when user changes
+ * aspect ratio selection in the dialog.
+ */
+ public interface AspectRatioDialogCallback {
+ /**
+ * Returns text to show for 4:3 aspect ratio.
+ */
+ public String get4x3AspectRatioText();
+
+ /**
+ * Returns text to show for 16:9 aspect ratio.
+ */
+ public String get16x9AspectRatioText();
+
+ /**
+ * Returns current aspect ratio that is being used to set as default.
+ */
+ public AspectRatioSelector.AspectRatio getCurrentAspectRatio();
+
+ /**
+ * Gets notified when user has made the aspect ratio selection.
+ *
+ * @param newAspectRatio aspect ratio that user has selected
+ */
+ public void onAspectRatioSelected(AspectRatioSelector.AspectRatio newAspectRatio);
+ }
+
private void checkDisplayRotation() {
// Set the display orientation if display rotation has changed.
// Sometimes this happens when the device is held upside
@@ -361,6 +405,13 @@ public class PhotoModule
SettingsManager settingsManager = mActivity.getSettingsManager();
mCameraId = Integer.parseInt(settingsManager.get(SettingsManager.SETTING_CAMERA_ID));
+ // TODO: Move this to SettingsManager as a part of upgrade procedure.
+ if (!settingsManager.getBoolean(SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO)) {
+ // Switch to back camera to set aspect ratio.
+ mCameraId = Integer.parseInt(settingsManager
+ .getDefaultCameraIdSetting(activity).getDefault());
+ }
+
mContentResolver = mActivity.getContentResolver();
// Surface texture is from camera screen nail and startPreview needs it.
@@ -390,27 +441,137 @@ public class PhotoModule
mAppController.onPreviewStarted();
setCameraState(IDLE);
startFaceDetection();
- locationFirstRun();
+ settingsFirstRun();
}
- // Prompt the user to pick to record location for the very first run of
- // camera only
- private void locationFirstRun() {
- SettingsManager settingsManager = mActivity.getSettingsManager();
+ /**
+ * Prompt the user to pick to record location and choose aspect ratio for the
+ * very first run of camera only.
+ */
+ private void settingsFirstRun() {
+ final SettingsManager settingsManager = mActivity.getSettingsManager();
- if (settingsManager.isSet(SettingsManager.SETTING_RECORD_LOCATION)) {
+ if (mActivity.isSecureCamera() || isImageCaptureIntent()) {
return;
}
- if (mActivity.isSecureCamera()) {
+
+ boolean locationPrompt = !settingsManager.isSet(SettingsManager.SETTING_RECORD_LOCATION);
+ boolean aspectRatioPrompt = !settingsManager.getBoolean(
+ SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO);
+ if (!locationPrompt && !aspectRatioPrompt) {
return;
}
+
// Check if the back camera exists
int backCameraId = mAppController.getCameraProvider().getFirstBackCameraId();
if (backCameraId == -1) {
// If there is no back camera, do not show the prompt.
return;
}
- mUI.showLocationDialog();
+
+ if (locationPrompt) {
+ // Show both location and aspect ratio selection dialog.
+ mUI.showLocationAndAspectRatioDialog(new LocationDialogCallback(){
+ public void onLocationTaggingSelected(boolean selected) {
+ settingsManager.setLocation(selected, mActivity.getLocationManager());
+ }
+ }, createAspectRatioDialogCallback());
+ } else {
+ // App upgrade. Only show aspect ratio selection.
+ mUI.showAspectRatioDialog(createAspectRatioDialogCallback());
+ }
+ }
+
+ private AspectRatioDialogCallback createAspectRatioDialogCallback() {
+ Size currentSize = new Size(mParameters.getPictureSize());
+ float aspectRatio = (float) currentSize.width() / (float) currentSize.height();
+ if (aspectRatio < 1f) {
+ aspectRatio = 1 / aspectRatio;
+ }
+ final AspectRatioSelector.AspectRatio currentAspectRatio;
+ if (Math.abs(aspectRatio - 4f / 3f) <= 0.1f) {
+ currentAspectRatio = AspectRatioSelector.AspectRatio.ASPECT_RATIO_4x3;
+ } else if (Math.abs(aspectRatio - 16f / 9f) <= 0.1f) {
+ currentAspectRatio = AspectRatioSelector.AspectRatio.ASPECT_RATIO_16x9;
+ } else {
+ // TODO: Log error and not show dialog.
+ return null;
+ }
+
+ List<Size> sizes = Size.buildListFromCameraSizes(mParameters.getSupportedPictureSizes());
+ List<Size> pictureSizes = ResolutionUtil
+ .getDisplayableSizesFromSupported(sizes, true);
+
+ // This logic below finds the largest resolution for each aspect ratio.
+ // TODO: Move this somewhere that can be shared with SettingsActivity
+ int aspectRatio4x3Resolution = 0;
+ int aspectRatio16x9Resolution = 0;
+ Size largestSize4x3 = new Size(0, 0);
+ Size largestSize16x9 = new Size(0, 0);
+ for (Size size : pictureSizes) {
+ float pictureAspectRatio = (float) size.width() / (float) size.height();
+ pictureAspectRatio = pictureAspectRatio < 1 ?
+ 1f / pictureAspectRatio : pictureAspectRatio;
+ int resolution = size.width() * size.height();
+ if (Math.abs(pictureAspectRatio - 4f / 3f) < 0.1f) {
+ if (resolution > aspectRatio4x3Resolution) {
+ aspectRatio4x3Resolution = resolution;
+ largestSize4x3 = size;
+ }
+ } else if (Math.abs(pictureAspectRatio - 16f / 9f) < 0.1f) {
+ if (resolution > aspectRatio16x9Resolution) {
+ aspectRatio16x9Resolution = resolution;
+ largestSize16x9 = size;
+ }
+ }
+ }
+ aspectRatio16x9Resolution /= 1000000;
+ aspectRatio4x3Resolution /= 1000000;
+
+ final String largestSize4x3Text = SettingsUtil.sizeToSetting(largestSize4x3);
+ final String largestSize16x9Text = SettingsUtil.sizeToSetting(largestSize16x9);
+
+ Resources res = mAppController.getAndroidContext().getResources();
+ final String aspectRatio4x3Text = res.getString(R.string.megapixel_text_for_4x3_aspect_ratio,
+ aspectRatio4x3Resolution);
+ final String aspectRatio16x9Text = res.getString(R.string.megapixel_text_for_16x9_aspect_ratio,
+ aspectRatio16x9Resolution);
+
+ AspectRatioDialogCallback callback = new AspectRatioDialogCallback() {
+ @Override
+ public String get4x3AspectRatioText() {
+ return aspectRatio4x3Text;
+ }
+
+ @Override
+ public String get16x9AspectRatioText() {
+ return aspectRatio16x9Text;
+ }
+
+ @Override
+ public AspectRatioSelector.AspectRatio getCurrentAspectRatio() {
+ return currentAspectRatio;
+ }
+
+ @Override
+ public void onAspectRatioSelected(AspectRatioSelector.AspectRatio newAspectRatio) {
+ if (newAspectRatio == AspectRatioSelector.AspectRatio.ASPECT_RATIO_4x3) {
+ mActivity.getSettingsManager().set(SettingsManager.SETTING_PICTURE_SIZE_BACK,
+ largestSize4x3Text);
+ } else if (newAspectRatio == AspectRatioSelector.AspectRatio.ASPECT_RATIO_16x9) {
+ mActivity.getSettingsManager().set(SettingsManager.SETTING_PICTURE_SIZE_BACK,
+ largestSize16x9Text);
+ }
+ mActivity.getSettingsManager().setBoolean(
+ SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO, true);
+ if (newAspectRatio != currentAspectRatio) {
+ // TODO: Need to re-introduce the mode cover here to avoid jank.
+ stopPreview();
+ startPreview();
+ }
+ }
+ };
+ return callback;
}
@Override
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 1de6d0428..1fbdced4b 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -16,7 +16,8 @@
package com.android.camera;
-import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.graphics.SurfaceTexture;
@@ -35,6 +36,9 @@ import com.android.camera.ui.FaceView;
import com.android.camera.ui.PreviewOverlay;
import com.android.camera.ui.PreviewStatusListener;
import com.android.camera.util.CameraUtil;
+import com.android.camera.widget.AspectRatioDialogLayout;
+import com.android.camera.widget.AspectRatioSelector;
+import com.android.camera.widget.LocationDialogLayout;
import com.android.camera2.R;
import java.util.List;
@@ -52,6 +56,7 @@ public class PhotoUI implements PreviewStatusListener,
private final PhotoController mController;
private final View mRootView;
+ private Dialog mDialog = null;
// TODO: Remove face view logic if UX does not bring it back within a month.
private FaceView mFaceView = null;
@@ -72,6 +77,13 @@ public class PhotoUI implements PreviewStatusListener,
return true;
}
};
+ private final DialogInterface.OnDismissListener mOnDismissListener
+ = new DialogInterface.OnDismissListener() {
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ mDialog = null;
+ }
+ };
@Override
public GestureDetector.OnGestureListener getGestureListener() {
@@ -237,9 +249,71 @@ public class PhotoUI implements PreviewStatusListener,
// Removes pie menu.
}
- public void showLocationDialog() {
- AlertDialog alert = mActivity.getFirstTimeLocationAlert();
- alert.show();
+ public void showLocationAndAspectRatioDialog(
+ final PhotoModule.LocationDialogCallback locationCallback,
+ final PhotoModule.AspectRatioDialogCallback aspectRatioDialogCallback) {
+ setDialog(new Dialog(mActivity,
+ android.R.style.Theme_Black_NoTitleBar_Fullscreen));
+ final LocationDialogLayout locationDialogLayout = (LocationDialogLayout) mActivity
+ .getLayoutInflater().inflate(R.layout.location_dialog_layout, null);
+ locationDialogLayout.setLocationTaggingSelectionListener(
+ new LocationDialogLayout.LocationTaggingSelectionListener() {
+ @Override
+ public void onLocationTaggingSelected(boolean selected) {
+ // Update setting.
+ locationCallback.onLocationTaggingSelected(selected);
+ // Go to next page.
+ showAspectRatioDialog(aspectRatioDialogCallback, mDialog);
+ }
+ });
+ mDialog.setContentView(locationDialogLayout, new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ mDialog.show();
+ }
+
+ /**
+ * Dismisses previous dialog if any, sets current dialog to the given dialog,
+ * and set the on dismiss listener for the given dialog.
+ * @param dialog dialog to show
+ */
+ private void setDialog(Dialog dialog) {
+ if (mDialog != null) {
+ mDialog.setOnDismissListener(null);
+ mDialog.dismiss();
+ }
+ mDialog = dialog;
+ if (mDialog != null) {
+ mDialog.setOnDismissListener(mOnDismissListener);
+ }
+ }
+
+ public void showAspectRatioDialog(final PhotoModule.AspectRatioDialogCallback callback) {
+ setDialog(new Dialog(mActivity, android.R.style.Theme_Black_NoTitleBar_Fullscreen));
+ showAspectRatioDialog(callback, mDialog);
+ }
+
+ private void showAspectRatioDialog(final PhotoModule.AspectRatioDialogCallback callback,
+ final Dialog aspectRatioDialog) {
+ if (aspectRatioDialog == null) {
+ Log.e(TAG, "Dialog for aspect ratio is null.");
+ return;
+ }
+ final AspectRatioDialogLayout aspectRatioDialogLayout =
+ (AspectRatioDialogLayout) mActivity
+ .getLayoutInflater().inflate(R.layout.aspect_ratio_dialog_layout, null);
+ aspectRatioDialogLayout.initialize(
+ new AspectRatioDialogLayout.AspectRatioChangedListener() {
+ @Override
+ public void onAspectRatioChanged(AspectRatioSelector.AspectRatio aspectRatio) {
+ aspectRatioDialog.dismiss();
+ // callback to set picture size.
+ callback.onAspectRatioSelected(aspectRatio);
+ }
+ }, callback.get4x3AspectRatioText(), callback.get16x9AspectRatioText(),
+ callback.getCurrentAspectRatio());
+ aspectRatioDialog.setContentView(aspectRatioDialogLayout, new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
+ aspectRatioDialog.show();
}
public void initializeZoom(Camera.Parameters params) {
@@ -313,6 +387,9 @@ public class PhotoUI implements PreviewStatusListener,
public void onPause() {
if (mFaceView != null) mFaceView.clear();
+ if (mDialog != null) {
+ mDialog.dismiss();
+ }
}
public void clearFaces() {
diff --git a/src/com/android/camera/settings/SettingsCache.java b/src/com/android/camera/settings/SettingsCache.java
index b3a1e0e19..e89bbd02f 100644
--- a/src/com/android/camera/settings/SettingsCache.java
+++ b/src/com/android/camera/settings/SettingsCache.java
@@ -135,6 +135,8 @@ public class SettingsCache {
SettingsManager.SETTING_SHOULD_SHOW_REFOCUS_VIEWER_CLING);
mKeyMap.put(SettingsManager.KEY_EXPOSURE_COMPENSATION_ENABLED,
SettingsManager.SETTING_EXPOSURE_COMPENSATION_ENABLED);
+ mKeyMap.put(SettingsManager.KEY_USER_SELECTED_ASPECT_RATIO,
+ SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO);
}
/**
@@ -192,7 +194,7 @@ public class SettingsCache {
case SettingsManager.SETTING_VIDEO_EFFECT:
return SettingsManager.getVideoEffectSetting(mContext);
case SettingsManager.SETTING_CAMERA_ID:
- return SettingsManager.getDefaultCameraIdSetting(mContext, mCapabilities);
+ return SettingsManager.getDefaultCameraIdSetting(mContext);
case SettingsManager.SETTING_CAMERA_HDR:
return SettingsManager.getHdrSetting(mContext);
case SettingsManager.SETTING_CAMERA_HDR_PLUS:
@@ -221,6 +223,8 @@ public class SettingsCache {
return SettingsManager.getShouldShowRefocusViewerCling(mContext);
case SettingsManager.SETTING_EXPOSURE_COMPENSATION_ENABLED:
return SettingsManager.getManualExposureCompensationSetting(mContext);
+ case SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO:
+ return SettingsManager.getUserSelectedAspectRatioSetting(mContext);
default:
return mExtraSettings.settingFromId(id, mContext);
}
diff --git a/src/com/android/camera/settings/SettingsManager.java b/src/com/android/camera/settings/SettingsManager.java
index e92c2a7b4..288bc8622 100644
--- a/src/com/android/camera/settings/SettingsManager.java
+++ b/src/com/android/camera/settings/SettingsManager.java
@@ -393,6 +393,7 @@ public class SettingsManager {
public static final int SETTING_REQUEST_RETURN_HDR_PLUS = 30;
public static final int SETTING_SHOULD_SHOW_REFOCUS_VIEWER_CLING = 31;
public static final int SETTING_EXPOSURE_COMPENSATION_ENABLED = 32;
+ public static final int SETTING_USER_SELECTED_ASPECT_RATIO = 33;
// Shared preference keys.
public static final String KEY_RECORD_LOCATION = "pref_camera_recordlocation_key";
@@ -431,6 +432,7 @@ public class SettingsManager {
"pref_should_show_refocus_viewer_cling";
public static final String KEY_EXPOSURE_COMPENSATION_ENABLED =
"pref_camera_exposure_compensation_key";
+ public static final String KEY_USER_SELECTED_ASPECT_RATIO = "pref_user_selected_aspect_ratio";
public static final int WHITE_BALANCE_DEFAULT_INDEX = 2;
@@ -952,6 +954,13 @@ public class SettingsManager {
values, FLUSH_OFF);
}
+ public static Setting getUserSelectedAspectRatioSetting(Context context) {
+ String defaultValue = context.getString(R.string.setting_off_value);
+ String[] values = null;
+ return new Setting(SOURCE_DEFAULT, TYPE_BOOLEAN, defaultValue,
+ KEY_USER_SELECTED_ASPECT_RATIO, values, FLUSH_OFF);
+ }
+
public static Setting getManualExposureCompensationSetting(Context context) {
String defaultValue = context.getString(R.string.setting_off_value);
String[] values = null;
@@ -973,8 +982,7 @@ public class SettingsManager {
values, FLUSH_OFF);
}
- public static Setting getDefaultCameraIdSetting(Context context,
- SettingsCapabilities capabilities) {
+ public static Setting getDefaultCameraIdSetting(Context context) {
String defaultValue = context.getString(R.string.pref_camera_id_default);
String[] values = context.getResources().getStringArray(
R.array.camera_id_entryvalues);
@@ -1217,6 +1225,10 @@ public class SettingsManager {
locationManager.recordLocation(on);
}
+ public void setAspectRatioSelected() {
+ setBoolean(SettingsManager.SETTING_USER_SELECTED_ASPECT_RATIO, true);
+ }
+
public void setManualExposureCompensation(boolean on) {
setBoolean(SettingsManager.SETTING_EXPOSURE_COMPENSATION_ENABLED, on);
}
diff --git a/src/com/android/camera/widget/AspectRatioDialogLayout.java b/src/com/android/camera/widget/AspectRatioDialogLayout.java
new file mode 100644
index 000000000..04c086396
--- /dev/null
+++ b/src/com/android/camera/widget/AspectRatioDialogLayout.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.widget;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import com.android.camera2.R;
+
+public class AspectRatioDialogLayout extends FrameLayout {
+ private View mConfirmButton;
+ private AspectRatioSelector mAspectRatioSelector;
+ private int mLastOrientation;
+ private AspectRatioChangedListener mListener;
+ private String mText16x9;
+ private String mText4x3;
+ private boolean mInitialized;
+ private AspectRatioSelector.AspectRatio mAspectRatio;
+
+ public interface AspectRatioChangedListener {
+ public void onAspectRatioChanged(AspectRatioSelector.AspectRatio aspectRatio);
+ }
+
+ public AspectRatioDialogLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mLastOrientation = getResources().getConfiguration().orientation;
+ }
+
+ @Override
+ public void onFinishInflate() {
+ updateViewReference();
+ }
+
+ private void updateViewReference() {
+ mAspectRatioSelector = (AspectRatioSelector) findViewById(R.id.aspect_ratio_selector);
+ mConfirmButton = findViewById(R.id.confirm_button);
+ mConfirmButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mListener != null) {
+ mListener.onAspectRatioChanged(mAspectRatioSelector.getAspectRatio());
+ }
+ }
+ });
+ if (mInitialized) {
+ mAspectRatioSelector.setAspectRatio(mAspectRatio);
+ mAspectRatioSelector.setTexts(mText4x3, mText16x9);
+ }
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration config) {
+ super.onConfigurationChanged(config);
+ if (config.orientation == mLastOrientation) {
+ return;
+ }
+ mLastOrientation = config.orientation;
+ mAspectRatio = mAspectRatioSelector.getAspectRatio();
+ removeAllViews();
+ inflate(getContext(), R.layout.aspect_ratio_dialog_content, this);
+ updateViewReference();
+ }
+
+ public void setAspectRatio(AspectRatioSelector.AspectRatio aspectRatio) {
+ mAspectRatioSelector.setAspectRatio(aspectRatio);
+ }
+
+ public void initialize(AspectRatioChangedListener listener, String text4x3, String text16x9,
+ AspectRatioSelector.AspectRatio aspectRatio) {
+ mInitialized = true;
+ mListener = listener;
+ mText4x3 = text4x3;
+ mText16x9 = text16x9;
+ mAspectRatio = aspectRatio;
+ if (mAspectRatioSelector != null) {
+ mAspectRatioSelector.setAspectRatio(mAspectRatio);
+ mAspectRatioSelector.setTexts(mText4x3, mText16x9);
+ }
+ }
+}
diff --git a/src/com/android/camera/widget/AspectRatioSelector.java b/src/com/android/camera/widget/AspectRatioSelector.java
new file mode 100644
index 000000000..0366766ef
--- /dev/null
+++ b/src/com/android/camera/widget/AspectRatioSelector.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import com.android.camera2.R;
+
+public class AspectRatioSelector extends LinearLayout {
+ public static enum AspectRatio {
+ ASPECT_RATIO_4x3,
+ ASPECT_RATIO_16x9
+ };
+
+ private AspectRatio mAspectRatio = AspectRatio.ASPECT_RATIO_4x3;
+ private TextView mAspectRatio4x3Text;
+ private TextView mAspectRatio16x9Text;
+ private View mAspectRatio4x3Button;
+ private View mAspectRatio16x9Button;
+
+ public AspectRatioSelector(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public void onFinishInflate() {
+ mAspectRatio4x3Button = findViewById(R.id.aspect_ratio_4x3_button);
+ mAspectRatio4x3Button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setAspectRatio(AspectRatio.ASPECT_RATIO_4x3);
+ }
+ });
+ mAspectRatio16x9Button = findViewById(R.id.aspect_ratio_16x9_button);
+ mAspectRatio16x9Button.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ setAspectRatio(AspectRatio.ASPECT_RATIO_16x9);
+ }
+ });
+ mAspectRatio4x3Text = (TextView) findViewById(R.id.text_4x3);
+ mAspectRatio16x9Text = (TextView) findViewById(R.id.text_16x9);
+ }
+
+ public void setAspectRatio(AspectRatio aspectRatio) {
+ if (aspectRatio == AspectRatio.ASPECT_RATIO_4x3) {
+ // Select 4x3 view.
+ mAspectRatio4x3Button.setSelected(true);
+ // Unselect 16x9 view.
+ mAspectRatio16x9Button.setSelected(false);
+ } else if (aspectRatio == AspectRatio.ASPECT_RATIO_16x9) {
+ // Select 16x9 view.
+ mAspectRatio16x9Button.setSelected(true);
+ // Unselect 4x3 view.
+ mAspectRatio4x3Button.setSelected(false);
+ } else {
+ // Log error.
+ return;
+ }
+ mAspectRatio = aspectRatio;
+ }
+
+ public AspectRatio getAspectRatio() {
+ return mAspectRatio;
+ }
+
+ public void setTexts(String text4x3, String text16x9) {
+ mAspectRatio4x3Text.setText(text4x3);
+ mAspectRatio16x9Text.setText(text16x9);
+ }
+}
diff --git a/src/com/android/camera/widget/LocationDialogLayout.java b/src/com/android/camera/widget/LocationDialogLayout.java
new file mode 100644
index 000000000..13b5984b7
--- /dev/null
+++ b/src/com/android/camera/widget/LocationDialogLayout.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.camera.widget;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.FrameLayout;
+
+import com.android.camera2.R;
+
+public class LocationDialogLayout extends FrameLayout {
+
+ public interface LocationTaggingSelectionListener {
+ public void onLocationTaggingSelected(boolean selected);
+ }
+
+ private View mConfirmButton;
+ private CheckBox mCheckBox;
+ private int mLastOrientation;
+ private LocationTaggingSelectionListener mListener;
+ private boolean mCheckBoxChecked = true;
+
+ public LocationDialogLayout(Context context, AttributeSet attributeSet) {
+ super(context, attributeSet);
+ mLastOrientation = context.getResources().getConfiguration().orientation;
+ }
+
+ @Override
+ public void onFinishInflate() {
+ updateViewReference();
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration config) {
+ super.onConfigurationChanged(config);
+ // TODO: Extract the orientation checking logic in a super class as it
+ // is also used in the aspect ratio dialog.
+ if (config.orientation == mLastOrientation) {
+ return;
+ }
+ mLastOrientation = config.orientation;
+ removeAllViews();
+ inflate(getContext(), R.layout.location_dialog_content, this);
+ updateViewReference();
+ }
+
+ private void updateViewReference() {
+ mCheckBox = (CheckBox) findViewById(R.id.check_box);
+ mCheckBox.setChecked(mCheckBoxChecked);
+ mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ mCheckBoxChecked = isChecked;
+ }
+ });
+
+ View checkBoxTouchDelegate = findViewById(R.id.check_box_touch_delegate);
+ if (checkBoxTouchDelegate != null) {
+ checkBoxTouchDelegate.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ // Toggle check box.
+ mCheckBox.setChecked(!mCheckBox.isChecked());
+ }
+ });
+ }
+ mConfirmButton = findViewById(R.id.confirm_button);
+ mConfirmButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (mListener != null) {
+ mListener.onLocationTaggingSelected(mCheckBoxChecked);
+ }
+ }
+ });
+ }
+
+ public void setLocationTaggingSelectionListener(LocationTaggingSelectionListener listener) {
+ mListener = listener;
+ }
+
+}