diff options
author | Chih-yu Huang <akahuang@google.com> | 2011-11-04 16:20:19 +0800 |
---|---|---|
committer | Chih-Chung Chang <chihchung@google.com> | 2011-11-08 10:25:32 +0800 |
commit | 4b9791ff6763d310c750892b774119ad750c512a (patch) | |
tree | 071021e3f99994563c35ef70e9aa92b2caa8964a /src/com/android/camera | |
parent | 08ce47f0a87dac202bfe3b97a12d1d059a3c88f6 (diff) | |
download | LegacyCamera-4b9791ff6763d310c750892b774119ad750c512a.zip LegacyCamera-4b9791ff6763d310c750892b774119ad750c512a.tar.gz LegacyCamera-4b9791ff6763d310c750892b774119ad750c512a.tar.bz2 |
Change highlight pattern in indicatorbar.
Use the blue press state for all the icons in the setting bar,
fill the whole bar width with a square instead of blue arc.
Also make the share icon touch area larger.
bug:5521011
Change-Id: I2db26c41758d230e8455696346a90a33b7e3efb6
Diffstat (limited to 'src/com/android/camera')
4 files changed, 19 insertions, 26 deletions
diff --git a/src/com/android/camera/ui/AbstractIndicatorButton.java b/src/com/android/camera/ui/AbstractIndicatorButton.java index 0ff7b19..362becf 100644 --- a/src/com/android/camera/ui/AbstractIndicatorButton.java +++ b/src/com/android/camera/ui/AbstractIndicatorButton.java @@ -38,7 +38,6 @@ public abstract class AbstractIndicatorButton extends RotateImageView implements private final int MSG_DISMISS_POPUP = 0; private IndicatorChangeListener mListener; - public static interface IndicatorChangeListener { public void onShowIndicator(View view, boolean showed); } @@ -116,6 +115,7 @@ public abstract class AbstractIndicatorButton extends RotateImageView implements abstract protected void initializePopup(); private void showPopup() { + setPressed(true); mHandler.removeMessages(MSG_DISMISS_POPUP); if (mPopup == null) initializePopup(); @@ -127,6 +127,7 @@ public abstract class AbstractIndicatorButton extends RotateImageView implements } public boolean dismissPopup() { + setPressed(false); mHandler.removeMessages(MSG_DISMISS_POPUP); if (mPopup != null && mPopup.getVisibility() == View.VISIBLE) { mPopup.clearAnimation(); diff --git a/src/com/android/camera/ui/IndicatorButton.java b/src/com/android/camera/ui/IndicatorButton.java index b384b4e..d4eed84 100644 --- a/src/com/android/camera/ui/IndicatorButton.java +++ b/src/com/android/camera/ui/IndicatorButton.java @@ -27,8 +27,8 @@ import android.view.ViewGroup; // An indicator button that represents one camera setting. Ex: flash. Pressing it opens a popup // window. -public class IndicatorButton extends AbstractIndicatorButton implements BasicSettingPopup.Listener, - EffectSettingPopup.Listener{ +public class IndicatorButton extends AbstractIndicatorButton + implements BasicSettingPopup.Listener, EffectSettingPopup.Listener{ private final String TAG = "IndicatorButton"; private IconListPreference mPreference; // Scene mode can override the original preference value. diff --git a/src/com/android/camera/ui/IndicatorControlBar.java b/src/com/android/camera/ui/IndicatorControlBar.java index 8ab61fd..197c594 100644 --- a/src/com/android/camera/ui/IndicatorControlBar.java +++ b/src/com/android/camera/ui/IndicatorControlBar.java @@ -57,6 +57,7 @@ public class IndicatorControlBar extends IndicatorControl implements // Add CameraPicker control. initializeCameraPicker(); + mCameraPicker.setBackgroundResource(R.drawable.bg_pressed); // Add the ZoomControl if supported. if (zoomSupported) { @@ -83,22 +84,27 @@ public class IndicatorControlBar extends IndicatorControl implements @Override protected void onLayout( boolean changed, int left, int top, int right, int bottom) { - int padding = getPaddingTop(); - int count = getChildCount(); if (count == 0) return; + + // We have (equal) paddings at left and right, but no padding at top or + // bottom. + int padding = getPaddingLeft(); + int width = right - left; int height = bottom - top; - mSecondLevelIcon.layout(0, 0, height, height); + // We want the icons to be square (size x size) + int size = height; + + mSecondLevelIcon.layout(padding, 0, padding + size, size); // Layout the zoom control if required. - int offset = padding + height; // the padding and the icon height if (mZoomControl != null) { - mZoomControl.layout(offset, 0, right - left - offset, height); + mZoomControl.layout(padding + size, 0, width - padding - size, size); } if (mCameraPicker != null) { - mCameraPicker.layout(right - left - offset, 0, right - left, height); + mCameraPicker.layout(width - padding - size, 0, width - padding, size); } } diff --git a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java index fbf1585..bc29d88 100644 --- a/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java +++ b/src/com/android/camera/ui/SecondLevelIndicatorControlBar.java @@ -37,7 +37,6 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements private static int ICON_SPACING = Util.dpToPixel(16); private View mCloseIcon; private View mDivider; // the divider line - private View mIndicatorHighlight; // the side highlight bar private View mPopupedIndicator; int mOrientation = 0; int mSelectedIndex = -1; @@ -53,7 +52,6 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements @Override protected void onFinishInflate() { mDivider = findViewById(R.id.divider); - mIndicatorHighlight = findViewById(R.id.indicator_highlight); mCloseIcon = findViewById(R.id.back_to_first_level); mCloseIcon.setOnClickListener(this); } @@ -103,15 +101,13 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements if (!isEnabled()) return false; double x = (double) event.getX(); - double y = (double) event.getY(); int width = getWidth(); if (width == 0) return false; // the event is sent before onMeasure() if (x > width) x = width; - if (y >= getHeight()) y = getHeight() - 1; int index = getTouchViewIndex((int) x, width); - if (index == -1) return true; View b = getChildAt(index); + if (b == null) return true; dispatchRelativeTouchEvent(b, event); if ((mSelectedIndex != -1) && (index != mSelectedIndex)) { View v = getChildAt(mSelectedIndex); @@ -134,6 +130,7 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements @Override public IndicatorButton addIndicator(Context context, IconListPreference pref) { IndicatorButton b = super.addIndicator(context, pref); + b.setBackgroundResource(R.drawable.bg_pressed); b.setIndicatorChangeListener(this); return b; } @@ -143,6 +140,7 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements int resId, String[] keys) { OtherSettingIndicatorButton b = super.addOtherSettingIndicator(context, resId, keys); + b.setBackgroundResource(R.drawable.bg_pressed); b.setIndicatorChangeListener(this); return b; } @@ -188,18 +186,6 @@ public class SecondLevelIndicatorControlBar extends IndicatorControl implements offsetX = width - iconWidth - padding; // The first icon is close button. mCloseIcon.layout(offsetX, 0, (offsetX + iconWidth), height); - - // Hightlight the selected indicator if exists. - if (mPopupedIndicator == null) { - mIndicatorHighlight.setVisibility(View.GONE); - } else { - mIndicatorHighlight.setVisibility(View.VISIBLE); - // Keep the top and bottom of the hightlight the same as - // the 'active' indicator button. - mIndicatorHighlight.layout(mPopupedIndicator.getLeft(), 0, - mPopupedIndicator.getRight(), - mIndicatorHighlight.getLayoutParams().height); - } } @Override |