diff options
author | Wei Huang <weih@google.com> | 2011-11-03 11:52:53 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-03 11:52:53 -0700 |
commit | 530a0dee238412cbdff39bd64295c74f39cc782e (patch) | |
tree | d5369a7d93345ab9c783ccf048a46bbf12fff523 /src | |
parent | 19346d5702f5848167c16d71941e2c48cd17ed05 (diff) | |
parent | da705aa1c8cbaaba105d9bc7799aef95c416a459 (diff) | |
download | LegacyCamera-530a0dee238412cbdff39bd64295c74f39cc782e.zip LegacyCamera-530a0dee238412cbdff39bd64295c74f39cc782e.tar.gz LegacyCamera-530a0dee238412cbdff39bd64295c74f39cc782e.tar.bz2 |
Merge "Fix 5521540: UI Tweaks." into ics-mr1
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ModePicker.java | 9 | ||||
-rw-r--r-- | src/com/android/camera/PreviewFrameLayout.java | 7 | ||||
-rw-r--r-- | src/com/android/camera/ui/IndicatorControlWheel.java | 35 |
3 files changed, 38 insertions, 13 deletions
diff --git a/src/com/android/camera/ModePicker.java b/src/com/android/camera/ModePicker.java index ccde71d..b79baa5 100644 --- a/src/com/android/camera/ModePicker.java +++ b/src/com/android/camera/ModePicker.java @@ -223,10 +223,13 @@ public class ModePicker extends RelativeLayout implements View.OnClickListener, } private void updateModeState() { - // Grey-out the unselected icons. - for (int i = 0; i < MODE_NUM; ++i) { - highlightView(mModeSelectionIcon[i], (i == mCurrentMode)); + // Grey-out the unselected icons for Phone UI. + if (mCurrentModeFrame != null) { + for (int i = 0; i < MODE_NUM; ++i) { + highlightView(mModeSelectionIcon[i], (i == mCurrentMode)); + } } + // Update the current mode icons on the Phone UI. The selected mode // should be in the center of the current mode icon bar. if (mCurrentModeFrame != null) { diff --git a/src/com/android/camera/PreviewFrameLayout.java b/src/com/android/camera/PreviewFrameLayout.java index 8429259..c16961a 100644 --- a/src/com/android/camera/PreviewFrameLayout.java +++ b/src/com/android/camera/PreviewFrameLayout.java @@ -16,9 +16,12 @@ package com.android.camera; +import com.android.camera.R; + import android.app.Activity; import android.content.Context; import android.content.pm.ActivityInfo; +import android.view.View; import android.util.AttributeSet; import android.widget.RelativeLayout; /** @@ -52,10 +55,10 @@ public class PreviewFrameLayout extends RelativeLayout { } public void showBorder(boolean enabled) { - setActivated(enabled); + findViewById(R.id.preview_border).setVisibility( + enabled ? View.VISIBLE : View.INVISIBLE); } - @Override protected void onMeasure(int widthSpec, int heightSpec) { int previewWidth = MeasureSpec.getSize(widthSpec); diff --git a/src/com/android/camera/ui/IndicatorControlWheel.java b/src/com/android/camera/ui/IndicatorControlWheel.java index 5f3d82a..24451a9 100644 --- a/src/com/android/camera/ui/IndicatorControlWheel.java +++ b/src/com/android/camera/ui/IndicatorControlWheel.java @@ -24,6 +24,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.Path; import android.graphics.RectF; import android.os.Handler; import android.os.SystemClock; @@ -65,6 +66,7 @@ public class IndicatorControlWheel extends IndicatorControl implements private static final int TIME_LAPSE_ARC_WIDTH = 6; private final int HIGHLIGHT_COLOR; + private final int HIGHLIGHT_FAN_COLOR; private final int TIME_LAPSE_ARC_COLOR; // The center of the shutter button. @@ -115,6 +117,7 @@ public class IndicatorControlWheel extends IndicatorControl implements super(context, attrs); Resources resources = context.getResources(); HIGHLIGHT_COLOR = resources.getColor(R.color.review_control_pressed_color); + HIGHLIGHT_FAN_COLOR = resources.getColor(R.color.review_control_pressed_fan_color); TIME_LAPSE_ARC_COLOR = resources.getColor(R.color.time_lapse_arc); setWillNotDraw(false); @@ -420,19 +423,35 @@ public class IndicatorControlWheel extends IndicatorControl implements @Override protected void onDraw(Canvas canvas) { - // Draw highlight. - float delta = mStrokeWidth * 0.5f; - float radius = (float) (mWheelRadius + mStrokeWidth * 0.5 + EDGE_STROKE_WIDTH); - mBackgroundRect.set(mCenterX - radius, mCenterY - radius, mCenterX + radius, - mCenterY + radius); - int selectedIndex = getSelectedIndicatorIndex(); // Draw the highlight arc if an indicator is selected or being pressed. - if (selectedIndex >= 0) { + if (selectedIndex >= 0) { int degree = (int) Math.toDegrees(mChildRadians[selectedIndex]); + float innerR = (float) mShutterButtonRadius; + float outerR = (float) (mShutterButtonRadius + mStrokeWidth + + EDGE_STROKE_WIDTH * 0.5); + + // Construct the path of the fan-shaped semi-transparent area. + Path fanPath = new Path(); + mBackgroundRect.set(mCenterX - innerR, mCenterY - innerR, + mCenterX + innerR, mCenterY + innerR); + fanPath.arcTo(mBackgroundRect, -degree + HIGHLIGHT_DEGREES / 2, + -HIGHLIGHT_DEGREES); + mBackgroundRect.set(mCenterX - outerR, mCenterY - outerR, + mCenterX + outerR, mCenterY + outerR); + fanPath.arcTo(mBackgroundRect, -degree - HIGHLIGHT_DEGREES / 2, + HIGHLIGHT_DEGREES); + fanPath.close(); + mBackgroundPaint.setStrokeWidth(HIGHLIGHT_WIDTH); - mBackgroundPaint.setStrokeCap(Paint.Cap.ROUND); + mBackgroundPaint.setStrokeCap(Paint.Cap.SQUARE); + mBackgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE); + mBackgroundPaint.setColor(HIGHLIGHT_FAN_COLOR); + canvas.drawPath(fanPath, mBackgroundPaint); + + // Draw the highlight edge + mBackgroundPaint.setStyle(Paint.Style.STROKE); mBackgroundPaint.setColor(HIGHLIGHT_COLOR); canvas.drawArc(mBackgroundRect, -degree - HIGHLIGHT_DEGREES / 2, HIGHLIGHT_DEGREES, false, mBackgroundPaint); |