From 71f4fae6ca8c12c467b5afa8a6d325fc10b77f45 Mon Sep 17 00:00:00 2001 From: Michael Bestas Date: Sun, 20 Sep 2015 02:31:09 +0300 Subject: Snap: Remove CAF beautification feature Revert "SnapdragonCamera: Move the files to the correct location" This reverts commit c25b2d510285512dbb60547353190433f1dbb984. Revert "SnapdragonCamera: Add beautification feature to SnapdragonCamera." This reverts commit c1cea7c15b2e463f37c17f2a4ce61ce689ec7088. Change-Id: If01e4f438a58e4210a3eddf090d426895ecbae87 --- res/drawable/ic_ts_makeup_clean_selector.xml | 22 -- res/drawable/ic_ts_makeup_custom_selector.xml | 22 -- res/drawable/ic_ts_makeup_level_1_selector.xml | 22 -- res/drawable/ic_ts_makeup_level_2_selector.xml | 22 -- res/drawable/ic_ts_makeup_level_3_selector.xml | 22 -- res/drawable/ic_ts_makeup_level_off_selector.xml | 22 -- res/drawable/ic_ts_makeup_whiten_selector.xml | 22 -- res/layout-port/camera_controls.xml | 4 - res/layout/photo_module.xml | 6 - res/layout/ts_makeup_item_view.xml | 52 --- res/layout/ts_makeup_level_view_land.xml | 29 -- res/layout/ts_makeup_level_view_port.xml | 29 -- res/layout/ts_makeup_single_level_view_port.xml | 154 -------- res/values-zh-rCN/strings.xml | 11 - res/values/dimens.xml | 2 - res/values/qcomarrays.xml | 40 -- res/values/qcomstrings.xml | 13 - res/xml/camera_preferences.xml | 25 -- src/com/android/camera/CameraSettings.java | 8 - src/com/android/camera/ListPreference.java | 5 - src/com/android/camera/PhotoMenu.java | 208 +--------- src/com/android/camera/PhotoModule.java | 94 +---- src/com/android/camera/PhotoUI.java | 31 +- src/com/android/camera/TsMakeupManager.java | 476 ----------------------- src/com/android/camera/ui/CameraControls.java | 123 +----- 25 files changed, 41 insertions(+), 1423 deletions(-) delete mode 100644 res/drawable/ic_ts_makeup_clean_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_custom_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_level_1_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_level_2_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_level_3_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_level_off_selector.xml delete mode 100644 res/drawable/ic_ts_makeup_whiten_selector.xml delete mode 100644 res/layout/ts_makeup_item_view.xml delete mode 100644 res/layout/ts_makeup_level_view_land.xml delete mode 100644 res/layout/ts_makeup_level_view_port.xml delete mode 100644 res/layout/ts_makeup_single_level_view_port.xml delete mode 100644 src/com/android/camera/TsMakeupManager.java diff --git a/res/drawable/ic_ts_makeup_clean_selector.xml b/res/drawable/ic_ts_makeup_clean_selector.xml deleted file mode 100644 index 791658dd4..000000000 --- a/res/drawable/ic_ts_makeup_clean_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_custom_selector.xml b/res/drawable/ic_ts_makeup_custom_selector.xml deleted file mode 100644 index eecc2c7ce..000000000 --- a/res/drawable/ic_ts_makeup_custom_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_level_1_selector.xml b/res/drawable/ic_ts_makeup_level_1_selector.xml deleted file mode 100644 index 38e9193ab..000000000 --- a/res/drawable/ic_ts_makeup_level_1_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_level_2_selector.xml b/res/drawable/ic_ts_makeup_level_2_selector.xml deleted file mode 100644 index 76d40bd88..000000000 --- a/res/drawable/ic_ts_makeup_level_2_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_level_3_selector.xml b/res/drawable/ic_ts_makeup_level_3_selector.xml deleted file mode 100644 index e26ecdfa5..000000000 --- a/res/drawable/ic_ts_makeup_level_3_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_level_off_selector.xml b/res/drawable/ic_ts_makeup_level_off_selector.xml deleted file mode 100644 index e1939673a..000000000 --- a/res/drawable/ic_ts_makeup_level_off_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/drawable/ic_ts_makeup_whiten_selector.xml b/res/drawable/ic_ts_makeup_whiten_selector.xml deleted file mode 100644 index f1284b604..000000000 --- a/res/drawable/ic_ts_makeup_whiten_selector.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - diff --git a/res/layout-port/camera_controls.xml b/res/layout-port/camera_controls.xml index af47a13b6..bc85432d9 100644 --- a/res/layout-port/camera_controls.xml +++ b/res/layout-port/camera_controls.xml @@ -83,10 +83,6 @@ android:id="@+id/filter_mode_switcher" style="@style/ToggleButton" /> - - - - diff --git a/res/layout/ts_makeup_item_view.xml b/res/layout/ts_makeup_item_view.xml deleted file mode 100644 index 4b5a050cf..000000000 --- a/res/layout/ts_makeup_item_view.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/res/layout/ts_makeup_level_view_land.xml b/res/layout/ts_makeup_level_view_land.xml deleted file mode 100644 index 0d02562ff..000000000 --- a/res/layout/ts_makeup_level_view_land.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/res/layout/ts_makeup_level_view_port.xml b/res/layout/ts_makeup_level_view_port.xml deleted file mode 100644 index 4ffaba5dd..000000000 --- a/res/layout/ts_makeup_level_view_port.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/res/layout/ts_makeup_single_level_view_port.xml b/res/layout/ts_makeup_single_level_view_port.xml deleted file mode 100644 index fbfafeec3..000000000 --- a/res/layout/ts_makeup_single_level_view_port.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 47bc62f25..ba9a5ec06 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -529,15 +529,4 @@ 打开相机 剩余 %d 张 - 美颜 - - - 自定义 - 美白 - 磨皮 - 警告 - 实时美颜需要开启人脸检测功能,是否开启? - 继续 - 退出 - diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 1ba60c825..64e55adc7 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -167,8 +167,6 @@ 10dp 67dp - 96dp - 96dp 57dp diff --git a/res/values/qcomarrays.xml b/res/values/qcomarrays.xml index 821250c6c..265be963d 100644 --- a/res/values/qcomarrays.xml +++ b/res/values/qcomarrays.xml @@ -818,44 +818,4 @@ 0 1 - - - - @string/setting_off - @string/setting_on - - - - Off - On - - - - @drawable/ic_ts_makeup_off - @drawable/ic_ts_makeup_on - - - - @string/setting_off - 1 - 2 - 3 - @string/pref_camera_tsmakeup_custom - - - - @drawable/ic_ts_makeup_level_off_selector - @drawable/ic_ts_makeup_level_1_selector - @drawable/ic_ts_makeup_level_2_selector - @drawable/ic_ts_makeup_level_3_selector - @drawable/ic_ts_makeup_custom_selector - - - - @string/pref_camera_tsmakeup_default - 20 - 60 - 100 - none - diff --git a/res/values/qcomstrings.xml b/res/values/qcomstrings.xml index 61628a478..25a9cdc7d 100644 --- a/res/values/qcomstrings.xml +++ b/res/values/qcomstrings.xml @@ -442,19 +442,6 @@ Internal storage SD card - - Beautification - Off - 60 - - Custom - Whiten - Soften - - To use beautification, face detection must be disabled - Continue - Cancel - diff --git a/res/xml/camera_preferences.xml b/res/xml/camera_preferences.xml index 32fd0a472..54d72424d 100644 --- a/res/xml/camera_preferences.xml +++ b/res/xml/camera_preferences.xml @@ -230,31 +230,6 @@ camera:entries="@array/pref_camera_facedetection_entries" camera:singleIcon="@drawable/ic_settings_facerec" camera:entryValues="@array/pref_camera_facedetection_entryvalues" /> - - - - = 0; --i) { - RotateLayout l = (RotateLayout) mMakeupMenuLayout.getChildAt(i); - l.setOrientation(orientation, animation); - } - } else { - ViewGroup vg = (ViewGroup) mMakeupMenuLayout.getChildAt(1); - if(vg != null) { - for (int i = vg.getChildCount() - 1; i >= 0; --i) { - ViewGroup vewiGroup = (ViewGroup) vg.getChildAt(i); - if(vewiGroup instanceof RotateLayout) { - RotateLayout l = (RotateLayout) vewiGroup; - l.setOrientation(orientation, animation); - } - } - } - } - - } if (mCountDownView != null) mCountDownView.setOrientation(orientation); RotateTextToast.setOrientation(orientation); diff --git a/src/com/android/camera/TsMakeupManager.java b/src/com/android/camera/TsMakeupManager.java deleted file mode 100644 index db3505b45..000000000 --- a/src/com/android/camera/TsMakeupManager.java +++ /dev/null @@ -1,476 +0,0 @@ -/* -* Copyright (C) 2014,2015 Thundersoft Corporation -* All rights Reserved -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package com.android.camera; - -import android.content.Context; -import android.content.res.Resources; -import android.text.TextUtils; -import android.util.Log; -import android.view.Display; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.MotionEvent; -import android.view.View; -import android.view.View.OnClickListener; -import android.view.WindowManager; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; -import android.widget.SeekBar; -import android.widget.TextView; -import android.widget.LinearLayout.LayoutParams; -import android.widget.SeekBar.OnSeekBarChangeListener; - -import com.android.camera.ui.RotateLayout; -import com.android.camera.util.CameraUtil; - -import org.codeaurora.snapcam.R; - -public class TsMakeupManager implements OnSeekBarChangeListener { - private static final String TAG = "TsMakeupManager"; - private PhotoUI mUI; - private PhotoMenu mMenu; - private CameraActivity mActivity; - private PreferenceGroup mPreferenceGroup; - private View mTsMakeupSwitcher; - - private RelativeLayout mMakeupLayoutRoot; - private LinearLayout mMakeupLevelRoot; - private LinearLayout mMakeupSingleRoot; - - public static final String MAKEUP_ON = "On"; - public static final String MAKEUP_OFF = "Off"; - public static final String MAKEUP_NONE = "none"; - - private static final int MODE_NONE = 0; - private static final int MODE_WHITEN = 1; - private static final int MODE_CLEAN = 2; - private int mMode = MODE_NONE; - private int mSingleSelectedIndex = MODE_NONE; - - private static final int MAKEUP_UI_STATUS_NONE = 0; - private static final int MAKEUP_UI_STATUS_ON = 1; - private static final int MAKEUP_UI_STATUS_OFF = 2; - private static final int MAKEUP_UI_STATUS_DISMISS = 3; - private int mMakeupUIStatus = MAKEUP_UI_STATUS_NONE; - - private static final int CLICK_THRESHOLD = 200; - - public static final boolean HAS_TS_MAKEUP = android.os.SystemProperties.getBoolean("persist.ts.rtmakeup", false); - - private MakeupLevelListener mMakeupLevelListener; - interface MakeupLevelListener { - void onMakeupLevel(String key, String value); - } - - public void setMakeupLevelListener(MakeupLevelListener l) { - mMakeupLevelListener = l; - } - - public TsMakeupManager(CameraActivity activity, PhotoMenu menu, PhotoUI ui, PreferenceGroup preferenceGroup, View makeupSwitcher) { - mActivity = activity; - mUI = ui; - mMenu = menu; - mPreferenceGroup = preferenceGroup; - mTsMakeupSwitcher = makeupSwitcher; - - mMakeupLayoutRoot = (RelativeLayout) mUI.getRootView().findViewById(R.id.id_tsmakeup_level_layout_root); - - mMakeupUIStatus = MAKEUP_UI_STATUS_NONE; - } - - public View getMakeupLayoutRoot() { - return mMakeupLayoutRoot; - } - - public boolean isShowMakeup() { - return mMakeupLayoutRoot != null && mMakeupLayoutRoot.isShown(); - } - - public void removeAllViews() { - if(mMakeupSingleRoot != null) { - mMakeupSingleRoot.removeAllViews(); - mMakeupSingleRoot = null; - } - if(mMakeupLevelRoot != null) { - mMakeupLevelRoot.removeAllViews(); - mMakeupLevelRoot = null; - } - if(mMakeupLayoutRoot != null) { - mMakeupLayoutRoot.removeAllViews(); - } - } - - public void dismissMakeupUI() { - mMakeupUIStatus = MAKEUP_UI_STATUS_DISMISS; - removeAllViews(); - if(mMakeupLayoutRoot != null) { - mMakeupLayoutRoot.setVisibility(View.GONE); - } - } - - public void resetMakeupUIStatus() { - mMakeupUIStatus = MAKEUP_UI_STATUS_NONE; - } - - private void changeMakeupIcon(String value) { - if( !TextUtils.isEmpty(value) ) { - String prefValue = MAKEUP_ON; - if(MAKEUP_OFF.equals(value)) { - prefValue = MAKEUP_OFF; - } - final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE); - if(pref == null) - return; - pref.setValue(prefValue); - int index = pref.getCurrentIndex(); - ImageView iv = (ImageView) mTsMakeupSwitcher; - iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]); - pref.setMakeupSeekBarValue(prefValue); - } - } - - public void hideMakeupUI() { - final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_TS_MAKEUP_UILABLE); - if(pref == null) - return; - mMakeupUIStatus = MAKEUP_UI_STATUS_NONE; - String tsMakeupOn = pref.getValue(); - Log.d(TAG, "TsMakeupManager.hideMakeupUI(): tsMakeupOn is " + tsMakeupOn); - if(MAKEUP_ON.equals(tsMakeupOn)) { - int index = pref.findIndexOfValue(pref.getValue()); - CharSequence[] values = pref.getEntryValues(); - index = (index + 1) % values.length; - pref.setMakeupSeekBarValue((String)values[index]); - ImageView iv = (ImageView) mTsMakeupSwitcher; - iv.setImageResource(((IconListPreference) pref).getLargeIconIds()[index]); - mMakeupLevelListener.onMakeupLevel(CameraSettings.KEY_TS_MAKEUP_LEVEL, pref.getValue()); - - IconListPreference levelPref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL); - levelPref.setValueIndex(0); //Turn Off the Makeup feature; - - - mMakeupLayoutRoot.setVisibility(View.GONE); - mMakeupLayoutRoot.removeAllViews(); - if(mMakeupSingleRoot != null) { - mMakeupSingleRoot.removeAllViews(); - mMakeupSingleRoot = null; - } - if(mMakeupLevelRoot != null) { - mMakeupLevelRoot.removeAllViews(); - mMakeupLevelRoot = null; - } - } - } - - public void showMakeupView() { - mMakeupUIStatus = MAKEUP_UI_STATUS_OFF; - mMakeupLayoutRoot.setVisibility(View.GONE); - mMakeupLayoutRoot.removeAllViews(); - if(mMakeupSingleRoot != null) { - mMakeupSingleRoot.removeAllViews(); - mMakeupSingleRoot = null; - } - if(mMakeupLevelRoot != null) { - mMakeupLevelRoot.removeAllViews(); - mMakeupLevelRoot = null; - } - - if(mMakeupSingleRoot != null && mMakeupSingleRoot.getVisibility() == View.VISIBLE) { - showSingleView(MAKEUP_NONE); - return; - } - - if(mMakeupUIStatus == MAKEUP_UI_STATUS_DISMISS) - return; - - mMakeupLayoutRoot.setVisibility(View.VISIBLE); - final IconListPreference pref = (IconListPreference) mPreferenceGroup - .findPreference(CameraSettings.KEY_TS_MAKEUP_LEVEL); - if (pref == null) - return; - - if(mMakeupLevelRoot != null) { - mMakeupLevelRoot.removeAllViews(); - mMakeupLevelRoot = null; - } - mMakeupLayoutRoot.removeAllViews(); - - mMakeupUIStatus = MAKEUP_UI_STATUS_ON; - - int rotation = CameraUtil.getDisplayRotation(mActivity); - boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity); - if (!mIsDefaultToPortrait) { - rotation = (rotation + 90) % 360; - } - CharSequence[] entries = pref.getEntries(); - int[] thumbnails = pref.getThumbnailIds(); - - WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE); - Display display = wm.getDefaultDisplay(); - int width = display.getWidth(); - int height = display.getHeight(); - Resources r = mActivity.getResources(); - int margin = (int) (r.getDimension(R.dimen.tsmakeup_mode_paddingBottom)); - int levelBgSize = (int) (r.getDimension(R.dimen.tsmakeup_mode_level_size)); - - Log.d(TAG, "TsMakeupManager.showMakeupView(): rotation is " + rotation + ", WH is (" + width + ", " + height + "), margin is " - + margin + ", levelBgSize is " + levelBgSize); - - int gridRes = 0; - boolean portrait = (rotation == 0) || (rotation == 180); - int size = height; - if (portrait) { - gridRes = R.layout.ts_makeup_level_view_port; - size = width; - } else { - gridRes = R.layout.ts_makeup_level_view_land; - size = height; - } - int itemWidth = size / entries.length; - - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - - LinearLayout layout = (LinearLayout) inflater.inflate(gridRes, null, false); - mMakeupLevelRoot = layout; - mUI.setMakeupMenuLayout(layout); - - LinearLayout.LayoutParams params = null; - if(portrait) { - params = new LayoutParams(itemWidth, itemWidth); - params.gravity = Gravity.CENTER_VERTICAL; - } else { - params = new LayoutParams(itemWidth, itemWidth); - params.gravity = Gravity.CENTER_HORIZONTAL; - } - - RelativeLayout.LayoutParams rootParams = null; - if(rotation == 0) { - rootParams = new RelativeLayout.LayoutParams(size, levelBgSize); -// rootParams.bottomMargin = margin; - rootParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - } else if(rotation == 90) { - rootParams = new RelativeLayout.LayoutParams(levelBgSize, size); -// rootParams.rightMargin = margin; - rootParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - } else if(rotation == 180) { - rootParams = new RelativeLayout.LayoutParams(size, levelBgSize); -// rootParams.topMargin = margin; - rootParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); - } else if(rotation == 270) { - rootParams = new RelativeLayout.LayoutParams(levelBgSize, size); -// rootParams.leftMargin = margin; - rootParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - } - - final View[] views = new View[entries.length]; - int init = pref.getCurrentIndex(); - for (int i = 0; i < entries.length; i++) { - RotateLayout layout2 = (RotateLayout) inflater.inflate( - R.layout.ts_makeup_item_view, null, false); - - ImageView imageView = (ImageView) layout2.findViewById(R.id.image); - TextView label = (TextView) layout2.findViewById(R.id.label); - final int j = i; - - layout2.setOnTouchListener(new View.OnTouchListener() { - private long startTime; - - @Override - public boolean onTouch(View v, MotionEvent event) { - if (event.getAction() == MotionEvent.ACTION_DOWN) { - startTime = System.currentTimeMillis(); - } else if (event.getAction() == MotionEvent.ACTION_UP) { - if (System.currentTimeMillis() - startTime < CLICK_THRESHOLD) { - pref.setValueIndex(j); - changeMakeupIcon(pref.getValue()); - mMakeupLevelListener.onMakeupLevel(pref.getKey(), pref.getValue()); - for (View v1 : views) { - v1.setSelected(false); - } - View border = v.findViewById(R.id.image); - border.setSelected(true); - - showSingleView(pref.getValue()); - mUI.adjustOrientation(); - } - } - return true; - } - }); - - View border = layout2.findViewById(R.id.image); - views[j] = border; - if (i == init) { - border.setSelected(true); - } - imageView.setImageResource(thumbnails[i]); - label.setText(entries[i]); - layout.addView(layout2, params); - } - mMakeupLayoutRoot.addView(layout, rootParams); - } - - private void showSingleView(String value) { - if(MAKEUP_NONE.equals(value)) { - if(mMakeupSingleRoot != null) { - mMakeupSingleRoot.removeAllViews(); - mMakeupSingleRoot = null; - } - mMakeupLayoutRoot.removeAllViews(); - int rotation = CameraUtil.getDisplayRotation(mActivity); - boolean mIsDefaultToPortrait = CameraUtil.isDefaultToPortrait(mActivity); - if (!mIsDefaultToPortrait) { - rotation = (rotation + 90) % 360; - } - - WindowManager wm = (WindowManager) mActivity.getSystemService(Context.WINDOW_SERVICE); - Display display = wm.getDefaultDisplay(); - int width = display.getWidth(); - int height = display.getHeight(); - Resources r = mActivity.getResources(); - int margin = (int) (r.getDimension(R.dimen.tsmakeup_mode_paddingBottom)); - int levelBgSize = (int) (r.getDimension(R.dimen.tsmakeup_mode_level_size)); - - Log.d(TAG, "TsMakeupManager.showSingleView(): rotation is " + rotation + ", WH is (" + width + ", " + height + "), margin is " - + margin + ", levelBgSize is " + levelBgSize); - - int gridRes = R.layout.ts_makeup_single_level_view_port; - int size = width; - - LayoutInflater inflater = (LayoutInflater) mActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - - final LinearLayout layout = (LinearLayout) inflater.inflate(gridRes, null, false); - mMakeupSingleRoot = layout; - mUI.setMakeupMenuLayout(layout); - - RelativeLayout.LayoutParams rootParams = new RelativeLayout.LayoutParams(size, android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT); - rootParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); - - mMakeupLayoutRoot.addView(layout, rootParams); - final SeekBar seekBar = (SeekBar) layout.findViewById(R.id.seekbar_makeup_level); - seekBar.setOnSeekBarChangeListener(this); - setSingleView(layout); - - mMode = MODE_NONE; - - layout.findViewById(R.id.id_layout_makeup_back).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - mMakeupSingleRoot.removeAllViews(); - mMakeupLayoutRoot.removeView(mMakeupSingleRoot); - mMakeupSingleRoot = null; - - mSingleSelectedIndex = MODE_NONE; - mMode = MODE_NONE; - - showMakeupView(); - mUI.adjustOrientation(); - } - }); - - layout.findViewById(R.id.id_layout_makeup_whiten).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if(mMode == MODE_WHITEN) { - seekBar.setVisibility(View.GONE); - mMode = MODE_NONE; - return; - } - mSingleSelectedIndex = MODE_WHITEN; - seekBar.setVisibility(View.VISIBLE); - seekBar.setProgress(getPrefValue(CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN)); - mMode = MODE_WHITEN; - setSingleView(layout); - } - }); - - layout.findViewById(R.id.id_layout_makeup_clean).setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if(mMode == MODE_CLEAN) { - seekBar.setVisibility(View.GONE); - mMode = MODE_NONE; - return; - } - mSingleSelectedIndex = MODE_CLEAN; - seekBar.setVisibility(View.VISIBLE); - seekBar.setProgress(getPrefValue(CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN)); - mMode = MODE_CLEAN; - setSingleView(layout); - } - }); - } - } - - private void setSingleView(LinearLayout layout) { - if(mSingleSelectedIndex == MODE_WHITEN) { - layout.findViewById(R.id.id_iv_makeup_whiten).setSelected(true); - layout.findViewById(R.id.id_iv_makeup_clean).setSelected(false); - } else if(mSingleSelectedIndex == MODE_CLEAN) { - layout.findViewById(R.id.id_iv_makeup_whiten).setSelected(false); - layout.findViewById(R.id.id_iv_makeup_clean).setSelected(true); - } - } - - @Override - public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - } - - @Override - public void onStartTrackingTouch(SeekBar seekBar) { - - } - - @Override - public void onStopTrackingTouch(SeekBar seekBar) { - setSeekbarValue(seekBar.getProgress()); - } - - private void setSeekbarValue(int value) { - String key = CameraSettings.KEY_TS_MAKEUP_LEVEL_WHITEN; - if(mMode == MODE_CLEAN) { - key = CameraSettings.KEY_TS_MAKEUP_LEVEL_CLEAN; - } - Log.d(TAG, "TsMakeupManager.onStopTrackingTouch(): value is " + value + ", key is " + key); - setEffectValue(key, String.valueOf(value)); - } - - private void setEffectValue(String key, String value) { - final ListPreference pref = (ListPreference) mPreferenceGroup.findPreference(key); - if (pref == null) - return; - - pref.setMakeupSeekBarValue(value); - mMakeupLevelListener.onMakeupLevel(key, value); - } - - private int getPrefValue(String key) { - ListPreference pref = mPreferenceGroup.findPreference(key); - String value = pref.getValue(); - Log.d(TAG, "TsMakeupManager.getPrefValue(): value is " + value + ", key is " + key); - if(TextUtils.isEmpty(value)) { - value = mActivity.getString(R.string.pref_camera_tsmakeup_level_default); - } - return Integer.parseInt(value); - } -} diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java index c0defea06..59222b929 100644 --- a/src/com/android/camera/ui/CameraControls.java +++ b/src/com/android/camera/ui/CameraControls.java @@ -42,7 +42,6 @@ import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.RotateImageView; import com.android.camera.ShutterButton; import com.android.camera.util.CameraUtil; -import com.android.camera.TsMakeupManager; public class CameraControls extends RotatableLayout { @@ -54,7 +53,6 @@ public class CameraControls extends RotatableLayout { private View mMenu; private View mFrontBackSwitcher; private View mHdrSwitcher; - private View mTsMakeupSwitcher; private View mIndicators; private View mPreview; private View mSceneModeSwitcher; @@ -68,7 +66,6 @@ public class CameraControls extends RotatableLayout { private ArrayList mViewList; private static final int FRONT_BACK_INDEX = 0; private static final int HDR_INDEX = 1; - private static final int TS_MAKEUP_INDEX = 1; private static final int SCENE_MODE_INDEX = 2; private static final int FILTER_MODE_INDEX = 3; private static final int MENU_INDEX = 4; @@ -107,11 +104,7 @@ public class CameraControls extends RotatableLayout { resetLocation(0, 0); mFrontBackSwitcher.setVisibility(View.INVISIBLE); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setVisibility(View.INVISIBLE); - } else { - mHdrSwitcher.setVisibility(View.INVISIBLE); - } + mHdrSwitcher.setVisibility(View.INVISIBLE); mSceneModeSwitcher.setVisibility(View.INVISIBLE); mFilterModeSwitcher.setVisibility(View.INVISIBLE); @@ -129,11 +122,7 @@ public class CameraControls extends RotatableLayout { resetLocation(0, 0); mFrontBackSwitcher.setVisibility(View.INVISIBLE); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setVisibility(View.INVISIBLE); - } else { - mHdrSwitcher.setVisibility(View.INVISIBLE); - } + mHdrSwitcher.setVisibility(View.INVISIBLE); mSceneModeSwitcher.setVisibility(View.INVISIBLE); mFilterModeSwitcher.setVisibility(View.INVISIBLE); @@ -199,11 +188,7 @@ public class CameraControls extends RotatableLayout { mSwitcher.setPressed(false); mMenu.setPressed(false); mFrontBackSwitcher.setPressed(false); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setPressed(false); - } else { - mHdrSwitcher.setPressed(false); - } + mHdrSwitcher.setPressed(false); mSceneModeSwitcher.setPressed(false); mFilterModeSwitcher.setPressed(false); } else { @@ -213,11 +198,7 @@ public class CameraControls extends RotatableLayout { ((ModuleSwitcher) mSwitcher).enableTouch(enable); mMenu.setEnabled(enable); mFrontBackSwitcher.setEnabled(enable); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setEnabled(enable); - } else { - mHdrSwitcher.setEnabled(enable); - } + mHdrSwitcher.setEnabled(enable); mSceneModeSwitcher.setEnabled(enable); mPreview.setEnabled(enable); mFilterModeSwitcher.setEnabled(enable && mTempEnabled[FILTER_MODE_INDEX]); @@ -227,13 +208,8 @@ public class CameraControls extends RotatableLayout { mViewList = new ArrayList(); if (mFrontBackSwitcher.getVisibility() == View.VISIBLE) mViewList.add(mFrontBackSwitcher); - if(TsMakeupManager.HAS_TS_MAKEUP) { - if (mTsMakeupSwitcher.getVisibility() == View.VISIBLE) - mViewList.add(mTsMakeupSwitcher); - } else { - if (mHdrSwitcher.getVisibility() == View.VISIBLE) - mViewList.add(mHdrSwitcher); - } + if (mHdrSwitcher.getVisibility() == View.VISIBLE) + mViewList.add(mHdrSwitcher); if (mSceneModeSwitcher.getVisibility() == View.VISIBLE) mViewList.add(mSceneModeSwitcher); if (mFilterModeSwitcher.getVisibility() == View.VISIBLE) @@ -253,11 +229,7 @@ public class CameraControls extends RotatableLayout { mSwitcher = findViewById(R.id.camera_switcher); mShutter = findViewById(R.id.shutter_button); mFrontBackSwitcher = findViewById(R.id.front_back_switcher); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher = findViewById(R.id.ts_makeup_switcher); - } else { - mHdrSwitcher = findViewById(R.id.hdr_switcher); - } + mHdrSwitcher = findViewById(R.id.hdr_switcher); mMenu = findViewById(R.id.menu); mIndicators = findViewById(R.id.on_screen_indicators); mPreview = findViewById(R.id.preview_thumb); @@ -335,11 +307,7 @@ public class CameraControls extends RotatableLayout { toIndex(mIndicators, w, h, rotation, 0, 6, INDICATOR_INDEX); toIndex(mFrontBackSwitcher, w, h, rotation, 2, 0, FRONT_BACK_INDEX); toIndex(mPreview, w, h, rotation, 0, 6, PREVIEW_INDEX); - if(TsMakeupManager.HAS_TS_MAKEUP) { - toIndex(mTsMakeupSwitcher, w, h, rotation, 3, 0, TS_MAKEUP_INDEX); - } else { - toIndex(mHdrSwitcher, w, h, rotation, 3, 0, HDR_INDEX); - } + toIndex(mHdrSwitcher, w, h, rotation, 3, 0, HDR_INDEX); toIndex(mFilterModeSwitcher, w, h, rotation, 1, 0, FILTER_MODE_INDEX); toIndex(mSceneModeSwitcher, w, h, rotation, 0, 0, SCENE_MODE_INDEX); layoutToast(mRefocusToast, w, h, rotation); @@ -433,11 +401,7 @@ public class CameraControls extends RotatableLayout { int idx1 = rotation / 90; mFrontBackSwitcher.setX(mLocX[idx1][FRONT_BACK_INDEX] + x); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setX(mLocX[idx1][TS_MAKEUP_INDEX] + x); - } else { - mHdrSwitcher.setX(mLocX[idx1][HDR_INDEX] + x); - } + mHdrSwitcher.setX(mLocX[idx1][HDR_INDEX] + x); mSceneModeSwitcher.setX(mLocX[idx1][SCENE_MODE_INDEX] + x); mFilterModeSwitcher.setX(mLocX[idx1][FILTER_MODE_INDEX] + x); mMenu.setX(mLocX[idx1][MENU_INDEX] + x); @@ -447,11 +411,7 @@ public class CameraControls extends RotatableLayout { mPreview.setX(mLocX[idx1][PREVIEW_INDEX] - x); mFrontBackSwitcher.setY(mLocY[idx1][FRONT_BACK_INDEX] + y); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.setY(mLocY[idx1][TS_MAKEUP_INDEX] + y); - } else { - mHdrSwitcher.setY(mLocY[idx1][HDR_INDEX] + y); - } + mHdrSwitcher.setY(mLocY[idx1][HDR_INDEX] + y); mSceneModeSwitcher.setY(mLocY[idx1][SCENE_MODE_INDEX] + y); mFilterModeSwitcher.setY(mLocY[idx1][FILTER_MODE_INDEX] + y); mMenu.setY(mLocY[idx1][MENU_INDEX] + y); @@ -466,11 +426,7 @@ public class CameraControls extends RotatableLayout { enableTouch(false); int rotation = getUnifiedRotation(); mFrontBackSwitcher.animate().cancel(); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().cancel(); - } else { - mHdrSwitcher.animate().cancel(); - } + mHdrSwitcher.animate().cancel(); mSceneModeSwitcher.animate().cancel(); mFilterModeSwitcher.animate().cancel(); mSwitcher.animate().cancel(); @@ -485,11 +441,7 @@ public class CameraControls extends RotatableLayout { switch (rotation) { case 0: mFrontBackSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mMenu.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); @@ -501,11 +453,7 @@ public class CameraControls extends RotatableLayout { break; case 90: mFrontBackSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mMenu.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); @@ -517,11 +465,7 @@ public class CameraControls extends RotatableLayout { break; case 180: mFrontBackSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mMenu.animate().translationYBy(mSize).setDuration(ANIME_DURATION); @@ -533,11 +477,7 @@ public class CameraControls extends RotatableLayout { break; case 270: mFrontBackSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mMenu.animate().translationXBy(mSize).setDuration(ANIME_DURATION); @@ -557,11 +497,7 @@ public class CameraControls extends RotatableLayout { enableTouch(false); int rotation = getUnifiedRotation(); mFrontBackSwitcher.animate().cancel(); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().cancel(); - } else { - mHdrSwitcher.animate().cancel(); - } + mHdrSwitcher.animate().cancel(); mSceneModeSwitcher.animate().cancel(); mFilterModeSwitcher.animate().cancel(); mSwitcher.animate().cancel(); @@ -588,11 +524,7 @@ public class CameraControls extends RotatableLayout { resetLocation(0, -mSize); mFrontBackSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationYBy(mSize).setDuration(ANIME_DURATION); mMenu.animate().translationYBy(mSize).setDuration(ANIME_DURATION); @@ -606,11 +538,7 @@ public class CameraControls extends RotatableLayout { resetLocation(-mSize, 0); mFrontBackSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationXBy(mSize).setDuration(ANIME_DURATION); mMenu.animate().translationXBy(mSize).setDuration(ANIME_DURATION); @@ -624,11 +552,7 @@ public class CameraControls extends RotatableLayout { resetLocation(0, mSize); mFrontBackSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); mMenu.animate().translationYBy(-mSize).setDuration(ANIME_DURATION); @@ -642,11 +566,7 @@ public class CameraControls extends RotatableLayout { resetLocation(mSize, 0); mFrontBackSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - if(TsMakeupManager.HAS_TS_MAKEUP) { - mTsMakeupSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - } else { - mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); - } + mHdrSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mSceneModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mFilterModeSwitcher.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); mMenu.animate().translationXBy(-mSize).setDuration(ANIME_DURATION); @@ -907,8 +827,7 @@ public class CameraControls extends RotatableLayout { mOrientation = orientation; View[] views = { mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher, - TsMakeupManager.HAS_TS_MAKEUP ? mTsMakeupSwitcher : mHdrSwitcher, - mMenu, mShutter, mPreview, mSwitcher + mHdrSwitcher, mMenu, mShutter, mPreview, mSwitcher }; for (View v : views) { ((RotateImageView) v).setOrientation(orientation, animation); -- cgit v1.2.3