summaryrefslogtreecommitdiffstats
path: root/core/res
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-06-10 18:58:59 -0700
committerAdam Powell <adamp@google.com>2010-06-17 11:35:43 -0700
commit96675b1df3969f2d313b68f60ed9fa36805db8ce (patch)
tree0bf8088a354d1e4f392a6adccda1911c0a0d890e /core/res
parente6ac8b9aade9443ab8456c8f7a47cdfba3b70266 (diff)
downloadframeworks_base-96675b1df3969f2d313b68f60ed9fa36805db8ce.zip
frameworks_base-96675b1df3969f2d313b68f60ed9fa36805db8ce.tar.gz
frameworks_base-96675b1df3969f2d313b68f60ed9fa36805db8ce.tar.bz2
Merging ActionBar menu with options menu.
Options menu items may now specify if they would like to appear in the action bar. Menu items defined in xml may set the showAsAction attribute to one of "never"(default), "ifRoom", or "always". Action buttons are populated as follows: * All showAsAction="always" items become action buttons, even if it would crowd the navigation area of the action bar. * If there is space remaining, showAsAction="ifRoom" items are added until no more will fit comfortably. Action button click events are now handled by the onOptionsItemSelected method used by the standard options menu. The construction of options menus now happens earlier in order to provide data to the action bar. Activities with an action bar can now expect to have onCreateOptionsMenu called when activity start-up is complete. Activity#invalidateOptionsMenu can be used to force a refresh of menu items where the previous API would use ActionBar#updateActionMenu. Change-Id: If52ddf1cf9f6926206bcdeadf42072ea2c24fab9
Diffstat (limited to 'core/res')
-rw-r--r--core/res/res/layout/action_menu_item_layout.xml20
-rw-r--r--core/res/res/layout/action_menu_layout.xml20
-rwxr-xr-xcore/res/res/values/attrs.xml13
-rw-r--r--core/res/res/values/public.xml5
-rw-r--r--core/res/res/values/styles.xml3
-rw-r--r--core/res/res/values/themes.xml2
6 files changed, 62 insertions, 1 deletions
diff --git a/core/res/res/layout/action_menu_item_layout.xml b/core/res/res/layout/action_menu_item_layout.xml
new file mode 100644
index 0000000..3f06251
--- /dev/null
+++ b/core/res/res/layout/action_menu_item_layout.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<com.android.internal.view.menu.ActionMenuItemView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
diff --git a/core/res/res/layout/action_menu_layout.xml b/core/res/res/layout/action_menu_layout.xml
new file mode 100644
index 0000000..18d5531
--- /dev/null
+++ b/core/res/res/layout/action_menu_layout.xml
@@ -0,0 +1,20 @@
+<?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.
+-->
+
+<com.android.internal.view.menu.ActionMenuView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" />
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index d3e66ee..d984575 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -397,8 +397,12 @@
<attr name="horizontalScrollViewStyle" format="reference" />
<!-- Default Spinner style. -->
<attr name="spinnerStyle" format="reference" />
- <!-- Dropdown Spinner style. -->
+ <!-- Default dropdown Spinner style. -->
<attr name="dropDownSpinnerStyle" format="reference" />
+ <!-- Default ActionBar dropdown style. -->
+ <attr name="actionDropDownStyle" format="reference" />
+ <!-- Default action button style. -->
+ <attr name="actionButtonStyle" format="reference" />
<!-- Default Star style. -->
<attr name="starStyle" format="reference" />
<!-- Default TabWidget style. -->
@@ -3287,6 +3291,13 @@
called when the item is clicked. -->
<attr name="onClick" />
+ <!-- How this item should display in the Action Bar, if present. -->
+ <attr name="showAsAction" format="enum">
+ <enum name="never" value="0" />
+ <enum name="ifRoom" value="1" />
+ <enum name="always" value="2" />
+ </attr>
+
</declare-styleable>
<!-- **************************************************************** -->
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 8b1c9d4..3dba1a0 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1294,10 +1294,15 @@
<public type="attr" name="hardwareAccelerated" />
<public type="attr" name="measureWithLargestChild" />
<public type="attr" name="animateFirstView" />
+ <public type="attr" name="dropDownSpinnerStyle" />
+ <public type="attr" name="actionDropDownStyle" />
+ <public type="attr" name="actionButtonStyle" />
+ <public type="attr" name="showAsAction" />
<public type="id" name="home" />
<public type="style" name="Theme.WithActionBar" />
<public type="style" name="Widget.Spinner.DropDown" />
+ <public type="style" name="Widget.ActionButton" />
</resources>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 4f74413..5ed26d3 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -873,4 +873,7 @@
<item name="android:displayOptions">useLogo</item>
<item name="android:divider">@android:drawable/action_bar_divider</item>
</style>
+
+ <style name="Widget.ActionButton">
+ </style>
</resources>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index bc5f610..1f9f136 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -170,6 +170,8 @@
<item name="horizontalScrollViewStyle">@android:style/Widget.HorizontalScrollView</item>
<item name="spinnerStyle">@android:style/Widget.Spinner</item>
<item name="dropDownSpinnerStyle">@android:style/Widget.Spinner.DropDown</item>
+ <item name="actionDropDownStyle">@android:style/Widget.Spinner.DropDown</item>
+ <item name="actionButtonStyle">@android:style/Widget.ActionButton</item>
<item name="starStyle">@android:style/Widget.CompoundButton.Star</item>
<item name="tabWidgetStyle">@android:style/Widget.TabWidget</item>
<item name="textViewStyle">@android:style/Widget.TextView</item>