summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChih-yu Huang <akahuang@google.com>2011-11-04 16:20:19 +0800
committerChih-Chung Chang <chihchung@google.com>2011-11-08 10:25:32 +0800
commit4b9791ff6763d310c750892b774119ad750c512a (patch)
tree071021e3f99994563c35ef70e9aa92b2caa8964a
parent08ce47f0a87dac202bfe3b97a12d1d059a3c88f6 (diff)
downloadLegacyCamera-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
-rw-r--r--res/layout-sw600dp/share_popup.xml11
-rw-r--r--res/layout/indicator_bar.xml12
-rw-r--r--res/layout/share_popup.xml11
-rw-r--r--src/com/android/camera/ui/AbstractIndicatorButton.java3
-rw-r--r--src/com/android/camera/ui/IndicatorButton.java4
-rw-r--r--src/com/android/camera/ui/IndicatorControlBar.java18
-rw-r--r--src/com/android/camera/ui/SecondLevelIndicatorControlBar.java20
7 files changed, 33 insertions, 46 deletions
diff --git a/res/layout-sw600dp/share_popup.xml b/res/layout-sw600dp/share_popup.xml
index 5f72365..900d646 100644
--- a/res/layout-sw600dp/share_popup.xml
+++ b/res/layout-sw600dp/share_popup.xml
@@ -61,22 +61,21 @@
android:layout_gravity="right"
android:background="@color/share_icon_background">
<com.android.camera.ui.RotateLayout
- android:layout_marginTop="8dip"
android:id="@+id/goto_gallery_button_rotate"
android:layout_gravity="center"
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
+ android:layout_height="@dimen/share_item_width" >
<ImageButton
android:id="@+id/goto_gallery_button"
android:background="?android:attr/selectableItemBackground"
- android:layout_gravity="center"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="center"
android:src="@drawable/ic_gallery" />
</com.android.camera.ui.RotateLayout>
<View
android:layout_width="match_parent"
- android:layout_margin="8dip"
+ android:layout_margin="8dp"
android:layout_height="1dp"
android:background="#5affffff" />
diff --git a/res/layout/indicator_bar.xml b/res/layout/indicator_bar.xml
index b7348b4..b3877d3 100644
--- a/res/layout/indicator_bar.xml
+++ b/res/layout/indicator_bar.xml
@@ -26,7 +26,8 @@
android:layout_width="match_parent">
<com.android.camera.ui.IndicatorControlBar
android:id="@+id/indicator_bar"
- android:padding="8dp"
+ android:paddingRight="8dp"
+ android:paddingLeft="8dp"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_centerVertical="true">
@@ -41,6 +42,7 @@
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:contentDescription="@string/accessibility_second_level_indicators"
+ android:background="@drawable/bg_pressed"
android:src="@drawable/ic_settings_holo_light" />
</com.android.camera.ui.IndicatorControlBar>
@@ -57,19 +59,13 @@
android:layout_height="match_parent"
android:layout_width="1dp"
android:background="@android:color/white" />
- <View android:id="@+id/indicator_highlight"
- android:layout_alignParentTop="true"
- android:layout_height="3dp"
- android:layout_width="0dp"
- android:background="@color/mode_selection_border"
- android:visibility="gone" />
<com.android.camera.ui.TwoStateImageView
android:id="@+id/back_to_first_level"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:contentDescription="@string/accessibility_back_to_first_level"
+ android:background="@drawable/bg_pressed"
android:src="@drawable/btn_close_settings" />
</com.android.camera.ui.SecondLevelIndicatorControlBar>
-
</RelativeLayout>
</com.android.camera.ui.IndicatorControlBarContainer>
diff --git a/res/layout/share_popup.xml b/res/layout/share_popup.xml
index d8035a0..aa70cf9 100644
--- a/res/layout/share_popup.xml
+++ b/res/layout/share_popup.xml
@@ -62,24 +62,23 @@
android:background="@color/share_icon_background">
<com.android.camera.ui.RotateLayout
android:layout_alignParentRight="true"
- android:layout_marginRight="8dip"
android:id="@+id/goto_gallery_button_rotate"
android:layout_centerVertical="true"
android:layout_height="match_parent"
- android:layout_width="wrap_content">
+ android:layout_width="@dimen/share_item_height">
<ImageButton
android:id="@+id/goto_gallery_button"
android:background="?android:attr/selectableItemBackground"
- android:layout_gravity="center"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_width="match_parent"
+ android:scaleType="center"
android:src="@drawable/ic_gallery" />
</com.android.camera.ui.RotateLayout>
<View
android:id="@+id/gallery_button_divider"
android:layout_toLeftOf="@+id/goto_gallery_button_rotate"
android:layout_height="match_parent"
- android:layout_margin="8dip"
+ android:layout_margin="8dp"
android:layout_width="1dp"
android:background="#5affffff" />
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