diff options
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/CaptureUI.java | 11 | ||||
-rw-r--r-- | src/com/android/camera/imageprocessor/filter/BeautificationFilter.java | 14 | ||||
-rw-r--r-- | src/com/android/camera/ui/OneUICameraControls.java | 18 |
3 files changed, 34 insertions, 9 deletions
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index 07fff52e6..1394bfce2 100644 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -49,6 +49,7 @@ 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; @@ -171,6 +172,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, private View mFrontBackSwitcher; private ImageView mMakeupButton; private SeekBar mMakeupSeekBar; + private View mMakeupSeekBarLayout; private TextView mRecordingTimeView; private View mTimeLapseLabel; private RotateLayout mRecordingTimeRect; @@ -239,7 +241,8 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, mFrontBackSwitcher = mRootView.findViewById(R.id.front_back_switcher); mMakeupButton = (ImageView) mRootView.findViewById(R.id.ts_makeup_switcher); setMakeupButtonIcon(); - mMakeupSeekBar = (SeekBar)mRootView.findViewById(R.id.ts_makeup_seekbar); + mMakeupSeekBarLayout = mRootView.findViewById(R.id.makeup_seekbar_layout); + mMakeupSeekBar = (SeekBar)mRootView.findViewById(R.id.makeup_seekbar); mMakeupSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progresValue, boolean fromUser) { @@ -346,7 +349,7 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, private void showOrHideMakeupSeekBar() { String value = mSettingsManager.getValue(SettingsManager.KEY_MAKEUP); - if(mMakeupSeekBar.getVisibility() == View.VISIBLE) { + if(mMakeupSeekBarLayout.getVisibility() == View.VISIBLE) { if(value != null && value.equals("0")) { if(mIsVideoUI) { return; @@ -354,9 +357,9 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, mSettingsManager.setValue(SettingsManager.KEY_FACE_DETECTION, "off"); mModule.restartSession(true); } - mMakeupSeekBar.setVisibility(View.GONE); + mMakeupSeekBarLayout.setVisibility(View.GONE); } else { - mMakeupSeekBar.setVisibility(View.VISIBLE); + mMakeupSeekBarLayout.setVisibility(View.VISIBLE); if(value != null && value.equals("0")) { mSettingsManager.setValue(SettingsManager.KEY_MAKEUP, "40"); mMakeupSeekBar.setProgress(40); diff --git a/src/com/android/camera/imageprocessor/filter/BeautificationFilter.java b/src/com/android/camera/imageprocessor/filter/BeautificationFilter.java index 3f0a10bbf..c9c559d3e 100644 --- a/src/com/android/camera/imageprocessor/filter/BeautificationFilter.java +++ b/src/com/android/camera/imageprocessor/filter/BeautificationFilter.java @@ -57,6 +57,8 @@ public class BeautificationFilter implements ImageFilter { private static String TAG = "BeautificationFilter"; private static boolean mIsSupported = false; private int mStrengthValue = 0; + private static int FACE_TIMEOUT_VALUE = 60; //in frame count + private int mFaceTimeOut = FACE_TIMEOUT_VALUE; public BeautificationFilter(CaptureModule module) { mModule = module; @@ -101,6 +103,14 @@ public class BeautificationFilter implements ImageFilter { Face[] faces; if(((Boolean)isPreview).booleanValue()) { faces = mModule.getPreviewFaces(); + if(faces == null || faces.length == 0) { + if(mFaceTimeOut > 0) { + faces = mModule.getStickyFaces(); + mFaceTimeOut--; + } + } else { + mFaceTimeOut = FACE_TIMEOUT_VALUE; + } } else { faces = mModule.getStickyFaces(); } @@ -113,11 +123,13 @@ public class BeautificationFilter implements ImageFilter { int value = nativeBeautificationProcess(bY, bVU, mWidth, mHeight, mStrideY, (int)(rect.left*widthRatio), (int)(rect.top*heightRatio), (int)(rect.right*widthRatio), (int)(rect.bottom*heightRatio), mStrengthValue, mStrengthValue); - if(DEBUG && value < 0) { + if(DEBUG) { if(value == -1) { Log.d(TAG, "library initialization is failed."); } else if(value == -2) { Log.d(TAG, "No face is recognized"); + } else if(value >= 0 && !((Boolean)isPreview).booleanValue()){ + Log.d(TAG, "Successful beautification"); } } } diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java index b2368faa8..12ce5325b 100644 --- a/src/com/android/camera/ui/OneUICameraControls.java +++ b/src/com/android/camera/ui/OneUICameraControls.java @@ -50,6 +50,9 @@ public class OneUICameraControls extends RotatableLayout { private View mSceneModeSwitcher; private View mFilterModeSwitcher; private View mMakeupSeekBar; + private View mMakeupSeekBarLowText; + private View mMakeupSeekBarHighText; + private View mMakeupSeekBarLayout; private ArrowTextView mRefocusToast; @@ -102,7 +105,10 @@ public class OneUICameraControls extends RotatableLayout { mVideoShutter = findViewById(R.id.video_button); mFrontBackSwitcher = findViewById(R.id.front_back_switcher); mTsMakeupSwitcher = findViewById(R.id.ts_makeup_switcher); - mMakeupSeekBar = findViewById(R.id.ts_makeup_seekbar); + mMakeupSeekBarLowText = findViewById(R.id.makeup_low_text); + mMakeupSeekBarHighText = findViewById(R.id.makeup_high_text); + mMakeupSeekBar = findViewById(R.id.makeup_seekbar); + mMakeupSeekBarLayout = findViewById(R.id.makeup_seekbar_layout); ((SeekBar)mMakeupSeekBar).setMax(100); mFlashButton = findViewById(R.id.flash_button); mMute = findViewById(R.id.mute_button); @@ -133,6 +139,9 @@ public class OneUICameraControls extends RotatableLayout { mHeight = b; setLocation(r - l, b - t); layoutRemaingPhotos(); + if(mMakeupSeekBar != null) { + mMakeupSeekBar.setMinimumWidth(mWidth/2); + } } public boolean isControlRegion(int x, int y) { @@ -203,7 +212,7 @@ public class OneUICameraControls extends RotatableLayout { setLocation(mPreview, false, 0); setLocation(mShutter, false, 2); setLocation(mVideoShutter, false, 3.15f); - setLocationCustomBottom(mMakeupSeekBar, 0, 1); + setLocationCustomBottom(mMakeupSeekBarLayout, 0, 1); layoutToast(mRefocusToast, w, h, rotation); } @@ -315,12 +324,13 @@ public class OneUICameraControls extends RotatableLayout { mOrientation = orientation; View[] views = { mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher, - mTsMakeupSwitcher, mFlashButton, mPreview, mMute, mShutter, mVideoShutter + mTsMakeupSwitcher, mFlashButton, mPreview, mMute, mShutter, mVideoShutter, + mMakeupSeekBarLowText, mMakeupSeekBarHighText }; for (View v : views) { if (v != null) { - ((RotateImageView) v).setOrientation(orientation, animation); + ((Rotatable) v).setOrientation(orientation, animation); } } layoutRemaingPhotos(); |