summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/OneUICameraControls.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ui/OneUICameraControls.java')
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/ui/OneUICameraControls.java217
1 files changed, 205 insertions, 12 deletions
diff --git a/src/com/android/camera/ui/OneUICameraControls.java b/src/com/android/camera/ui/OneUICameraControls.java
index 63e1b5b4d..3dce60d22 100644..100755
--- a/src/com/android/camera/ui/OneUICameraControls.java
+++ b/src/com/android/camera/ui/OneUICameraControls.java
@@ -24,24 +24,28 @@ import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
+import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
-import org.codeaurora.snapcam.R;
-
import com.android.camera.Storage;
import com.android.camera.imageprocessor.filter.BeautificationFilter;
+import org.codeaurora.snapcam.R;
+
public class OneUICameraControls extends RotatableLayout {
private static final String TAG = "CAM_Controls";
private View mShutter;
private View mVideoShutter;
+ private View mPauseButton;
private View mFlashButton;
private View mMute;
private View mFrontBackSwitcher;
@@ -53,6 +57,8 @@ public class OneUICameraControls extends RotatableLayout {
private View mMakeupSeekBarLowText;
private View mMakeupSeekBarHighText;
private View mMakeupSeekBarLayout;
+ private ViewGroup mProModeLayout;
+ private View mProModeCloseButton;
private ArrowTextView mRefocusToast;
@@ -75,10 +81,31 @@ public class OneUICameraControls extends RotatableLayout {
private int mWidth;
private int mHeight;
private boolean mVisible;
+ private boolean mIsVideoMode = false;
+ private int mBottomLargeSize;
+ private int mBottomSmallSize;
+
+ 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;
+ private RotateLayout mIsoRotateLayout;
public OneUICameraControls(Context context, AttributeSet attrs) {
super(context, attrs);
-
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
setWillNotDraw(false);
@@ -103,6 +130,7 @@ public class OneUICameraControls extends RotatableLayout {
super.onFinishInflate();
mShutter = findViewById(R.id.shutter_button);
mVideoShutter = findViewById(R.id.video_button);
+ mPauseButton = findViewById(R.id.video_pause);
mFrontBackSwitcher = findViewById(R.id.front_back_switcher);
mTsMakeupSwitcher = findViewById(R.id.ts_makeup_switcher);
mMakeupSeekBarLowText = findViewById(R.id.makeup_low_text);
@@ -117,11 +145,92 @@ public class OneUICameraControls extends RotatableLayout {
mFilterModeSwitcher = findViewById(R.id.filter_mode_switcher);
mRemainingPhotos = (LinearLayout) findViewById(R.id.remaining_photos);
mRemainingPhotosText = (TextView) findViewById(R.id.remaining_photos_text);
+ 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);
+ mIsoText = (TextView) findViewById(R.id.iso_value);
+ 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() {
+ @Override
+ public void onClick(View v) {
+ resetProModeIcons();
+ int mode = mProMode.getMode();
+ if (mode == ProMode.EXPOSURE_MODE) {
+ mProMode.setMode(ProMode.NO_MODE);
+ } else {
+ mExposureIcon.setImageResource(R.drawable.icon_exposure_blue);
+ mProMode.setMode(ProMode.EXPOSURE_MODE);
+ }
+ }
+ });
+ mManualLayout.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ resetProModeIcons();
+ int mode = mProMode.getMode();
+ if (mode == ProMode.MANUAL_MODE) {
+ mProMode.setMode(ProMode.NO_MODE);
+ } else {
+ mManualIcon.setImageResource(R.drawable.icon_manual_blue);
+ mProMode.setMode(ProMode.MANUAL_MODE);
+ }
+ }
+ });
+ mWhiteBalanceLayout.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ resetProModeIcons();
+ int mode = mProMode.getMode();
+ if (mode == ProMode.WHITE_BALANCE_MODE) {
+ mProMode.setMode(ProMode.NO_MODE);
+ } else {
+ mWhiteBalanceIcon.setImageResource(R.drawable.icon_white_balance_blue);
+ mProMode.setMode(ProMode.WHITE_BALANCE_MODE);
+ }
+ }
+ });
+ mIsoLayout.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ resetProModeIcons();
+ int mode = mProMode.getMode();
+ if (mode == ProMode.ISO_MODE) {
+ mProMode.setMode(ProMode.NO_MODE);
+ } else {
+ mIsoIcon.setImageResource(R.drawable.icon_iso_blue);
+ mProMode.setMode(ProMode.ISO_MODE);
+ }
+ }
+ });
+
mViews = new View[]{
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
- mTsMakeupSwitcher, mFlashButton, mShutter, mPreview, mVideoShutter
+ mTsMakeupSwitcher, mFlashButton, mShutter, mPreview, mVideoShutter,
+ mPauseButton
};
-
+ mBottomLargeSize = getResources().getDimensionPixelSize(
+ R.dimen.one_ui_bottom_large);
+ mBottomSmallSize = getResources().getDimensionPixelSize(
+ R.dimen.one_ui_bottom_small);
if(!BeautificationFilter.isSupportedStatic()) {
mTsMakeupSwitcher.setVisibility(View.GONE);
mTsMakeupSwitcher = null;
@@ -142,6 +251,14 @@ public class OneUICameraControls extends RotatableLayout {
if(mMakeupSeekBar != null) {
mMakeupSeekBar.setMinimumWidth(mWidth/2);
}
+
+ LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(mWidth/ 4,mWidth/4);
+ mExposureLayout.setLayoutParams(lp);
+
+ mManualLayout.setLayoutParams(lp);
+ mWhiteBalanceLayout.setLayoutParams(lp);
+ mIsoLayout.setLayoutParams(lp);
+ initializeProMode(mProModeOn);
}
public boolean isControlRegion(int x, int y) {
@@ -205,17 +322,34 @@ public class OneUICameraControls extends RotatableLayout {
int rotation = getUnifiedRotation();
setLocation(mSceneModeSwitcher, true, 0);
setLocation(mFilterModeSwitcher, true, 1);
- setLocation(mFrontBackSwitcher, true, 2);
- setLocation(mTsMakeupSwitcher, true, 3);
- setLocation(mFlashButton, true, 4);
- setLocation(mPreview, false, 0);
- setLocation(mShutter, false, 2);
- setLocation(mVideoShutter, false, 3.15f);
+ if (mIsVideoMode) {
+ setLocation(mMute, true, 2);
+ setLocation(mTsMakeupSwitcher, true, 3);
+ setLocation(mFlashButton, true, 4);
+ setLocation(mPauseButton, false, 3.15f);
+ setLocation(mShutter, false , 0.85f);
+ setLocation(mVideoShutter, false, 2);
+ } else {
+ setLocation(mFrontBackSwitcher, true, 2);
+ setLocation(mTsMakeupSwitcher, true, 3);
+ setLocation(mFlashButton, true, 4);
+ setLocation(mPreview, false, 0);
+ setLocation(mShutter, false, 2);
+ setLocation(mVideoShutter, false, 3.15f);
+ }
setLocationCustomBottom(mMakeupSeekBarLayout, 0, 1);
+ setLocation(mProModeCloseButton, false, 4);
layoutToast(mRefocusToast, w, h, rotation);
}
+ private void setBottomButtionSize(View view, int width, int height) {
+ FrameLayout.LayoutParams layout = (FrameLayout.LayoutParams)view.getLayoutParams();
+ layout.height = height;
+ layout.width = width;
+ view.setLayoutParams(layout);
+ }
+
private void layoutToast(final View v, int w, int h, int rotation) {
int tw = v.getMeasuredWidth();
int th = v.getMeasuredHeight();
@@ -271,6 +405,17 @@ public class OneUICameraControls extends RotatableLayout {
mVisible = true;
}
+ public void setVideoMode(boolean videoMode) {
+ mIsVideoMode = videoMode;
+ if (mIsVideoMode) {
+ setBottomButtionSize(mVideoShutter, mBottomLargeSize, mBottomLargeSize);
+ setBottomButtionSize(mShutter, mBottomSmallSize, mBottomSmallSize);
+ } else {
+ setBottomButtionSize(mShutter, mBottomLargeSize, mBottomLargeSize);
+ setBottomButtionSize(mVideoShutter, mBottomSmallSize, mBottomSmallSize);
+ }
+ }
+
private void layoutRemaingPhotos() {
int rl = mPreview.getLeft();
int rt = mPreview.getTop();
@@ -324,7 +469,7 @@ public class OneUICameraControls extends RotatableLayout {
View[] views = {
mSceneModeSwitcher, mFilterModeSwitcher, mFrontBackSwitcher,
mTsMakeupSwitcher, mFlashButton, mPreview, mMute, mShutter, mVideoShutter,
- mMakeupSeekBarLowText, mMakeupSeekBarHighText
+ mMakeupSeekBarLowText, mMakeupSeekBarHighText, mPauseButton
};
for (View v : views) {
@@ -332,6 +477,11 @@ public class OneUICameraControls extends RotatableLayout {
((Rotatable) v).setOrientation(orientation, animation);
}
}
+ mExposureRotateLayout.setOrientation(orientation, animation);
+ mManualRotateLayout.setOrientation(orientation, animation);
+ mWhiteBalanceRotateLayout.setOrientation(orientation, animation);
+ mIsoRotateLayout.setOrientation(orientation, animation);
+ mProMode.setOrientation(orientation);
layoutRemaingPhotos();
}
@@ -377,4 +527,47 @@ public class OneUICameraControls extends RotatableLayout {
mPath.lineTo(x1, y1);
}
}
+
+ public void setProMode(boolean promode) {
+ mProModeOn = promode;
+ initializeProMode(mProModeOn);
+ resetProModeIcons();
+ mProMode.reinit();
+ }
+
+ 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);
+ }
+
+ public void initializeProMode(boolean promode) {
+ if (!promode) {
+ mProMode.setMode(ProMode.NO_MODE);
+ mProModeLayout.setVisibility(INVISIBLE);
+ mProModeCloseButton.setVisibility(INVISIBLE);
+ return;
+ }
+ mProModeLayout.setVisibility(VISIBLE);
+ mProModeCloseButton.setVisibility(VISIBLE);
+ mProModeLayout.setY(mHeight - mBottom - mProModeLayout.getHeight());
+ }
+
+ public void updateProModeText(int mode, String value) {
+ switch (mode) {
+ case ProMode.EXPOSURE_MODE:
+ mExposureText.setText(value);
+ break;
+ case ProMode.MANUAL_MODE:
+ mManualText.setText(value);
+ break;
+ case ProMode.WHITE_BALANCE_MODE:
+ mWhiteBalanceText.setText(value);
+ break;
+ case ProMode.ISO_MODE:
+ mIsoText.setText(value);
+ break;
+ }
+ }
}