summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-11-17 20:12:34 -0800
committerAdam Powell <adamp@google.com>2010-11-17 20:30:33 -0800
commit432e5f9f167e622d03fee0e10215b6e2234c1a3c (patch)
treec534e32feacc7315c6f65ee3bc45dce8cab7a9aa /core
parent85a395dce0f8f70b29361d58a2a7c8c3e52dab4e (diff)
downloadframeworks_base-432e5f9f167e622d03fee0e10215b6e2234c1a3c.zip
frameworks_base-432e5f9f167e622d03fee0e10215b6e2234c1a3c.tar.gz
frameworks_base-432e5f9f167e622d03fee0e10215b6e2234c1a3c.tar.bz2
Fix bug 3167081 - Action Bar redesign to support "up"
Integrate new assets for action bar "up" and menu. Restructure action bar layout to support the new design. First pass at metrics. Change-Id: Iefc502bf398905208129ef41072bdf4a0225bfe0
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java84
-rw-r--r--core/res/res/drawable-hdpi/ic_ab_back_holo_dark.pngbin644 -> 743 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_ab_back_holo_light.pngbin657 -> 742 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_dark.pngbin693 -> 693 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_light.pngbin736 -> 736 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.pngbin547 -> 916 bytes
-rw-r--r--core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.pngbin588 -> 896 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_ab_back_holo_dark.pngbin500 -> 614 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_ab_back_holo_light.pngbin507 -> 614 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_dark.pngbin545 -> 545 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_light.pngbin552 -> 552 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.pngbin444 -> 660 bytes
-rw-r--r--core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.pngbin443 -> 697 bytes
-rw-r--r--core/res/res/layout/action_bar_home.xml34
-rwxr-xr-xcore/res/res/values/attrs.xml7
-rw-r--r--core/res/res/values/ids.xml1
-rw-r--r--core/res/res/values/public.xml2
-rw-r--r--core/res/res/values/styles.xml6
-rw-r--r--core/res/res/values/themes.xml2
19 files changed, 68 insertions, 68 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index e18f58f..b382cee 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -82,12 +82,10 @@ public class ActionBarView extends ViewGroup {
private Drawable mIcon;
private Drawable mLogo;
private Drawable mDivider;
- private Drawable mHomeAsUpIndicator;
- private LinearLayout mHomeLayout;
- private ImageView mHomeAsUpView;
+ private View mHomeLayout;
+ private View mHomeAsUpView;
private ImageView mIconView;
- private ImageView mLogoView;
private LinearLayout mTitleLayout;
private TextView mTitleView;
private TextView mSubtitleView;
@@ -172,18 +170,15 @@ public class ActionBarView extends ViewGroup {
}
}
- mHomeLayout = new LinearLayout(context, null,
- com.android.internal.R.attr.actionButtonStyle);
- mHomeLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT));
+ final LayoutInflater inflater = LayoutInflater.from(context);
- mHomeAsUpIndicator = a.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
+ final int homeResId = a.getResourceId(
+ com.android.internal.R.styleable.ActionBar_homeLayout, 0);
- mHomeAsUpView = new ImageView(context);
- mHomeAsUpView.setImageDrawable(mHomeAsUpIndicator);
- mHomeAsUpView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT));
- mHomeLayout.addView(mHomeAsUpView);
+ mHomeLayout = inflater.inflate(homeResId, this, false);
+
+ mHomeAsUpView = mHomeLayout.findViewById(com.android.internal.R.id.up);
+ mIconView = (ImageView) mHomeLayout.findViewById(com.android.internal.R.id.home);
Drawable background = a.getDrawable(R.styleable.ActionBar_background);
if (background != null) {
@@ -202,8 +197,7 @@ public class ActionBarView extends ViewGroup {
final int customNavId = a.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
if (customNavId != 0) {
- LayoutInflater inflater = LayoutInflater.from(context);
- mCustomNavView = (View) inflater.inflate(customNavId, null);
+ mCustomNavView = (View) inflater.inflate(customNavId, this, false);
mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD;
setDisplayOptions(mDisplayOptions | ActionBar.DISPLAY_SHOW_CUSTOM);
}
@@ -375,13 +369,12 @@ public class ActionBarView extends ViewGroup {
if ((flagsChanged & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeAsUpView.setVisibility((options & ActionBar.DISPLAY_HOME_AS_UP) != 0
- ? VISIBLE : GONE);
+ ? VISIBLE : INVISIBLE);
}
- if (mLogoView != null && (flagsChanged & ActionBar.DISPLAY_USE_LOGO) != 0) {
- final boolean logoVis = (options & ActionBar.DISPLAY_USE_LOGO) != 0;
- mLogoView.setVisibility(logoVis ? VISIBLE : GONE);
- mIconView.setVisibility(logoVis ? GONE : VISIBLE);
+ if ((flagsChanged & ActionBar.DISPLAY_USE_LOGO) != 0) {
+ final boolean logoVis = mLogo != null && (options & ActionBar.DISPLAY_USE_LOGO) != 0;
+ mIconView.setImageDrawable(logoVis ? mLogo : mIcon);
}
if ((flagsChanged & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
@@ -531,50 +524,8 @@ public class ActionBarView extends ViewGroup {
protected void onFinishInflate() {
super.onFinishInflate();
- final Context context = getContext();
-
- if (mLogo != null) {
- mLogoView = new ImageView(context);
- mLogoView.setScaleType(ImageView.ScaleType.CENTER);
- mLogoView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT));
- mLogoView.setImageDrawable(mLogo);
- mLogoView.setVisibility((mDisplayOptions & ActionBar.DISPLAY_USE_LOGO) != 0
- ? VISIBLE : GONE);
- mHomeLayout.addView(mLogoView);
- }
-
- if (mIcon != null) {
- mIconView = new ImageView(context, null,
- com.android.internal.R.attr.actionButtonStyle);
- mIconView.setScaleType(ImageView.ScaleType.CENTER);
- mIconView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT));
- mIconView.setImageDrawable(mIcon);
- mIconView.setVisibility(
- (mDisplayOptions & ActionBar.DISPLAY_USE_LOGO) == 0 || mLogo == null
- ? VISIBLE : GONE);
- mHomeLayout.addView(mIconView);
- }
-
addView(mHomeLayout);
- switch (mNavigationMode) {
- case ActionBar.NAVIGATION_MODE_STANDARD:
- if (mLogoView == null) {
- initTitle();
- }
- break;
-
- case ActionBar.NAVIGATION_MODE_LIST:
- throw new UnsupportedOperationException(
- "Inflating list navigation isn't supported yet!");
-
- case ActionBar.NAVIGATION_MODE_TABS:
- throw new UnsupportedOperationException(
- "Inflating tab navigation isn't supported yet!");
- }
-
if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
final ViewParent parent = mCustomNavView.getParent();
if (parent != this) {
@@ -653,8 +604,11 @@ public class ActionBarView extends ViewGroup {
int rightOfCenter = leftOfCenter;
if (mHomeLayout.getVisibility() != GONE) {
- availableWidth = measureChildView(mHomeLayout, availableWidth, childSpecHeight, 0);
- leftOfCenter -= mHomeLayout.getMeasuredWidth();
+ mHomeLayout.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
+ final int homeWidth = mHomeLayout.getMeasuredWidth();
+ availableWidth -= homeWidth;
+ leftOfCenter -= homeWidth;
}
if (mMenuView != null) {
diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
index a8da981..b4079db 100644
--- a/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
+++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
index af0f308..09e83e4 100644
--- a/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
+++ b/core/res/res/drawable-hdpi/ic_ab_back_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_dark.png b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_dark.png
index 061f80a..3ecaa9d 100644
--- a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_dark.png
+++ b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_light.png b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_light.png
index d818806..40009af 100644
--- a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_light.png
+++ b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_focused_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png
index 8563c1a..e21f534 100644
--- a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png
+++ b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png
index 1cd2384..9108fa1 100644
--- a/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png
+++ b/core/res/res/drawable-hdpi/ic_menu_moreoverflow_normal_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
index 7aae741..08a8eca 100644
--- a/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
+++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
index 66ef51c..0ffafd8 100644
--- a/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
+++ b/core/res/res/drawable-mdpi/ic_ab_back_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_dark.png b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_dark.png
index 6f87b11..c369e6f 100644
--- a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_dark.png
+++ b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_light.png b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_light.png
index 04dac38..a4df2bf 100644
--- a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_light.png
+++ b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_focused_holo_light.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png
index 5580af6..a7389c9 100644
--- a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png
+++ b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_dark.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png
index fc2081a..87e41ac 100644
--- a/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png
+++ b/core/res/res/drawable-mdpi/ic_menu_moreoverflow_normal_holo_light.png
Binary files differ
diff --git a/core/res/res/layout/action_bar_home.xml b/core/res/res/layout/action_bar_home.xml
new file mode 100644
index 0000000..e8b5637
--- /dev/null
+++ b/core/res/res/layout/action_bar_home.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:background="?android:attr/selectableItemBackground">
+ <ImageView android:id="@android:id/up"
+ android:src="?android:attr/homeAsUpIndicator"
+ android:layout_gravity="top|left"
+ android:visibility="invisible"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
+ <ImageView android:id="@android:id/home"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip"
+ android:layout_gravity="center"
+ android:scaleType="center" />
+</FrameLayout>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 555de5e..af1cab9 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -608,6 +608,9 @@
<!-- SearchView dropdown background -->
<attr name="searchDropdownBackground" format="reference" />
+
+ <!-- Specifies a drawable to use for the 'home as up' indicator. -->
+ <attr name="homeAsUpIndicator" format="reference" />
</declare-styleable>
<!-- **************************************************************** -->
@@ -4403,8 +4406,8 @@
<attr name="customNavigationLayout" format="reference" />
<!-- Specifies a fixed height. -->
<attr name="height" />
- <!-- Specifies a drawable to use for the 'home as up' indicator. -->
- <attr name="homeAsUpIndicator" format="reference" />
+ <!-- Specifies a layout to use for the "home" section of the action bar. -->
+ <attr name="homeLayout" format="reference" />
<!-- Specifies a style resource to use for an embedded progress bar. -->
<attr name="progressBarStyle" />
<!-- Specifies a style resource to use for an indeterminate progress spinner. -->
diff --git a/core/res/res/values/ids.xml b/core/res/res/values/ids.xml
index b7f177f..7a0fede 100644
--- a/core/res/res/values/ids.xml
+++ b/core/res/res/values/ids.xml
@@ -72,4 +72,5 @@
<item type="id" name="home" />
<item type="id" name="fillInIntent" />
<item type="id" name="rowTypeId" />
+ <item type="id" name="up" />
</resources>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index aedba17..b0be7e1 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1377,6 +1377,7 @@
<public type="attr" name="animationResolution" />
<public type="attr" name="state_accelerated" />
<public type="attr" name="baseline" />
+ <public type="attr" name="homeLayout" />
<public type="anim" name="animator_fade_in" />
<public type="anim" name="animator_fade_out" />
@@ -1394,6 +1395,7 @@
<!-- Context menu ID for the "Select text..." menu item to switch to text
selection context mode in text views. -->
<public type="id" name="selectTextMode" />
+ <public type="id" name="up" />
<!-- Standard content view for a {@link android.app.ListFragment}.
If you are implementing a subclass of ListFragment with your
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index dc67f45..457ba0c 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -917,6 +917,7 @@
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Subtitle</item>
<item name="android:progressBarStyle">@android:style/Widget.ProgressBar.Horizontal</item>
<item name="android:indeterminateProgressStyle">@android:style/Widget.ProgressBar.Small</item>
+ <item name="android:homeLayout">@layout/action_bar_home</item>
</style>
<style name="Widget.ActionMode">
@@ -1508,6 +1509,8 @@
<style name="Widget.Holo.ActionButton.Overflow">
<item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_dark</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:paddingLeft">16dip</item>
+ <item name="android:paddingRight">16dip</item>
</style>
<style name="Widget.Holo.ActionButton.TextButton" parent="Widget.Holo.ButtonBar.Button">
@@ -1540,7 +1543,6 @@
<item name="android:subtitleTextStyle">@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle</item>
<item name="android:background">@null</item>
<item name="android:divider">?android:attr/dividerVertical</item>
- <item name="android:homeAsUpIndicator">@android:drawable/ic_ab_back_holo_dark</item>
<item name="android:progressBarStyle">@android:style/Widget.Holo.ProgressBar.Horizontal</item>
<item name="android:indeterminateProgressStyle">@android:style/Widget.Holo.ProgressBar</item>
<item name="android:progressBarPadding">32dip</item>
@@ -1773,6 +1775,8 @@
<style name="Widget.Holo.Light.ActionButton.Overflow">
<item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_light</item>
<item name="android:background">?android:attr/selectableItemBackground</item>
+ <item name="android:paddingLeft">16dip</item>
+ <item name="android:paddingRight">16dip</item>
</style>
<style name="Widget.Holo.Light.ActionBarView_TabView" parent="Widget.ActionBarView_TabView">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index a409c24..b5dcf05 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -706,6 +706,7 @@
<item name="groupButtonBackground">@android:drawable/group_button_background_holo_dark</item>
<item name="selectableItemBackground">@android:drawable/item_background_holo_dark</item>
+ <item name="homeAsUpIndicator">@android:drawable/ic_ab_back_holo_dark</item>
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>
@@ -942,6 +943,7 @@
<item name="groupButtonBackground">@android:drawable/group_button_background_holo_light</item>
<item name="selectableItemBackground">@android:drawable/item_background_holo_light</item>
+ <item name="homeAsUpIndicator">@android:drawable/ic_ab_back_holo_light</item>
<!-- List attributes -->
<item name="listPreferredItemHeight">64dip</item>