diff options
author | Camera Software Integration <camswint@localhost> | 2016-12-13 02:32:33 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-12-13 02:32:33 -0800 |
commit | a48b5bc37fc2aea2300f53b4a77c07b4b426d1d8 (patch) | |
tree | ecd7c1b5d04be0f3cef5a357481fe3b45cc51704 | |
parent | 1e8e52e5de1725d47101157b2328cbd76e9d9a83 (diff) | |
parent | b39e01c54b0d46b8a005e48e88537bc875b4977b (diff) | |
download | android_packages_apps_Snap-a48b5bc37fc2aea2300f53b4a77c07b4b426d1d8.tar.gz android_packages_apps_Snap-a48b5bc37fc2aea2300f53b4a77c07b4b426d1d8.tar.bz2 android_packages_apps_Snap-a48b5bc37fc2aea2300f53b4a77c07b4b426d1d8.zip |
Merge "SnapdragonCamera: Show label and dialog when switch to new scene mode" into camera.lnx.1.0-dev.1.0
36 files changed, 562 insertions, 5 deletions
diff --git a/res/drawable-hdpi/ic_scene_mode_black_auto.png b/res/drawable-hdpi/ic_scene_mode_black_auto.png Binary files differnew file mode 100644 index 000000000..3f68e8e47 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_auto.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_backlight.png b/res/drawable-hdpi/ic_scene_mode_black_backlight.png Binary files differnew file mode 100644 index 000000000..a70502f79 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_backlight.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_beach.png b/res/drawable-hdpi/ic_scene_mode_black_beach.png Binary files differnew file mode 100644 index 000000000..d66a5ff23 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_beach.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_best_photo.png b/res/drawable-hdpi/ic_scene_mode_black_best_photo.png Binary files differnew file mode 100644 index 000000000..5ddd1aac2 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_best_photo.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_blur_buster.png b/res/drawable-hdpi/ic_scene_mode_black_blur_buster.png Binary files differnew file mode 100644 index 000000000..a5b930f5e --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_blur_buster.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_candlelight.png b/res/drawable-hdpi/ic_scene_mode_black_candlelight.png Binary files differnew file mode 100644 index 000000000..cc8606e09 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_candlelight.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_chroma_flash.png b/res/drawable-hdpi/ic_scene_mode_black_chroma_flash.png Binary files differnew file mode 100644 index 000000000..9c8c1108e --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_chroma_flash.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_dual_camera.png b/res/drawable-hdpi/ic_scene_mode_black_dual_camera.png Binary files differnew file mode 100644 index 000000000..16b803601 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_dual_camera.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_flowers.png b/res/drawable-hdpi/ic_scene_mode_black_flowers.png Binary files differnew file mode 100644 index 000000000..527329e75 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_flowers.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_hdr.png b/res/drawable-hdpi/ic_scene_mode_black_hdr.png Binary files differnew file mode 100644 index 000000000..3baa45485 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_hdr.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_landscape.png b/res/drawable-hdpi/ic_scene_mode_black_landscape.png Binary files differnew file mode 100644 index 000000000..45a247e8d --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_landscape.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_night.png b/res/drawable-hdpi/ic_scene_mode_black_night.png Binary files differnew file mode 100644 index 000000000..6cf2ce8eb --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_night.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_optizoom.png b/res/drawable-hdpi/ic_scene_mode_black_optizoom.png Binary files differnew file mode 100644 index 000000000..331705738 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_optizoom.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_panorama.png b/res/drawable-hdpi/ic_scene_mode_black_panorama.png Binary files differnew file mode 100644 index 000000000..38c4a1b39 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_panorama.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_portrait.png b/res/drawable-hdpi/ic_scene_mode_black_portrait.png Binary files differnew file mode 100644 index 000000000..564e3da51 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_portrait.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_pro_mode.png b/res/drawable-hdpi/ic_scene_mode_black_pro_mode.png Binary files differnew file mode 100644 index 000000000..bb9cd76ac --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_pro_mode.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_sharp_photo.png b/res/drawable-hdpi/ic_scene_mode_black_sharp_photo.png Binary files differnew file mode 100644 index 000000000..a475cc724 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_sharp_photo.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_snow.png b/res/drawable-hdpi/ic_scene_mode_black_snow.png Binary files differnew file mode 100644 index 000000000..2ac492c08 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_snow.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_sports.png b/res/drawable-hdpi/ic_scene_mode_black_sports.png Binary files differnew file mode 100644 index 000000000..932be9821 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_sports.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_sunset.png b/res/drawable-hdpi/ic_scene_mode_black_sunset.png Binary files differnew file mode 100644 index 000000000..68b653527 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_sunset.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_time_lapse.png b/res/drawable-hdpi/ic_scene_mode_black_time_lapse.png Binary files differnew file mode 100644 index 000000000..868e51d3d --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_time_lapse.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_tracking_focus.png b/res/drawable-hdpi/ic_scene_mode_black_tracking_focus.png Binary files differnew file mode 100644 index 000000000..e86a330c2 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_tracking_focus.png diff --git a/res/drawable-hdpi/ic_scene_mode_black_ubifocus.png b/res/drawable-hdpi/ic_scene_mode_black_ubifocus.png Binary files differnew file mode 100644 index 000000000..eb174e728 --- /dev/null +++ b/res/drawable-hdpi/ic_scene_mode_black_ubifocus.png diff --git a/res/layout/capture_module.xml b/res/layout/capture_module.xml index 0063a2e6a..44d5c59c6 100755 --- a/res/layout/capture_module.xml +++ b/res/layout/capture_module.xml @@ -87,6 +87,9 @@ </FrameLayout> <include + layout="@layout/scene_mode_label"/> + + <include style="@style/CameraControls" layout="@layout/one_ui_layout" android:layout_gravity="center" /> diff --git a/res/layout/pano_capture_module.xml b/res/layout/pano_capture_module.xml index e382570ef..c8809af37 100644 --- a/res/layout/pano_capture_module.xml +++ b/res/layout/pano_capture_module.xml @@ -34,6 +34,10 @@ android:id="@+id/preview_process_view" android:layout_width="match_parent" android:layout_height="match_parent"/> + + <include + layout="@layout/scene_mode_label"/> + <include style="@style/CameraControls" layout="@layout/camera_controls" diff --git a/res/layout/scene_mode_instructional.xml b/res/layout/scene_mode_instructional.xml new file mode 100644 index 000000000..588dc3549 --- /dev/null +++ b/res/layout/scene_mode_instructional.xml @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Copyright (c) 2016, The Linux Foundation. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + --> + +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/mode_layout_rect" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@android:color/transparent" + android:gravity="center"> + + <LinearLayout + android:id="@+id/title" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginLeft="30dp" + android:layout_marginTop="15dp" + android:orientation="horizontal" + android:gravity="center"> + <ImageView + android:id="@+id/scene_mode_icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/chroma_flash"/> + <TextView + android:id="@+id/scene_mode_name" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:layout_toRightOf="@id/scene_mode_icon" + android:text="@string/pref_camera_scenemode_entry_chromaflash" + android:textColor="@android:color/black" + android:textAppearance="?android:attr/textAppearanceMedium" /> + + </LinearLayout> + + <TextView + android:id="@+id/scene_mode_instructional" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="15dp" + android:layout_marginLeft="30dp" + android:layout_marginRight="30dp" + android:text="@string/pref_camera2_scene_mode_chroma_flash_instructional_content" + android:textColor="@android:color/black" + android:layout_below="@id/title" /> + <CheckBox + android:id="@+id/remember_selected" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="15dp" + android:layout_marginLeft="30dp" + android:layout_below="@id/scene_mode_instructional" + android:text="@string/pref_camera2_not_show_again" + android:textColor="@android:color/black"/> + + <View + android:id="@+id/separator" + android:layout_width="wrap_content" + android:layout_height="1dp" + android:layout_marginTop="15dp" + android:layout_marginBottom="15dp" + android:layout_below="@id/remember_selected" + android:background="#c0c0c0" /> + + <Button + android:id="@+id/scene_mode_instructional_ok" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/separator" + android:background="@android:color/transparent" + android:layout_marginRight="30dp" + android:layout_alignParentRight="true" + android:text="@string/pref_camera2_scene_mode_instructional_ok" + android:textColor="@android:color/black"/> +</RelativeLayout> + diff --git a/res/layout/scene_mode_label.xml b/res/layout/scene_mode_label.xml new file mode 100644 index 000000000..aa5ef211c --- /dev/null +++ b/res/layout/scene_mode_label.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (c) 2016, The Linux Foundation. All rights reserved. + Not a Contribution. + + Copyright (C) 2013 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:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="90dp" + android:layout_marginRight="20dp" + android:gravity="right"> + <com.android.camera.ui.RotateLayout + android:id="@+id/scene_mode_label_rect" + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + <LinearLayout + android:id="@+id/scene_mode_label_view" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginRight="20dp" + android:background="#90000000" + android:orientation="horizontal"> + <TextView + android:id="@+id/scene_mode_label" + android:singleLine="true" + android:text="@string/pref_camera_scenemode_entry_chromaflash" + android:textColor="@android:color/white" + android:textSize="16dp" + style="@style/OnViewfinderSceneLabel" /> + <ImageView + android:id="@+id/scene_mode_label_close" + android:src="@drawable/x" + style="@style/OnViewfinderSceneLabel"/> + </LinearLayout> + </com.android.camera.ui.RotateLayout> +</LinearLayout>
\ No newline at end of file diff --git a/res/values/camera2arrays.xml b/res/values/camera2arrays.xml index 31d6b5a62..fbb70b984 100644 --- a/res/values/camera2arrays.xml +++ b/res/values/camera2arrays.xml @@ -213,6 +213,59 @@ <item>@drawable/promode</item> </array> + <array name="pref_camera2_scenemode_black_thumbnails" translatable="false"> + <item>@drawable/ic_scene_mode_black_auto</item> + <item>@drawable/ic_scene_mode_black_dual_camera</item> + <item>@drawable/ic_scene_mode_black_hdr</item> + <item>@drawable/ic_scene_mode_black_ubifocus</item> + <item>@drawable/ic_scene_mode_black_optizoom</item> + <item>@drawable/ic_scene_mode_black_portrait</item> + <item>@drawable/ic_scene_mode_black_landscape</item> + <item>@drawable/ic_scene_mode_black_sports</item> + <item>@drawable/ic_scene_mode_black_flowers</item> + <item>@drawable/ic_scene_mode_black_backlight</item> + <item>@drawable/ic_scene_mode_black_candlelight</item> + <item>@drawable/ic_scene_mode_black_sunset</item> + <item>@drawable/ic_scene_mode_black_night</item> + <item>@drawable/ic_scene_mode_black_beach</item> + <item>@drawable/ic_scene_mode_black_snow</item> + <item>@drawable/ic_scene_mode_smartauto</item> + <item>@drawable/ic_scene_mode_black_best_photo</item> + <item>@drawable/ic_scene_mode_black_chroma_flash</item> + <item>@drawable/ic_scene_mode_black_blur_buster</item> + <item>@drawable/ic_scene_mode_black_sharp_photo</item> + <item>@drawable/ic_scene_mode_black_tracking_focus</item> + <item>@drawable/ic_scene_mode_black_panorama</item> + <item>@drawable/ic_scene_mode_black_dual_camera</item> + </array> + + <!-- Camera Preferences Scene Mode dialog box entries --> + <string-array name="pref_camera2_scenemode_instructional_entries" translatable="false"> + <item>@string/pref_camera_scenemode_entry_auto</item> + <item>@string/pref_camera2_scene_mode_dual_camera_instructional_content</item> + <item>@string/pref_camera2_scene_mode_hdr_instructional_content</item> + <item>@string/pref_camera2_scene_mode_ubi_focus_instructional_content</item> + <item>@string/pref_camera2_scene_mode_opti_zoom_instructional_content</item> + <item>""</item> + <item>""</item> + <item>@string/pref_camera2_scene_mode_sports_instructional_content</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>""</item> + <item>@string/pref_camera2_scene_mode_best_photo_instructional_content</item> + <item>@string/pref_camera2_scene_mode_chroma_flash_instructional_content</item> + <item>@string/pref_camera2_scene_mode_blur_buster_instructional_content</item> + <item>@string/pref_camera2_scene_mode_sharp_photo_instructional_content</item> + <item>@string/pref_camera2_scene_mode_tracking_focus_instructional_content</item> + <item>@string/pref_camera2_scene_mode_panorama_instructional_content</item> + <item>@string/pref_camera2_scene_mode_pro_instructional_content</item> + </string-array> + <string-array name="pref_camera2_whitebalance_entryvalues" translatable="false"> <item>1</item> <item>2</item> diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index d53b2c27a..509fae318 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -1063,5 +1063,22 @@ <string name="perf_camera2_preferences_category_photo" translatable="true">Still camera</string> <string name="perf_camera2_preferences_category_video" translatable="true">Video camera</string> <string name="perf_camera2_preferences_category_system" translatable="true">System</string> + + <string name="pref_camera2_scene_mode_dual_camera_instructional_content" translatable="true">In dual camera mode, your pictures will be clearer. You can also apply background effects, by editing your dual camera pictures in the Gallery.</string> + <string name="pref_camera2_scene_mode_ubi_focus_instructional_content" translatable="true">With UbiFocus, your camera will take five pictures and combine them into one picture,where everything is in focus. You can choose to re-focus, after you take the picture.</string> + <string name="pref_camera2_scene_mode_opti_zoom_instructional_content" translatable="true">Use Optizoom when you want to zoom in for a clear picture.You can zoom before, or after taking the picture.</string> + <string name="pref_camera2_scene_mode_sports_instructional_content" translatable="true">Sports mode helps you take better sports or action shots.\n\nImporves your photos, but has no effect on video recording.</string> + <string name="pref_camera2_scene_mode_hdr_instructional_content" translatable="true">When you are in mixed lighting conditions such as low light and backlit scenes select "HDR" for best possible pictures.</string> + <string name="pref_camera2_scene_mode_best_photo_instructional_content" translatable="true">Allows you to take a burst of 10 photos, and you can choose the best one(s).</string> + <string name="pref_camera2_scene_mode_chroma_flash_instructional_content" translatable="true">With ChromaFlash, the lighting in your flash photos will be optimized for all of the people and objects in your pictures.This feature applies only to the back camera.</string> + <string name="pref_camera2_scene_mode_sharp_photo_instructional_content" translatable="true">Sharp Phot reduces blur that is due to motion in the scene, or due to hand motion.</string> + <string name="pref_camera2_scene_mode_tracking_focus_instructional_content" translatable="true">Allows you to track and focus a selected person or object while taking pictures or videos. To start, position the focus rectangle on a person or object you want to track.</string> + <string name="pref_camera2_scene_mode_time_lapse_instructional_content" translatable="true">With Time Lapse, you can transform a long video recording into a few seconds of video.This effect applies to videos, but not photos.</string> + <string name="pref_camera2_scene_mode_panorama_instructional_content" translatable="true">Allows you to pan left or right to take a wide landscape photo. You can alse pan up or down to take tall photos.</string> + <string name="pref_camera2_scene_mode_blur_buster_instructional_content" translatable="true">BlurBuster reduces blur from shaky hands.It can be helpful when taking photos in difficult places.</string> + <string name="pref_camera2_scene_mode_pro_instructional_content" translatable="true">With Pro Mode, you can manually control settings for ISO,Exposure, White Balance, and Focus. You will have easy access to all of these advanced settings</string> + + <string name="pref_camera2_not_show_again">Do not show again</string> + <string name="pref_camera2_scene_mode_instructional_ok" translatable="true">OK</string> </resources> diff --git a/res/values/styles.xml b/res/values/styles.xml index 082c5ed8a..8432c11e9 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -316,4 +316,18 @@ <style name="PanoViewHorizontalBar"> <item name="android:background">@android:color/transparent</item> </style> + + <style name="OnViewfinderSceneLabel"> + <item name="android:gravity">center</item> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">wrap_content</item> + <item name="android:layout_marginLeft">10dp</item> + <item name="android:layout_marginRight">10dp</item> + <item name="android:layout_marginTop">5dp</item> + <item name="android:layout_marginBottom">5dp</item> + <item name="android:singleLine">true</item> + <item name="android:textColor">@android:color/white</item> + <item name="android:textSize">16dp</item> + <item name="android:background">@android:color/transparent</item> + </style> </resources> diff --git a/res/xml/capture_preferences.xml b/res/xml/capture_preferences.xml index f3603c443..8ad300fe7 100644 --- a/res/xml/capture_preferences.xml +++ b/res/xml/capture_preferences.xml @@ -124,6 +124,14 @@ camera:title="@string/pref_camera_scenemode_title"/> <IconListPreference + camera:defaultValue="@string/pref_camera2_scenemode_default" + camera:entries="@array/pref_camera2_scenemode_instructional_entries" + camera:entryValues="@array/pref_camera2_scenemode_entryvalues" + camera:key="pref_camera2_scenemode_instructional" + camera:thumbnails="@array/pref_camera2_scenemode_black_thumbnails" + camera:title="@string/pref_camera_scenemode_title"/> + + <IconListPreference camera:defaultValue="@string/setting_off_value" camera:entries="@array/pref_camera2_redeyereduction_entries" camera:entryValues="@array/pref_camera2_redeyereduction_entryvalues" diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index ed6e55963..f43324c66 100755..100644 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -38,8 +38,10 @@ import android.renderscript.RenderScript; import android.renderscript.ScriptIntrinsicYuvToRGB; import android.renderscript.Type; import android.text.TextUtils; +import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; +import android.view.Gravity; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.Surface; @@ -49,12 +51,14 @@ import android.view.ViewGroup; import android.view.ViewPropertyAnimator; import android.view.Window; import android.view.WindowManager; +import android.widget.Button; +import android.widget.CheckBox; 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 com.android.camera.ui.AutoFitSurfaceView; import com.android.camera.ui.Camera2FaceView; import com.android.camera.ui.CameraControls; @@ -186,10 +190,16 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, private RotateImageView mMuteButton; private ImageView mSeekbarToggleButton; private View mProModeCloseButton; + private RotateLayout mSceneModeLabelRect; + private LinearLayout mSceneModeLabelView; + private TextView mSceneModeName; + private ImageView mSceneModeLabelCloseIcon; + private AlertDialog mSceneModeInstructionalDialog = null; int mPreviewWidth; int mPreviewHeight; private boolean mIsVideoUI = false; + private boolean mIsSceneModeLabelClose = false; private void previewUIReady() { if((mSurfaceHolder != null && mSurfaceHolder.getSurface().isValid())) { @@ -334,6 +344,17 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, RotateImageView muteButton = (RotateImageView) mRootView.findViewById(R.id.mute_button); muteButton.setVisibility(View.GONE); + mSceneModeLabelRect = (RotateLayout)mRootView.findViewById(R.id.scene_mode_label_rect); + mSceneModeName = (TextView)mRootView.findViewById(R.id.scene_mode_label); + mSceneModeLabelCloseIcon = (ImageView)mRootView.findViewById(R.id.scene_mode_label_close); + mSceneModeLabelCloseIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mIsSceneModeLabelClose = true; + mSceneModeLabelRect.setVisibility(View.GONE); + } + }); + mCameraControls = (OneUICameraControls) mRootView.findViewById(R.id.camera_controls); mFaceView = (Camera2FaceView) mRootView.findViewById(R.id.face_view); @@ -426,6 +447,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, initFilterModeButton(); initFlashButton(); setMakeupButtonIcon(); + showSceneModeLabel(); if(mModule.isTrackingFocusSettingOn()) { mTrackingFocusRenderer.setVisible(false); mTrackingFocusRenderer.setVisible(true); @@ -609,6 +631,117 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, } } + private boolean needShowInstructional() { + boolean needShow = true; + final SharedPreferences pref = mActivity.getSharedPreferences( + ComboPreferences.getGlobalSharedPreferencesName(mActivity), Context.MODE_PRIVATE); + int index = mSettingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE); + if ( index < 1 ) { + needShow = false; + }else{ + final String instructionalKey = SettingsManager.KEY_SCENE_MODE + "_" + index; + needShow = pref.getBoolean(instructionalKey, false) ? false : true; + } + + return needShow; + + } + + private void showSceneInstructionalDialog(int orientation) { + LayoutInflater inflater = + (LayoutInflater)mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view = inflater.inflate(R.layout.scene_mode_instructional, null); + + int index = mSettingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE); + TextView name = (TextView)view.findViewById(R.id.scene_mode_name); + CharSequence sceneModeNameArray[] = + mSettingsManager.getEntries(SettingsManager.KEY_SCENE_MODE); + name.setText(sceneModeNameArray[index]); + + ImageView icon = (ImageView)view.findViewById(R.id.scene_mode_icon); + int[] resId = mSettingsManager.getResource(SettingsManager.KEY_SCEND_MODE_INSTRUCTIONAL, + SettingsManager.RESOURCE_TYPE_THUMBNAIL); + icon.setImageResource(resId[index]); + + TextView instructional = (TextView)view.findViewById(R.id.scene_mode_instructional); + CharSequence instructionalArray[] = + mSettingsManager.getEntries(SettingsManager.KEY_SCEND_MODE_INSTRUCTIONAL); + if ( instructionalArray[index].length() == 0 ) { + //For now, not all scene mode has instructional + return; + } + instructional.setText(instructionalArray[index]); + + final CheckBox remember = (CheckBox)view.findViewById(R.id.remember_selected); + Button ok = (Button)view.findViewById(R.id.scene_mode_instructional_ok); + ok.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + + if ( remember.isChecked()) { + final SharedPreferences pref = mActivity.getSharedPreferences( + ComboPreferences.getGlobalSharedPreferencesName(mActivity), + Context.MODE_PRIVATE); + + String instructionalKey = SettingsManager.KEY_SCENE_MODE + "_" + index; + SharedPreferences.Editor editor = pref.edit(); + editor.putBoolean(instructionalKey, true); + editor.commit(); + } + mSceneModeInstructionalDialog.dismiss(); + mSceneModeInstructionalDialog = null; + } + }); + + mSceneModeInstructionalDialog = + new AlertDialog.Builder(mActivity, AlertDialog.THEME_HOLO_LIGHT) + .setView(view).create(); + try { + mSceneModeInstructionalDialog.show(); + }catch(Exception e) { + e.printStackTrace(); + return; + } + if ( orientation != 0 ) { + rotationSceneModeInstructionalDialog(view, orientation); + } + } + + private int getScreenWidth() { + DisplayMetrics metric = new DisplayMetrics(); + mActivity.getWindowManager().getDefaultDisplay().getMetrics(metric); + return metric.widthPixels < metric.heightPixels ? metric.widthPixels : metric.heightPixels; + } + + private void rotationSceneModeInstructionalDialog(View view, int orientation) { + view.setRotation(-orientation); + int screenWidth = getScreenWidth(); + int dialogSize = screenWidth*9/10; + Window dialogWindow = mSceneModeInstructionalDialog.getWindow(); + WindowManager.LayoutParams lp = dialogWindow.getAttributes(); + dialogWindow.setGravity(Gravity.CENTER); + lp.width = lp.height = dialogSize; + dialogWindow.setAttributes(lp); + if ( orientation == 180 ) { + dialogSize -= 40; + RelativeLayout layout = (RelativeLayout)view.findViewById(R.id.mode_layout_rect); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(dialogSize, dialogSize); + layout.setLayoutParams(params); + } + } + + private void showSceneModeLabel() { + mIsSceneModeLabelClose = false; + int index = mSettingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE); + CharSequence sceneModeNameArray[] = mSettingsManager.getEntries(SettingsManager.KEY_SCENE_MODE); + if ( index > 0 && index < sceneModeNameArray.length ) { + mSceneModeName.setText(sceneModeNameArray[index]); + mSceneModeLabelRect.setVisibility(View.VISIBLE); + }else{ + mSceneModeLabelRect.setVisibility(View.GONE); + } + } + + public void resetTrackingFocus() { if(mModule.isTrackingFocusSettingOn()) { mTrackingFocusRenderer.setVisible(false); @@ -1218,6 +1351,24 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, if (mZoomRenderer != null) { mZoomRenderer.setOrientation(orientation); } + + if ( mSceneModeLabelRect != null ) { + if (orientation == 180) { + mSceneModeName.setRotation(180); + mSceneModeLabelCloseIcon.setRotation(180); + mSceneModeLabelRect.setOrientation(0, false); + } else { + mSceneModeName.setRotation(0); + mSceneModeLabelCloseIcon.setRotation(0); + mSceneModeLabelRect.setOrientation(orientation, false); + } + } + + if ( mSceneModeInstructionalDialog != null && mSceneModeInstructionalDialog.isShowing()) { + mSceneModeInstructionalDialog.dismiss(); + mSceneModeInstructionalDialog = null; + showSceneInstructionalDialog(orientation); + } } public int getOrientation() { @@ -1341,9 +1492,18 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, @Override public void onSettingsChanged(List<SettingsManager.SettingState> settings) { for( SettingsManager.SettingState state : settings) { - if( state.key.equals(SettingsManager.KEY_COLOR_EFFECT) ) { + if (state.key.equals(SettingsManager.KEY_COLOR_EFFECT)) { enableView(mFilterModeSwitcher, SettingsManager.KEY_COLOR_EFFECT); - break; + } else if (state.key.equals(SettingsManager.KEY_SCENE_MODE)) { + String value = mSettingsManager.getValue(SettingsManager.KEY_SCENE_MODE); + if ( value.equals("104") ) {//panorama + mSceneModeLabelRect.setVisibility(View.GONE); + }else{ + if ( needShowInstructional() ) { + showSceneInstructionalDialog(mOrientation); + } + showSceneModeLabel(); + } } } } @@ -1428,4 +1588,5 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, public ImageView getVideoButton() { return mVideoButton; } + } diff --git a/src/com/android/camera/ComboPreferences.java b/src/com/android/camera/ComboPreferences.java index 1979d1b5a..a30dd9448 100644 --- a/src/com/android/camera/ComboPreferences.java +++ b/src/com/android/camera/ComboPreferences.java @@ -73,7 +73,7 @@ public class ComboPreferences implements return context.getPackageName() + "_preferences_" + cameraId; } - private static String getGlobalSharedPreferencesName(Context context) { + public static String getGlobalSharedPreferencesName(Context context) { return context.getPackageName() + "_preferences_camera"; } diff --git a/src/com/android/camera/PanoCaptureModule.java b/src/com/android/camera/PanoCaptureModule.java index ff5715e20..c6045d1c3 100644 --- a/src/com/android/camera/PanoCaptureModule.java +++ b/src/com/android/camera/PanoCaptureModule.java @@ -271,10 +271,12 @@ public class PanoCaptureModule implements CameraModule, PhotoController { mCameraOpened = false; mSurfaceReady = false; mActivity = activity; - + SettingsManager settingsManager = SettingsManager.getInstance(); + settingsManager.init(); mUI = new PanoCaptureUI(activity, this, parent); mContentResolver = mActivity.getContentResolver(); mLocationManager = new LocationManager(mActivity, null); + } public void changePanoStatus(boolean newStatus, boolean isCancelling) { diff --git a/src/com/android/camera/PanoCaptureUI.java b/src/com/android/camera/PanoCaptureUI.java index 3ab43f915..5e9692908 100644 --- a/src/com/android/camera/PanoCaptureUI.java +++ b/src/com/android/camera/PanoCaptureUI.java @@ -24,16 +24,29 @@ import android.graphics.Matrix; import android.graphics.Point; import android.graphics.RectF; import android.hardware.Camera.Face; +import android.app.AlertDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.util.DisplayMetrics; import android.util.Log; import android.util.Size; import android.view.Gravity; +import android.view.LayoutInflater; import android.view.SurfaceHolder; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnLayoutChangeListener; import android.view.ViewGroup; + +import android.view.Window; +import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; import com.android.camera.ui.AutoFitSurfaceView; import com.android.camera.ui.CameraControls; @@ -41,6 +54,7 @@ import com.android.camera.ui.CameraRootView; import com.android.camera.ui.FocusIndicator; import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.PanoCaptureProcessView; +import com.android.camera.ui.RotateLayout; import com.android.camera.util.CameraUtil; import org.codeaurora.snapcam.R; @@ -60,6 +74,12 @@ public class PanoCaptureUI implements private ShutterButton mShutterButton; private ModuleSwitcher mSwitcher; private CameraControls mCameraControls; + private RotateLayout mSceneModeLabelRect; + private LinearLayout mSceneModeLabelView; + private TextView mSceneModeName; + private ImageView mSceneModeLabelCloseIcon; + private AlertDialog mSceneModeInstructionalDialog = null; + // Small indicators which show the camera settings in the viewfinder. private OnScreenIndicators mOnScreenIndicators; @@ -74,6 +94,7 @@ public class PanoCaptureUI implements private ImageView mThumbnail; private int mOrientation; + private boolean mIsSceneModeLabelClose = false; public void clearSurfaces() { mSurfaceHolder = null; @@ -193,12 +214,26 @@ public class PanoCaptureUI implements } }); + mSceneModeLabelRect = (RotateLayout)mRootView.findViewById(R.id.scene_mode_label_rect); + mSceneModeName = (TextView)mRootView.findViewById(R.id.scene_mode_label); + mSceneModeName.setText(R.string.pref_camera_scenemode_entry_panorama); + mSceneModeLabelCloseIcon = (ImageView)mRootView.findViewById(R.id.scene_mode_label_close); + mSceneModeLabelCloseIcon.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mIsSceneModeLabelClose = true; + mSceneModeLabelRect.setVisibility(View.GONE); + } + }); initIndicators(); Point size = new Point(); mActivity.getWindowManager().getDefaultDisplay().getSize(size); calculateMargins(size); mCameraControls.setMargins(mTopMargin, mBottomMargin); + if ( needShowInstructional() ) { + showSceneInstructionalDialog(mOrientation); + } } private void calculateMargins(Point size) { @@ -381,6 +416,24 @@ public class PanoCaptureUI implements mOrientation = orientation; mCameraControls.setOrientation(orientation, animation); mPreviewProcessView.setOrientation(orientation); + + if ( mSceneModeLabelRect != null ) { + if (orientation == 180) { + mSceneModeName.setRotation(180); + mSceneModeLabelCloseIcon.setRotation(180); + mSceneModeLabelRect.setOrientation(0, false); + } else { + mSceneModeName.setRotation(0); + mSceneModeLabelCloseIcon.setRotation(0); + mSceneModeLabelRect.setOrientation(orientation, false); + } + } + + if ( mSceneModeInstructionalDialog != null && mSceneModeInstructionalDialog.isShowing()) { + mSceneModeInstructionalDialog.dismiss(); + mSceneModeInstructionalDialog = null; + showSceneInstructionalDialog(orientation); + } } public int getOrientation() { @@ -391,4 +444,83 @@ public class PanoCaptureUI implements public void onErrorListener(int error) { } + + private boolean needShowInstructional() { + final SharedPreferences pref = mActivity.getSharedPreferences( + ComboPreferences.getGlobalSharedPreferencesName(mActivity), Context.MODE_PRIVATE); + SettingsManager settingsManager = SettingsManager.getInstance(); + int index = settingsManager.getValueIndex(SettingsManager.KEY_SCENE_MODE); + final String instructionalKey = SettingsManager.KEY_SCENE_MODE + "_" + index; + return !pref.getBoolean(instructionalKey, false); + } + + private void showSceneInstructionalDialog(int orientation) { + LayoutInflater inflater = + (LayoutInflater)mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + View view = inflater.inflate(R.layout.scene_mode_instructional, null); + + TextView name = (TextView)view.findViewById(R.id.scene_mode_name); + name.setText(R.string.pref_camera_scenemode_entry_panorama); + + ImageView icon = (ImageView)view.findViewById(R.id.scene_mode_icon); + icon.setImageResource(R.drawable.ic_scene_mode_black_panorama); + + TextView instructional = (TextView)view.findViewById(R.id.scene_mode_instructional); + instructional.setText(R.string.pref_camera2_scene_mode_panorama_instructional_content); + + final CheckBox remember = (CheckBox)view.findViewById(R.id.remember_selected); + Button ok = (Button)view.findViewById(R.id.scene_mode_instructional_ok); + ok.setOnClickListener(new View.OnClickListener() { + public void onClick(View view) { + SharedPreferences pref = mActivity.getSharedPreferences( + ComboPreferences.getGlobalSharedPreferencesName(mActivity), + Context.MODE_PRIVATE); + int index = + SettingsManager.getInstance().getValueIndex(SettingsManager.KEY_SCENE_MODE); + String instructionalKey = SettingsManager.KEY_SCENE_MODE + "_" + index; + if ( remember.isChecked()) { + SharedPreferences.Editor editor = pref.edit(); + editor.putBoolean(instructionalKey, true); + editor.commit(); + } + mSceneModeInstructionalDialog.dismiss(); + mSceneModeInstructionalDialog = null; + } + }); + mSceneModeInstructionalDialog = + new AlertDialog.Builder(mActivity, AlertDialog.THEME_HOLO_LIGHT) + .setView(view).create(); + try { + mSceneModeInstructionalDialog.show(); + }catch(Exception e){ + e.printStackTrace(); + return; + } + if ( orientation != 0 ) { + rotationSceneModeInstructionalDialog(view, orientation); + } + } + + private int getScreenWidth() { + DisplayMetrics metric = new DisplayMetrics(); + mActivity.getWindowManager().getDefaultDisplay().getMetrics(metric); + return metric.widthPixels < metric.heightPixels ? metric.widthPixels : metric.heightPixels; + } + + private void rotationSceneModeInstructionalDialog(View view, int orientation) { + view.setRotation(-orientation); + int screenWidth = getScreenWidth(); + int dialogSize = screenWidth*9/10; + Window dialogWindow = mSceneModeInstructionalDialog.getWindow(); + WindowManager.LayoutParams lp = dialogWindow.getAttributes(); + dialogWindow.setGravity(Gravity.CENTER); + lp.width = lp.height = dialogSize; + dialogWindow.setAttributes(lp); + if ( orientation == 180 ) { + dialogSize -= 40; + RelativeLayout layout = (RelativeLayout)view.findViewById(R.id.mode_layout_rect); + FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(dialogSize, dialogSize); + layout.setLayoutParams(params); + } + } } diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java index 520a247f6..c1c6442dd 100644 --- a/src/com/android/camera/SettingsManager.java +++ b/src/com/android/camera/SettingsManager.java @@ -112,6 +112,7 @@ public class SettingsManager implements ListMenu.SettingsListener { public static final String KEY_FILTER_MODE = "pref_camera2_filter_mode_key"; public static final String KEY_COLOR_EFFECT = "pref_camera2_coloreffect_key"; public static final String KEY_SCENE_MODE = "pref_camera2_scenemode_key"; + public static final String KEY_SCEND_MODE_INSTRUCTIONAL = "pref_camera2_scenemode_instructional"; public static final String KEY_REDEYE_REDUCTION = "pref_camera2_redeyereduction_key"; public static final String KEY_CAMERA_ID = "pref_camera2_id_key"; public static final String KEY_PICTURE_SIZE = "pref_camera2_picturesize_key"; @@ -540,6 +541,9 @@ public class SettingsManager implements ListMenu.SettingsListener { ListPreference flashMode = mPreferenceGroup.findPreference(KEY_FLASH_MODE); ListPreference colorEffect = mPreferenceGroup.findPreference(KEY_COLOR_EFFECT); ListPreference sceneMode = mPreferenceGroup.findPreference(KEY_SCENE_MODE); + ListPreference sceneModeInstructional = + mPreferenceGroup.findPreference(KEY_SCEND_MODE_INSTRUCTIONAL); + ListPreference cameraIdPref = mPreferenceGroup.findPreference(KEY_CAMERA_ID); ListPreference pictureSize = mPreferenceGroup.findPreference(KEY_PICTURE_SIZE); ListPreference exposure = mPreferenceGroup.findPreference(KEY_EXPOSURE); @@ -579,6 +583,13 @@ public class SettingsManager implements ListMenu.SettingsListener { } } + if ( sceneModeInstructional != null ) { + if (filterUnsupportedOptions(sceneModeInstructional, + getSupportedSceneModes(cameraId)) ){ + mFilteredKeys.add(sceneModeInstructional.getKey()); + } + } + if (cameraIdPref != null) buildCameraId(); if (pictureSize != null) { |