diff options
Diffstat (limited to 'src/com/android/camera/ui/OneUICameraControls.java')
-rw-r--r-- | src/com/android/camera/ui/OneUICameraControls.java | 70 |
1 files changed, 33 insertions, 37 deletions
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); |