diff options
author | mingwax <mingwax@codeaurora.org> | 2017-05-11 11:18:11 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-08-29 19:26:04 -0700 |
commit | 7050adb7ff6c3eb1e7c7bbf3b3c332c41b20c677 (patch) | |
tree | 983df10c671b4b423db81a4d1a0d58eefa93508a | |
parent | a5eb667e4f654501063ade99f2ce7ededed1515a (diff) | |
download | android_packages_apps_Snap-7050adb7ff6c3eb1e7c7bbf3b3c332c41b20c677.tar.gz android_packages_apps_Snap-7050adb7ff6c3eb1e7c7bbf3b3c332c41b20c677.tar.bz2 android_packages_apps_Snap-7050adb7ff6c3eb1e7c7bbf3b3c332c41b20c677.zip |
SnapdragonCamera: Fix UI Display confusion in ProMode
Refactoring the layout of pro_mode_layout.xml, optimizing layout
files, and reducing performace overhead.
CRs-Fixed: 2027214
Change-Id: I7005b5a38498b6867c0d6b971aef13fcd1359433
-rw-r--r-- | res/drawable/promode_exposure.xml | 33 | ||||
-rw-r--r-- | res/drawable/promode_iso.xml | 33 | ||||
-rw-r--r-- | res/drawable/promode_manual.xml | 33 | ||||
-rw-r--r-- | res/drawable/promode_white_balance.xml | 33 | ||||
-rw-r--r-- | res/layout/pro_mode_layout.xml | 114 | ||||
-rw-r--r-- | src/com/android/camera/ui/OneUICameraControls.java | 70 |
6 files changed, 202 insertions, 114 deletions
diff --git a/res/drawable/promode_exposure.xml b/res/drawable/promode_exposure.xml new file mode 100644 index 000000000..ff2afa49a --- /dev/null +++ b/res/drawable/promode_exposure.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Copyright (c) 2017, 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. + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" android:state_pressed="false" + android:drawable="@drawable/icon_exposure_blue" /> + <item android:drawable="@drawable/icon_exposure" /> +</selector> diff --git a/res/drawable/promode_iso.xml b/res/drawable/promode_iso.xml new file mode 100644 index 000000000..26b31a5b8 --- /dev/null +++ b/res/drawable/promode_iso.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Copyright (c) 2017, 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. + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" android:state_pressed="false" + android:drawable="@drawable/icon_iso_blue" /> + <item android:drawable="@drawable/icon_iso" /> +</selector> diff --git a/res/drawable/promode_manual.xml b/res/drawable/promode_manual.xml new file mode 100644 index 000000000..133b43180 --- /dev/null +++ b/res/drawable/promode_manual.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Copyright (c) 2017, 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. + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" android:state_pressed="false" + android:drawable="@drawable/icon_manual_blue" /> + <item android:drawable="@drawable/icon_manual" /> +</selector> diff --git a/res/drawable/promode_white_balance.xml b/res/drawable/promode_white_balance.xml new file mode 100644 index 000000000..91b98ac8c --- /dev/null +++ b/res/drawable/promode_white_balance.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!--Copyright (c) 2017, 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. + --> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true" android:state_pressed="false" + android:drawable="@drawable/icon_white_balance_blue" /> + <item android:drawable="@drawable/icon_white_balance" /> +</selector> diff --git a/res/layout/pro_mode_layout.xml b/res/layout/pro_mode_layout.xml index 54ccb556c..b295ac318 100644 --- a/res/layout/pro_mode_layout.xml +++ b/res/layout/pro_mode_layout.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (c) 2016, The Linux Foundation. All rights reserved. +<!-- Copyright (c) 2016-2017 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 @@ -35,114 +35,74 @@ <com.android.camera.ui.RotateLayout android:id="@+id/exposure_rotate_layout" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"> - <LinearLayout - android:id="@+id/exposure_layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + <TextView + android:id="@+id/exposure_value" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:focusable="true" + android:drawableTop="@drawable/promode_exposure" android:gravity="center" - android:orientation="vertical"> + android:layout_gravity="center" + android:layout_weight="1"/> - <ImageView - android:id="@+id/exposure" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center" - android:src="@drawable/icon_exposure" /> - - <TextView - android:id="@+id/exposure_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" /> - </LinearLayout> </com.android.camera.ui.RotateLayout> <com.android.camera.ui.RotateLayout android:id="@+id/manual_rotate_layout" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"> - <LinearLayout - android:id="@+id/manual_layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + <TextView + android:id="@+id/manual_value" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:focusable="true" + android:drawableTop="@drawable/promode_manual" android:gravity="center" - android:orientation="vertical"> - - <ImageView - android:id="@+id/manual" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center" - android:src="@drawable/icon_manual" /> + android:layout_gravity="center" + android:layout_weight="1" /> - <TextView - android:id="@+id/manual_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" /> - </LinearLayout> </com.android.camera.ui.RotateLayout> <com.android.camera.ui.RotateLayout android:id="@+id/white_balance_rotate_layout" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"> - <LinearLayout - android:id="@+id/white_balance_layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + <TextView + android:id="@+id/white_balance_value" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:focusable="true" + android:drawableTop="@drawable/promode_white_balance" android:gravity="center" - android:orientation="vertical"> + android:layout_gravity="center" + android:layout_weight="1"/> - <ImageView - android:id="@+id/white_balance" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center" - android:src="@drawable/icon_white_balance" /> - - <TextView - android:id="@+id/white_balance_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" /> - </LinearLayout> </com.android.camera.ui.RotateLayout> <com.android.camera.ui.RotateLayout android:id="@+id/iso_rotate_layout" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1"> - <LinearLayout - android:id="@+id/iso_layout" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + <TextView + android:id="@+id/iso_value" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:drawableTop="@drawable/promode_iso" + android:focusable="true" android:gravity="center" - android:orientation="vertical"> - - <ImageView - android:id="@+id/iso" - android:layout_width="30dp" - android:layout_height="30dp" - android:layout_gravity="center" - android:src="@drawable/icon_iso" /> + android:layout_gravity="center" + android:layout_weight="1"/> - <TextView - android:id="@+id/iso_value" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" /> - </LinearLayout> </com.android.camera.ui.RotateLayout> </LinearLayout> diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java index 85bd1b5ce..236a49243 100644 --- a/src/com/android/camera/ui/OneUICameraControls.java +++ b/src/com/android/camera/ui/OneUICameraControls.java @@ -19,15 +19,18 @@ package com.android.camera.ui; +import android.app.Activity; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; +import android.graphics.Point; import android.util.AttributeSet; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; +import android.view.Display; import android.widget.ImageView; import android.widget.FrameLayout; import android.widget.LinearLayout; @@ -90,19 +93,11 @@ public class OneUICameraControls extends RotatableLayout { private int mIntentMode = CaptureModule.INTENT_MODE_NORMAL; private ProMode mProMode; - private ImageView mExposureIcon; - private ImageView mManualIcon; - private ImageView mWhiteBalanceIcon; - private ImageView mIsoIcon; private TextView mExposureText; private TextView mManualText; private TextView mWhiteBalanceText; private TextView mIsoText; private boolean mProModeOn = false; - private LinearLayout mExposureLayout; - private LinearLayout mManualLayout; - private LinearLayout mWhiteBalanceLayout; - private LinearLayout mIsoLayout; private RotateLayout mExposureRotateLayout; private RotateLayout mManualRotateLayout; private RotateLayout mWhiteBalanceRotateLayout; @@ -123,6 +118,11 @@ public class OneUICameraControls extends RotatableLayout { mTop = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 70, getResources().getDisplayMetrics()); mBottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100, getResources().getDisplayMetrics()); mVisible = true; + + Display display = ((Activity)context).getWindowManager().getDefaultDisplay(); + Point size = new Point(); + display.getSize(size); + mWidth = size.x; } public OneUICameraControls(Context context) { @@ -162,10 +162,6 @@ public class OneUICameraControls extends RotatableLayout { mProModeLayout = (ViewGroup) findViewById(R.id.pro_mode_layout); mProModeCloseButton = findViewById(R.id.promode_close_button); - mExposureIcon = (ImageView) findViewById(R.id.exposure); - mManualIcon = (ImageView) findViewById(R.id.manual); - mWhiteBalanceIcon = (ImageView) findViewById(R.id.white_balance); - mIsoIcon = (ImageView) findViewById(R.id.iso); mExposureText = (TextView) findViewById(R.id.exposure_value); mManualText = (TextView) findViewById(R.id.manual_value); mWhiteBalanceText = (TextView) findViewById(R.id.white_balance_value); @@ -173,17 +169,12 @@ public class OneUICameraControls extends RotatableLayout { mProMode = (ProMode) findViewById(R.id.promode_slider); mProMode.initialize(this); - mExposureLayout = (LinearLayout) findViewById(R.id.exposure_layout); - mManualLayout = (LinearLayout) findViewById(R.id.manual_layout); - mWhiteBalanceLayout = (LinearLayout) findViewById(R.id.white_balance_layout); - mIsoLayout = (LinearLayout) findViewById(R.id.iso_layout); - mExposureRotateLayout = (RotateLayout) findViewById(R.id.exposure_rotate_layout); mManualRotateLayout = (RotateLayout) findViewById(R.id.manual_rotate_layout); mWhiteBalanceRotateLayout = (RotateLayout) findViewById(R.id.white_balance_rotate_layout); mIsoRotateLayout = (RotateLayout) findViewById(R.id.iso_rotate_layout); - mExposureLayout.setOnClickListener(new OnClickListener() { + mExposureText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetProModeIcons(); @@ -191,12 +182,12 @@ public class OneUICameraControls extends RotatableLayout { if (mode == ProMode.EXPOSURE_MODE) { mProMode.setMode(ProMode.NO_MODE); } else { - mExposureIcon.setImageResource(R.drawable.icon_exposure_blue); + mExposureText.setSelected(true); mProMode.setMode(ProMode.EXPOSURE_MODE); } } }); - mManualLayout.setOnClickListener(new OnClickListener() { + mManualText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetProModeIcons(); @@ -204,12 +195,12 @@ public class OneUICameraControls extends RotatableLayout { if (mode == ProMode.MANUAL_MODE) { mProMode.setMode(ProMode.NO_MODE); } else { - mManualIcon.setImageResource(R.drawable.icon_manual_blue); + mManualText.setSelected(true); mProMode.setMode(ProMode.MANUAL_MODE); } } }); - mWhiteBalanceLayout.setOnClickListener(new OnClickListener() { + mWhiteBalanceText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetProModeIcons(); @@ -217,12 +208,12 @@ public class OneUICameraControls extends RotatableLayout { if (mode == ProMode.WHITE_BALANCE_MODE) { mProMode.setMode(ProMode.NO_MODE); } else { - mWhiteBalanceIcon.setImageResource(R.drawable.icon_white_balance_blue); + mWhiteBalanceText.setSelected(true); mProMode.setMode(ProMode.WHITE_BALANCE_MODE); } } }); - mIsoLayout.setOnClickListener(new OnClickListener() { + mIsoText.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { resetProModeIcons(); @@ -230,7 +221,7 @@ public class OneUICameraControls extends RotatableLayout { if (mode == ProMode.ISO_MODE) { mProMode.setMode(ProMode.NO_MODE); } else { - mIsoIcon.setImageResource(R.drawable.icon_iso_blue); + mIsoText.setSelected(true); mProMode.setMode(ProMode.ISO_MODE); } } @@ -248,6 +239,7 @@ public class OneUICameraControls extends RotatableLayout { if(!BeautificationFilter.isSupportedStatic()) { mTsMakeupSwitcher.setEnabled(false); } + setProModeParameters(); } @Override @@ -259,12 +251,7 @@ public class OneUICameraControls extends RotatableLayout { if(mMakeupSeekBar != null) { mMakeupSeekBar.setMinimumWidth(mWidth/2); } - ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(mWidth/ 4,mWidth/4); - mExposureLayout.setLayoutParams(lp); - mManualLayout.setLayoutParams(lp); - mWhiteBalanceLayout.setLayoutParams(lp); - mIsoLayout.setLayoutParams(lp); - + setProModeParameters(); } @Override @@ -278,6 +265,7 @@ public class OneUICameraControls extends RotatableLayout { setLocation(r - l, b - t); layoutRemaingPhotos(); initializeProMode(mProModeOn); + } public boolean isControlRegion(int x, int y) { @@ -566,18 +554,26 @@ public class OneUICameraControls extends RotatableLayout { public void setProMode(boolean promode) { mProModeOn = promode; initializeProMode(mProModeOn); - resetProModeIcons(); mProMode.reinit(); + resetProModeIcons(); } private void resetProModeIcons() { - mExposureIcon.setImageResource(R.drawable.icon_exposure); - mManualIcon.setImageResource(R.drawable.icon_manual); - mWhiteBalanceIcon.setImageResource(R.drawable.icon_white_balance); - mIsoIcon.setImageResource(R.drawable.icon_iso); + mExposureText.setSelected(false); + mManualText.setSelected(false); + mWhiteBalanceText.setSelected(false); + mIsoText.setSelected(false); + } + + private void setProModeParameters() { + ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(mWidth/ 4, mWidth/ 4); + mExposureText.setLayoutParams(lp); + mManualText.setLayoutParams(lp); + mWhiteBalanceText.setLayoutParams(lp); + mIsoText.setLayoutParams(lp); } - public void initializeProMode(boolean promode) { + private void initializeProMode(boolean promode) { if (!promode) { mProMode.setMode(ProMode.NO_MODE); mProModeLayout.setVisibility(INVISIBLE); |