Merge "Remove Native Action Bar support for Honeycomb" into jb-mr2-dev
diff --git a/v7/appcompat/res/values-large/dimens.xml b/v7/appcompat/res/values-large/dimens.xml
index f61d6d2..dd9ecd9 100644
--- a/v7/appcompat/res/values-large/dimens.xml
+++ b/v7/appcompat/res/values-large/dimens.xml
@@ -15,8 +15,11 @@
-->
<resources>
-
<!-- Minimum width of the search view text entry area. -->
<dimen name="abc_search_view_text_min_width">192dip</dimen>
+ <!-- The maximum number of action buttons that should be permitted within
+ an action bar/action mode. This will be used to determine how many
+ showAsAction="ifRoom" items can fit. "always" items can override this. -->
+ <integer name="abc_max_action_buttons">4</integer>
</resources>
diff --git a/v7/appcompat/res/values-v11/styles_base.xml b/v7/appcompat/res/values-v11/styles_base.xml
index 0488a21..2cee503 100644
--- a/v7/appcompat/res/values-v11/styles_base.xml
+++ b/v7/appcompat/res/values-v11/styles_base.xml
@@ -21,93 +21,7 @@
variants are for direct use or use as parent styles by the app. -->
<eat-comment/>
- <!-- Action Bar Spinner Widgets -->
-
- <style name="Widget.AppCompat.Base.ListView.DropDown"
- parent="android:Widget.Holo.ListView.DropDown"/>
-
- <style name="Widget.AppCompat.Light.Base.ListView.DropDown"
- parent="android:Widget.Holo.ListView.DropDown"/>
-
- <style name="Widget.AppCompat.Base.DropDownItem.Spinner"
- parent="android:Widget.Holo.DropDownItem.Spinner"/>
-
- <style name="Widget.AppCompat.Light.Base.DropDownItem.Spinner"
- parent="android:Widget.Holo.Light.DropDownItem.Spinner"/>
-
- <style name="Widget.AppCompat.Base.Spinner"
- parent="android:Widget.Holo.Spinner"/>
-
- <style name="Widget.AppCompat.Light.Base.Spinner"
- parent="android:Widget.Holo.Light.Spinner"/>
-
- <style name="Widget.AppCompat.Base.DropDownItem.Spinner"
- parent="android:Widget.Holo.DropDownItem.Spinner"/>
-
- <style name="Widget.AppCompat.Light.Base.DropDownItem.Spinner"
- parent="android:Widget.Holo.Light.DropDownItem.Spinner">
- </style>
-
- <!-- ActionBar -->
- <style name="Widget.AppCompat.Base.ActionBar" parent="android:Widget.Holo.ActionBar">
- </style>
-
- <style name="Widget.AppCompat.Light.Base.ActionBar"
- parent="android:Widget.Holo.Light.ActionBar">
- </style>
-
- <!-- Patterned after style name="Widget.Holo.ActionBar.Solid" -->
- <style name="Widget.AppCompat.Base.ActionBar.Solid" parent="android:Widget.Holo.ActionBar">
- <item name="android:background">@drawable/abc_ab_solid_dark_holo</item>
- </style>
-
- <!-- Patterned after style name="Widget.Holo.Light.ActionBar.Solid" -->
- <style name="Widget.AppCompat.Light.Base.ActionBar.Solid"
- parent="android:Widget.Holo.Light.ActionBar">
- <item name="android:background">@drawable/abc_ab_solid_light_holo</item>
- </style>
-
- <style name="Widget.AppCompat.Base.ActionButton" parent="android:Widget.Holo.ActionButton">
- </style>
-
- <style name="Widget.AppCompat.Light.Base.ActionButton"
- parent="android:Widget.Holo.Light.ActionButton">
- </style>
-
- <style name="Widget.AppCompat.Base.ActionButton.CloseMode"
- parent="android:Widget.Holo.ActionButton.CloseMode">
- </style>
-
- <style name="Widget.AppCompat.Light.Base.ActionButton.CloseMode"
- parent="android:Widget.Holo.Light.ActionButton.CloseMode">
- </style>
-
- <style name="Widget.AppCompat.Base.ActionButton.Overflow"
- parent="android:Widget.Holo.ActionButton.Overflow">
- </style>
-
- <style name="Widget.AppCompat.Light.Base.ActionButton.Overflow"
- parent="android:Widget.Holo.Light.ActionButton.Overflow">
- </style>
-
- <style name="Widget.AppCompat.Base.ActionMode" parent="android:Widget.Holo.ActionMode">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Title"
- parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Subtitle"
- parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Title"
- parent="android:TextAppearance.Holo.Widget.ActionMode.Title">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Subtitle"
- parent="android:TextAppearance.Holo.Widget.ActionMode.Subtitle">
- </style>
+ <!-- Progress Bar -->
<style name="Widget.AppCompat.Base.ProgressBar.Horizontal"
parent="android:Widget.Holo.ProgressBar.Horizontal">
@@ -117,36 +31,7 @@
parent="android:Widget.Holo.ProgressBar">
</style>
- <style name="Widget.AppCompat.Base.ListView.Menu" parent="android:Widget.ListView.Menu">
- </style>
-
- <!--
- Inverse styles. As we don't have a DarkActionBar theme on v11, these extend
- from the respective Light styles
- -->
- <style name="Widget.AppCompat.Light.Base.ActionBar.Solid.Inverse"
- parent="Widget.AppCompat.Light.Base.ActionBar.Solid">
- </style>
-
- <style name="Widget.AppCompat.Light.Base.ActionMode.Inverse"
- parent="Widget.AppCompat.Base.ActionMode">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Title.Inverse"
- parent="TextAppearance.AppCompat.Widget.Base.ActionMode.Title">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Subtitle.Inverse"
- parent="TextAppearance.AppCompat.Widget.Base.ActionMode.Subtitle">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Title.Inverse"
- parent="TextAppearance.AppCompat.Widget.Base.ActionBar.Title">
- </style>
-
- <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Subtitle.Inverse"
- parent="TextAppearance.AppCompat.Widget.Base.ActionBar.Subtitle">
- </style>
+ <!-- AutoCompleteTextView styles (for SearchView) -->
<style name="Widget.AppCompat.Base.AutoCompleteTextView"
parent="android:Widget.Holo.AutoCompleteTextView">
@@ -156,4 +41,4 @@
parent="android:Widget.Holo.Light.AutoCompleteTextView">
</style>
-</resources>
+</resources>
\ No newline at end of file
diff --git a/v7/appcompat/res/values-v11/themes_base.xml b/v7/appcompat/res/values-v11/themes_base.xml
index 9d1c07e..30c78e4 100644
--- a/v7/appcompat/res/values-v11/themes_base.xml
+++ b/v7/appcompat/res/values-v11/themes_base.xml
@@ -27,49 +27,16 @@
Honeycomb+. You probably want to edit values/themes.xml instead. -->
<eat-comment/>
- <!-- Base platform-dependent theme providing an action bar in a dark-themed activity. -->
- <style name="Theme.Base.AppCompat" parent="android:Theme.Holo">
- <!-- Copy system flag values for our use -->
- <item name="windowActionBar">?android:attr/windowActionBar</item>
- <item name="actionBarSize">?android:attr/actionBarSize</item>
- <item name="actionBarItemBackground">?android:attr/selectableItemBackground</item>
- <item name="selectableItemBackground">?android:attr/selectableItemBackground</item>
- <item name="actionButtonStyle">?android:attr/actionButtonStyle</item>
- <item name="dividerVertical">?android:attr/dividerVertical</item>
- <item name="dividerHorizontal">?android:attr/dividerHorizontal</item>
- <item name="actionBarWidgetTheme">@null</item>
-
- <!-- Required for use of support_simple_spinner_dropdown_item.xml -->
- <item name="listPreferredItemHeight">?android:attr/listPreferredItemHeight</item>
- <item name="listPreferredItemHeightSmall">48dp</item>
- <item name="listPreferredItemHeightLarge">80dp</item>
- <item name="listPreferredItemPaddingLeft">8dip</item>
- <item name="listPreferredItemPaddingRight">8dip</item>
+ <!-- Base platform-dependent theme -->
+ <style name="Theme.Base" parent="android:Theme.Holo">
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowActionBar">false</item>
</style>
- <!-- Base platform-dependent theme providing an action bar in a light-themed activity. -->
- <style name="Theme.Base.AppCompat.Light" parent="android:Theme.Holo.Light">
- <!-- Copy system flag values for our use -->
- <item name="windowActionBar">?android:attr/windowActionBar</item>
- <item name="actionBarSize">?android:attr/actionBarSize</item>
- <item name="actionBarItemBackground">?android:attr/selectableItemBackground</item>
- <item name="selectableItemBackground">?android:attr/selectableItemBackground</item>
- <item name="actionButtonStyle">?android:attr/actionButtonStyle</item>
- <item name="dividerVertical">?android:attr/dividerVertical</item>
- <item name="dividerHorizontal">?android:attr/dividerHorizontal</item>
- <item name="actionBarWidgetTheme">@null</item>
-
- <!-- Required for use of support_simple_spinner_dropdown_item.xml -->
- <item name="listPreferredItemHeight">?android:attr/listPreferredItemHeight</item>
- <item name="listPreferredItemHeightSmall">48dp</item>
- <item name="listPreferredItemHeightLarge">80dp</item>
- <item name="listPreferredItemPaddingLeft">8dip</item>
- <item name="listPreferredItemPaddingRight">8dip</item>
- </style>
-
- <!-- Base platform-dependent theme. There is no DarkActionBar theme in v11, so we use Light -->
- <style name="Theme.Base.AppCompat.Light.DarkActionBar"
- parent="Theme.Base.AppCompat.Light">
+ <!-- Base platform-dependent theme providing a light-themed activity. -->
+ <style name="Theme.Base.Light" parent="android:Theme.Holo.Light">
+ <item name="android:windowNoTitle">true</item>
+ <item name="android:windowActionBar">false</item>
</style>
</resources>
diff --git a/v7/appcompat/res/values-v14/styles_base.xml b/v7/appcompat/res/values-v14/styles_base.xml
index e38bde8..410898b 100644
--- a/v7/appcompat/res/values-v14/styles_base.xml
+++ b/v7/appcompat/res/values-v14/styles_base.xml
@@ -21,6 +21,13 @@
variants are for direct use or use as parent styles by the app. -->
<eat-comment/>
+ <style name="Widget.AppCompat.Base.ActionBar"
+ parent="android:Widget.Holo.ActionBar">
+ </style>
+
+ <style name="Widget.AppCompat.Light.Base.ActionBar"
+ parent="android:Widget.Holo.Light.ActionBar">
+ </style>
<style name="Widget.AppCompat.Base.ActionBar.Solid"
parent="android:Widget.Holo.ActionBar.Solid">
@@ -78,6 +85,14 @@
parent="android:TextAppearance.Holo.Widget.ActionBar.Menu">
</style>
+ <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Title"
+ parent="android:TextAppearance.Holo.Widget.ActionBar.Title">
+ </style>
+
+ <style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Subtitle"
+ parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle">
+ </style>
+
<style name="TextAppearance.AppCompat.Widget.Base.ActionBar.Title.Inverse"
parent="android:TextAppearance.Holo.Widget.ActionBar.Title.Inverse">
</style>
@@ -86,6 +101,14 @@
parent="android:TextAppearance.Holo.Widget.ActionBar.Subtitle.Inverse">
</style>
+ <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Title"
+ parent="android:TextAppearance.Holo.Widget.ActionMode.Title">
+ </style>
+
+ <style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Subtitle"
+ parent="android:TextAppearance.Holo.Widget.ActionMode.Subtitle">
+ </style>
+
<style name="TextAppearance.AppCompat.Widget.Base.ActionMode.Title.Inverse"
parent="android:TextAppearance.Holo.Widget.ActionMode.Title.Inverse">
</style>
@@ -94,29 +117,78 @@
parent="android:TextAppearance.Holo.Widget.ActionMode.Subtitle.Inverse">
</style>
+ <!-- Action Button Styles -->
+
+ <style name="Widget.AppCompat.Base.ActionButton" parent="android:Widget.Holo.ActionButton">
+ </style>
+
+ <style name="Widget.AppCompat.Light.Base.ActionButton"
+ parent="android:Widget.Holo.Light.ActionButton">
+ </style>
+
+ <style name="Widget.AppCompat.Base.ActionButton.CloseMode"
+ parent="android:Widget.Holo.ActionButton.CloseMode">
+ </style>
+
+ <style name="Widget.AppCompat.Light.Base.ActionButton.CloseMode"
+ parent="android:Widget.Holo.Light.ActionButton.CloseMode">
+ </style>
+
+ <style name="Widget.AppCompat.Base.ActionButton.Overflow"
+ parent="android:Widget.Holo.ActionButton.Overflow">
+ </style>
+
+ <style name="Widget.AppCompat.Light.Base.ActionButton.Overflow"
+ parent="android:Widget.Holo.Light.ActionButton.Overflow">
+ </style>
+
+ <!-- Spinner Widgets -->
+
+ <style name="Widget.AppCompat.Base.ListView.DropDown"
+ parent="android:Widget.Holo.ListView.DropDown"/>
+
+ <style name="Widget.AppCompat.Light.Base.ListView.DropDown"
+ parent="android:Widget.Holo.ListView.DropDown"/>
+
+ <style name="Widget.AppCompat.Base.DropDownItem.Spinner"
+ parent="android:Widget.Holo.DropDownItem.Spinner"/>
+
+ <style name="Widget.AppCompat.Light.Base.DropDownItem.Spinner"
+ parent="android:Widget.Holo.Light.DropDownItem.Spinner"/>
+
+ <style name="Widget.AppCompat.Base.Spinner" parent="android:Widget.Holo.Spinner" />
+
+ <style name="Widget.AppCompat.Light.Base.Spinner" parent="android:Widget.Holo.Light.Spinner"/>
+
+ <style name="Widget.AppCompat.Base.ListView.Menu" parent="android:Widget.ListView.Menu" />
+
+ <!-- Popup Menu -->
+
<style name="Widget.AppCompat.Base.PopupMenu" parent="android:Widget.Holo.PopupMenu">
</style>
<style name="Widget.AppCompat.Light.Base.PopupMenu"
- parent="android:Widget.Holo.Light.PopupMenu">
+ parent="android:Widget.Holo.Light.PopupMenu">
</style>
<style name="TextAppearance.AppCompat.Base.Widget.PopupMenu.Large"
- parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
+ parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
</style>
<style name="TextAppearance.AppCompat.Base.Widget.PopupMenu.Small"
- parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
+ parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
</style>
<style name="TextAppearance.AppCompat.Light.Base.Widget.PopupMenu.Large"
- parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
+ parent="android:TextAppearance.Holo.Widget.PopupMenu.Large">
</style>
<style name="TextAppearance.AppCompat.Light.Base.Widget.PopupMenu.Small"
- parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
+ parent="android:TextAppearance.Holo.Widget.PopupMenu.Small">
</style>
+ <!-- Search View result styles -->
+
<style name="TextAppearance.AppCompat.Base.SearchResult.Title"
parent="@android:TextAppearance.Holo.SearchResult.Title">
</style>
@@ -126,7 +198,7 @@
</style>
<!--
- TextAppearance.Holo.Light.SearchResult.* aren't public so we extend from the default
+ TextAppearance.Holo.Light.SearchResult.* are private so we extend from the default
versions instead (which are exactly the same).
-->
<style name="TextAppearance.AppCompat.Light.Base.SearchResult.Title"
diff --git a/v7/appcompat/res/values-w600dp/dimens.xml b/v7/appcompat/res/values-w600dp/dimens.xml
index c2f6154..5bbc34d 100644
--- a/v7/appcompat/res/values-w600dp/dimens.xml
+++ b/v7/appcompat/res/values-w600dp/dimens.xml
@@ -19,4 +19,22 @@
an action bar/action mode. This will be used to determine how many
showAsAction="ifRoom" items can fit. "always" items can override this. -->
<integer name="abc_max_action_buttons">5</integer>
+
+ <!-- Default height of an action bar. -->
+ <dimen name="abc_action_bar_default_height">56dip</dimen>
+ <!-- Vertical padding around action bar icons. -->
+ <dimen name="abc_action_bar_icon_vertical_padding">4dip</dimen>
+ <!-- Text size for action bar titles -->
+ <dimen name="abc_action_bar_title_text_size">18dp</dimen>
+ <!-- Text size for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_text_size">14dp</dimen>
+ <!-- Top margin for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_top_margin">-3dp</dimen>
+ <!-- Bottom margin for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_bottom_margin">9dip</dimen>
+ <!-- Minimum width for an action button in the menu area of an action bar -->
+ <dimen name="abc_action_button_min_width">64dip</dimen>
+
+ <!-- Minimum width of the search view text entry area. -->
+ <dimen name="abc_search_view_text_min_width">192dip</dimen>
</resources>
\ No newline at end of file
diff --git a/v7/appcompat/res/values-xlarge/bools.xml b/v7/appcompat/res/values-xlarge/bools.xml
new file mode 100644
index 0000000..05c5aab
--- /dev/null
+++ b/v7/appcompat/res/values-xlarge/bools.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+
+<resources>
+ <bool name="abc_action_bar_expanded_action_views_exclusive">false</bool>
+</resources>
\ No newline at end of file
diff --git a/v7/appcompat/res/values-xlarge/dimens.xml b/v7/appcompat/res/values-xlarge/dimens.xml
new file mode 100644
index 0000000..6217586
--- /dev/null
+++ b/v7/appcompat/res/values-xlarge/dimens.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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.
+-->
+
+<resources>
+
+ <!-- The maximum number of action buttons that should be permitted within
+ an action bar/action mode. This will be used to determine how many
+ showAsAction="ifRoom" items can fit. "always" items can override this. -->
+ <integer name="abc_max_action_buttons">5</integer>
+
+ <!-- Default height of an action bar. -->
+ <dimen name="abc_action_bar_default_height">56dip</dimen>
+ <!-- Vertical padding around action bar icons. -->
+ <dimen name="abc_action_bar_icon_vertical_padding">4dip</dimen>
+ <!-- Text size for action bar titles -->
+ <dimen name="abc_action_bar_title_text_size">18dp</dimen>
+ <!-- Text size for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_text_size">14dp</dimen>
+ <!-- Top margin for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_top_margin">-3dp</dimen>
+ <!-- Bottom margin for action bar subtitles -->
+ <dimen name="abc_action_bar_subtitle_bottom_margin">9dip</dimen>
+ <!-- Minimum width for an action button in the menu area of an action bar -->
+ <dimen name="abc_action_button_min_width">64dip</dimen>
+
+ <!-- Minimum width of the search view text entry area. -->
+ <dimen name="abc_search_view_text_min_width">192dip</dimen>
+
+</resources>
diff --git a/v7/appcompat/res/values/attrs.xml b/v7/appcompat/res/values/attrs.xml
index 2c747f2..89749c0 100644
--- a/v7/appcompat/res/values/attrs.xml
+++ b/v7/appcompat/res/values/attrs.xml
@@ -548,4 +548,9 @@
<!-- Default ActivityChooserView style. -->
<attr name="activityChooserViewStyle" format="reference" />
+ <declare-styleable name="CompatTextView">
+ <!-- Present the text in ALL CAPS. This may use a small-caps form when available. -->
+ <attr name="textAllCaps" format="reference|boolean" />
+ </declare-styleable>
+
</resources>
diff --git a/v7/appcompat/res/values/config.xml b/v7/appcompat/res/values/config.xml
index e39c548..8c027d1 100644
--- a/v7/appcompat/res/values/config.xml
+++ b/v7/appcompat/res/values/config.xml
@@ -26,4 +26,9 @@
maximum (let them grow as large as the screen). Actual values are
specified for -large and -xlarge configurations. -->
<dimen name="abc_config_prefDialogWidth">320dp</dimen>
+
+ <!-- Whether action menu items should be displayed in ALLCAPS or not.
+ Defaults to true. If this is not appropriate for specific locales
+ it should be disabled in that locale's resources. -->
+ <bool name="abc_config_actionMenuItemAllCaps">true</bool>
</resources>
\ No newline at end of file
diff --git a/v7/appcompat/res/values/dimens.xml b/v7/appcompat/res/values/dimens.xml
index f12b0fc..f58d6fa 100644
--- a/v7/appcompat/res/values/dimens.xml
+++ b/v7/appcompat/res/values/dimens.xml
@@ -15,10 +15,6 @@
-->
<resources>
- <dimen name="abc_action_bar_size">48dp</dimen>
-
- <!-- Maximum height for a stacked tab bar as part of an action bar -->
- <dimen name="abc_action_bar_stacked_max_height">48dp</dimen>
<!-- The maximum number of action buttons that should be permitted within
an action bar/action mode. This will be used to determine how many
@@ -44,6 +40,8 @@
<dimen name="abc_action_bar_subtitle_bottom_margin">5dip</dimen>
<!-- Minimum width for an action button in the menu area of an action bar -->
<dimen name="abc_action_button_min_width">56dip</dimen>
+ <!-- Maximum height for a stacked tab bar as part of an action bar -->
+ <dimen name="abc_action_bar_stacked_max_height">48dp</dimen>
<dimen name="abc_panel_menu_list_width">296dp</dimen>
diff --git a/v7/appcompat/res/values/styles_base.xml b/v7/appcompat/res/values/styles_base.xml
index 89d2cd7..28d2086 100644
--- a/v7/appcompat/res/values/styles_base.xml
+++ b/v7/appcompat/res/values/styles_base.xml
@@ -89,6 +89,7 @@
<item name="android:minHeight">?attr/actionBarSize</item>
<item name="android:gravity">center</item>
<item name="android:maxLines">2</item>
+ <item name="textAllCaps">@bool/abc_config_actionMenuItemAllCaps</item>
</style>
<style name="Widget.AppCompat.Light.Base.ActionButton"
@@ -149,6 +150,7 @@
<item name="android:textStyle">bold</item>
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
+ <item name="textAllCaps">true</item>
</style>
<style name="Widget.AppCompat.Light.Base.ActionBar.TabText"
diff --git a/v7/appcompat/res/values/themes_base.xml b/v7/appcompat/res/values/themes_base.xml
index 33235a8..3b514a8 100644
--- a/v7/appcompat/res/values/themes_base.xml
+++ b/v7/appcompat/res/values/themes_base.xml
@@ -24,8 +24,14 @@
directly by apps. -->
<eat-comment/>
+ <style name="Theme.Base" parent="android:Theme">
+ </style>
+
+ <style name="Theme.Base.Light" parent="android:Theme.Light">
+ </style>
+
<!-- Base platform-dependent theme providing an action bar in a dark-themed activity. -->
- <style name="Theme.Base.AppCompat" parent="android:Theme">
+ <style name="Theme.Base.AppCompat" parent="Theme.Base">
<item name="windowActionBar">true</item>
<!-- Remove system title bars; we will add the action bar ourselves. -->
<item name="android:windowNoTitle">true</item>
@@ -55,7 +61,7 @@
<item name="actionBarStyle">@style/Widget.AppCompat.ActionBar</item>
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionBarWidgetTheme">@null</item>
- <item name="actionBarSize">@dimen/abc_action_bar_size</item>
+ <item name="actionBarSize">@dimen/abc_action_bar_default_height</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">?attr/selectableItemBackground</item>
<item name="actionMenuTextAppearance">
@@ -83,7 +89,7 @@
</style>
<!-- Base platform-dependent theme providing an action bar in a light-themed activity. -->
- <style name="Theme.Base.AppCompat.Light" parent="android:Theme.Light">
+ <style name="Theme.Base.AppCompat.Light" parent="Theme.Base.Light">
<item name="windowActionBar">true</item>
<!-- Remove system title bars; we will add the action bar ourselves. -->
<item name="android:windowNoTitle">true</item>
@@ -116,7 +122,7 @@
<item name="actionBarStyle">@style/Widget.AppCompat.Light.ActionBar</item>
<item name="actionBarSplitStyle">?attr/actionBarStyle</item>
<item name="actionBarWidgetTheme">@null</item>
- <item name="actionBarSize">@dimen/abc_action_bar_size</item>
+ <item name="actionBarSize">@dimen/abc_action_bar_default_height</item>
<item name="actionBarDivider">?attr/dividerVertical</item>
<item name="actionBarItemBackground">?attr/selectableItemBackground</item>
<item name="actionMenuTextAppearance">
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarActivity.java b/v7/appcompat/src/android/support/v7/app/ActionBarActivity.java
index 3239626..504ef06 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBarActivity.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBarActivity.java
@@ -152,8 +152,8 @@
@Override
public void supportInvalidateOptionsMenu() {
- // Only call up to super on HC+
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ // Only call up to super on ICS+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
super.supportInvalidateOptionsMenu();
}
mImpl.supportInvalidateOptionsMenu();
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegate.java b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegate.java
index c46f698..bfc74f9 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegate.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegate.java
@@ -45,10 +45,6 @@
final int version = Build.VERSION.SDK_INT;
if (version >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new ActionBarActivityDelegateICS(activity);
- } else if (version >= Build.VERSION_CODES.HONEYCOMB_MR1) {
- return new ActionBarActivityDelegateHCMR1(activity);
- } else if (version >= Build.VERSION_CODES.HONEYCOMB) {
- return new ActionBarActivityDelegateHC(activity);
} else {
return new ActionBarActivityDelegateBase(activity);
}
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHC.java b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHC.java
deleted file mode 100644
index 7540cc4..0000000
--- a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHC.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-package android.support.v7.app;
-
-import android.content.Context;
-import android.content.res.Configuration;
-import android.os.Bundle;
-import android.support.v4.app.ActionBarDrawerToggle;
-import android.support.v4.view.WindowCompat;
-import android.support.v7.internal.view.ActionModeWrapper;
-import android.support.v7.internal.view.menu.MenuWrapperFactory;
-import android.support.v7.view.ActionMode;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.view.accessibility.AccessibilityEvent;
-
-class ActionBarActivityDelegateHC extends ActionBarActivityDelegate {
- Menu mMenu;
-
- ActionBarActivityDelegateHC(ActionBarActivity activity) {
- super(activity);
- }
-
- @Override
- public ActionBar createSupportActionBar() {
- return new ActionBarImplHC(mActivity, mActivity);
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if (mHasActionBar) {
- // If action bar is requested by inheriting from the appcompat theme,
- // the system will not know about that. So explicitly request for an action bar.
- mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
- }
- if (mOverlayActionBar) {
- mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
- }
-
- /*
- * This goofy move needs some explanation.
- *
- * The verifier on older platform versions has some interesting side effects if
- * a class defines a method that takes a parameter of a type that doesn't exist.
- * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
- * cannot override the onActionModeStarted/Finished methods without causing nastiness
- * when it is loaded on older platform versions.
- *
- * Since these methods are actually part of the window callback and not intrinsic to
- * Activity itself, we can install a little shim with the window instead that knows
- * about the ActionMode class. Note that this means that any new methods added to
- * Window.Callback in the future won't get proxied without updating the support lib,
- * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
- */
- final Window w = mActivity.getWindow();
- w.setCallback(createWindowCallbackWrapper(w.getCallback()));
- }
-
- Window.Callback createWindowCallbackWrapper(Window.Callback cb) {
- return new WindowCallbackWrapper(cb);
- }
-
- @Override
- public void onConfigurationChanged(Configuration newConfig) {
- }
-
- @Override
- public void onStop() {
- }
-
- @Override
- public void onPostResume() {
- }
-
- @Override
- public void setContentView(View v) {
- mActivity.superSetContentView(v);
- }
-
- @Override
- public void setContentView(int resId) {
- mActivity.superSetContentView(resId);
- }
-
- @Override
- public void setContentView(View v, ViewGroup.LayoutParams lp) {
- mActivity.superSetContentView(v, lp);
- }
-
- @Override
- public void addContentView(View v, ViewGroup.LayoutParams lp) {
- mActivity.superAddContentView(v, lp);
- }
-
- @Override
- public boolean supportRequestWindowFeature(int featureId) {
- return mActivity.requestWindowFeature(featureId);
- }
-
- @Override
- public View onCreatePanelView(int featureId) {
- // Do not create custom options menu on HC+
- return null;
- }
-
- @Override
- public boolean onCreatePanelMenu(int featureId, Menu menu) {
- if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
- if (mMenu == null) {
- mMenu = MenuWrapperFactory.createMenuWrapper(menu);
- }
- return mActivity.superOnCreatePanelMenu(featureId, mMenu);
- }
- return mActivity.superOnCreatePanelMenu(featureId, menu);
- }
-
- @Override
- public boolean onPreparePanel(int featureId, View view, Menu menu) {
- if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
- return mActivity.superOnPreparePanel(featureId, view, mMenu);
- }
- return mActivity.superOnPreparePanel(featureId, view, menu);
- }
-
- @Override
- public boolean onMenuItemSelected(int featureId, MenuItem item) {
- if (featureId == Window.FEATURE_OPTIONS_PANEL) {
- item = MenuWrapperFactory.createMenuItemWrapper(item);
- }
- return mActivity.superOnMenuItemSelected(featureId, item);
- }
-
- @Override
- public void setTitle(CharSequence title) {
- // Handled by framework
- }
-
- @Override
- public ActionMode startSupportActionMode(ActionMode.Callback callback) {
- if (callback == null) {
- throw new IllegalArgumentException("ActionMode callback can not be null.");
- }
-
- Context context = getActionBarThemedContext();
-
- ActionModeWrapper.CallbackWrapper wrappedCallback = new ActionModeWrapper.CallbackWrapper(
- context, callback);
- ActionModeWrapper wrappedMode = null;
-
- android.view.ActionMode frameworkMode = mActivity.startActionMode(wrappedCallback);
-
- if (frameworkMode != null) {
- wrappedMode = new ActionModeWrapper(context,
- mActivity.startActionMode(wrappedCallback));
- wrappedCallback.setLastStartedActionMode(wrappedMode);
- }
-
- return wrappedMode;
- }
-
- public void onActionModeStarted(android.view.ActionMode mode) {
- mActivity.onSupportActionModeStarted(
- new ActionModeWrapper(getActionBarThemedContext(), mode));
- }
-
- @Override
- void setSupportProgressBarVisibility(boolean visible) {
- mActivity.setProgressBarVisibility(visible);
- }
-
- @Override
- void setSupportProgressBarIndeterminateVisibility(boolean visible) {
- mActivity.setProgressBarIndeterminateVisibility(visible);
- }
-
- @Override
- void setSupportProgressBarIndeterminate(boolean indeterminate) {
- mActivity.setProgressBarIndeterminate(indeterminate);
- }
-
- @Override
- void setSupportProgress(int progress) {
- mActivity.setProgress(progress);
- }
-
- public void onActionModeFinished(android.view.ActionMode mode) {
- mActivity.onSupportActionModeFinished(
- new ActionModeWrapper(getActionBarThemedContext(), mode));
- }
-
- @Override
- public void supportInvalidateOptionsMenu() {
- mMenu = null;
- }
-
- @Override
- public boolean onBackPressed() {
- return false;
- }
-
- @Override
- public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
- // Return null so that ActionBarDrawableToggle uses it's standard impl
- return null;
- }
-
- class WindowCallbackWrapper implements Window.Callback {
- final Window.Callback mWrapped;
-
- public WindowCallbackWrapper(Window.Callback wrapped) {
- mWrapped = wrapped;
- }
-
- @Override
- public boolean dispatchKeyEvent(KeyEvent event) {
- return mWrapped.dispatchKeyEvent(event);
- }
-
- @Override
- public boolean dispatchKeyShortcutEvent(KeyEvent event) {
- return mWrapped.dispatchKeyShortcutEvent(event);
- }
-
- @Override
- public boolean dispatchTouchEvent(MotionEvent event) {
- return mWrapped.dispatchTouchEvent(event);
- }
-
- @Override
- public boolean dispatchTrackballEvent(MotionEvent event) {
- return mWrapped.dispatchTrackballEvent(event);
- }
-
- public boolean dispatchGenericMotionEvent(MotionEvent event) {
- // This method didn't exist until API 12. Overridden elsewhere.
- return false;
- }
-
- @Override
- public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
- return mWrapped.dispatchPopulateAccessibilityEvent(event);
- }
-
- @Override
- public View onCreatePanelView(int featureId) {
- return mWrapped.onCreatePanelView(featureId);
- }
-
- @Override
- public boolean onCreatePanelMenu(int featureId, Menu menu) {
- return mWrapped.onCreatePanelMenu(featureId, menu);
- }
-
- @Override
- public boolean onPreparePanel(int featureId, View view, Menu menu) {
- return mWrapped.onPreparePanel(featureId, view, menu);
- }
-
- @Override
- public boolean onMenuOpened(int featureId, Menu menu) {
- return mWrapped.onMenuOpened(featureId, menu);
- }
-
- @Override
- public boolean onMenuItemSelected(int featureId, MenuItem item) {
- return mWrapped.onMenuItemSelected(featureId, item);
- }
-
- @Override
- public void onWindowAttributesChanged(WindowManager.LayoutParams attrs) {
- mWrapped.onWindowAttributesChanged(attrs);
- }
-
- @Override
- public void onContentChanged() {
- mWrapped.onContentChanged();
- }
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- mWrapped.onWindowFocusChanged(hasFocus);
- }
-
- @Override
- public void onAttachedToWindow() {
- mWrapped.onAttachedToWindow();
- }
-
- @Override
- public void onDetachedFromWindow() {
- mWrapped.onDetachedFromWindow();
- }
-
- @Override
- public void onPanelClosed(int featureId, Menu menu) {
- mWrapped.onPanelClosed(featureId, menu);
- }
-
- @Override
- public boolean onSearchRequested() {
- return mWrapped.onSearchRequested();
- }
-
- @Override
- public android.view.ActionMode onWindowStartingActionMode(
- android.view.ActionMode.Callback callback) {
- return mWrapped.onWindowStartingActionMode(callback);
- }
-
- /*
- * And here are the money methods, the reason why this wrapper exists:
- */
-
- @Override
- public void onActionModeStarted(android.view.ActionMode mode) {
- mWrapped.onActionModeStarted(mode);
- ActionBarActivityDelegateHC.this.onActionModeStarted(mode);
- }
-
- @Override
- public void onActionModeFinished(android.view.ActionMode mode) {
- mWrapped.onActionModeFinished(mode);
- ActionBarActivityDelegateHC.this.onActionModeFinished(mode);
- }
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHCMR1.java b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHCMR1.java
deleted file mode 100644
index 00cf91a..0000000
--- a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateHCMR1.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-
-package android.support.v7.app;
-
-import android.view.MotionEvent;
-import android.view.Window;
-
-class ActionBarActivityDelegateHCMR1 extends ActionBarActivityDelegateHC {
-
- ActionBarActivityDelegateHCMR1(ActionBarActivity activity) {
- super(activity);
- }
-
- @Override
- Window.Callback createWindowCallbackWrapper(Window.Callback cb) {
- return new WindowCallbackWrapperHCMR1(cb);
- }
-
- class WindowCallbackWrapperHCMR1 extends WindowCallbackWrapper {
-
- public WindowCallbackWrapperHCMR1(Window.Callback wrapped) {
- super(wrapped);
- }
-
- /*
- * This method didn't exist before HC-MR1 so we have this new version here.
- */
- @Override
- public boolean dispatchGenericMotionEvent(MotionEvent event) {
- return mWrapped.dispatchGenericMotionEvent(event);
- }
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateICS.java b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateICS.java
index 42fd1a0..b4fb03e 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateICS.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBarActivityDelegateICS.java
@@ -16,16 +16,38 @@
package android.support.v7.app;
+import android.content.Context;
import android.content.pm.ActivityInfo;
+import android.content.res.Configuration;
import android.os.Bundle;
+import android.support.v4.app.ActionBarDrawerToggle;
+import android.support.v4.view.WindowCompat;
+import android.support.v7.internal.view.ActionModeWrapper;
+import android.support.v7.internal.view.menu.MenuWrapperFactory;
+import android.support.v7.view.ActionMode;
+import android.view.KeyEvent;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.view.accessibility.AccessibilityEvent;
-class ActionBarActivityDelegateICS extends ActionBarActivityDelegateHCMR1 {
+class ActionBarActivityDelegateICS extends ActionBarActivityDelegate {
+ Menu mMenu;
ActionBarActivityDelegateICS(ActionBarActivity activity) {
super(activity);
}
@Override
+ public ActionBar createSupportActionBar() {
+ return new ActionBarImplICS(mActivity, mActivity);
+ }
+
+ @Override
public void onCreate(Bundle savedInstanceState) {
// Set framework uiOptions from the support metadata value
if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
@@ -34,11 +56,300 @@
}
super.onCreate(savedInstanceState);
+
+ if (mHasActionBar) {
+ // If action bar is requested by inheriting from the appcompat theme,
+ // the system will not know about that. So explicitly request for an action bar.
+ mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
+ }
+ if (mOverlayActionBar) {
+ mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
+ }
+
+ /*
+ * This goofy move needs some explanation.
+ *
+ * The verifier on older platform versions has some interesting side effects if
+ * a class defines a method that takes a parameter of a type that doesn't exist.
+ * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
+ * cannot override the onActionModeStarted/Finished methods without causing nastiness
+ * when it is loaded on older platform versions.
+ *
+ * Since these methods are actually part of the window callback and not intrinsic to
+ * Activity itself, we can install a little shim with the window instead that knows
+ * about the ActionMode class. Note that this means that any new methods added to
+ * Window.Callback in the future won't get proxied without updating the support lib,
+ * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
+ */
+ final Window w = mActivity.getWindow();
+ w.setCallback(createWindowCallbackWrapper(w.getCallback()));
+ }
+
+ Window.Callback createWindowCallbackWrapper(Window.Callback cb) {
+ return new WindowCallbackWrapper(cb);
}
@Override
- public ActionBar createSupportActionBar() {
- return new ActionBarImplICS(mActivity, mActivity);
+ public void onConfigurationChanged(Configuration newConfig) {
}
+ @Override
+ public void onStop() {
+ }
+
+ @Override
+ public void onPostResume() {
+ }
+
+ @Override
+ public void setContentView(View v) {
+ mActivity.superSetContentView(v);
+ }
+
+ @Override
+ public void setContentView(int resId) {
+ mActivity.superSetContentView(resId);
+ }
+
+ @Override
+ public void setContentView(View v, ViewGroup.LayoutParams lp) {
+ mActivity.superSetContentView(v, lp);
+ }
+
+ @Override
+ public void addContentView(View v, ViewGroup.LayoutParams lp) {
+ mActivity.superAddContentView(v, lp);
+ }
+
+ @Override
+ public boolean supportRequestWindowFeature(int featureId) {
+ return mActivity.requestWindowFeature(featureId);
+ }
+
+ @Override
+ public View onCreatePanelView(int featureId) {
+ // Do not create custom options menu on HC+
+ return null;
+ }
+
+ @Override
+ public boolean onCreatePanelMenu(int featureId, Menu menu) {
+ if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
+ if (mMenu == null) {
+ mMenu = MenuWrapperFactory.createMenuWrapper(menu);
+ }
+ return mActivity.superOnCreatePanelMenu(featureId, mMenu);
+ }
+ return mActivity.superOnCreatePanelMenu(featureId, menu);
+ }
+
+ @Override
+ public boolean onPreparePanel(int featureId, View view, Menu menu) {
+ if (featureId == Window.FEATURE_OPTIONS_PANEL || featureId == Window.FEATURE_ACTION_BAR) {
+ return mActivity.superOnPreparePanel(featureId, view, mMenu);
+ }
+ return mActivity.superOnPreparePanel(featureId, view, menu);
+ }
+
+ @Override
+ public boolean onMenuItemSelected(int featureId, MenuItem item) {
+ if (featureId == Window.FEATURE_OPTIONS_PANEL) {
+ item = MenuWrapperFactory.createMenuItemWrapper(item);
+ }
+ return mActivity.superOnMenuItemSelected(featureId, item);
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ // Handled by framework
+ }
+
+ @Override
+ public ActionMode startSupportActionMode(ActionMode.Callback callback) {
+ if (callback == null) {
+ throw new IllegalArgumentException("ActionMode callback can not be null.");
+ }
+
+ Context context = getActionBarThemedContext();
+
+ ActionModeWrapper.CallbackWrapper wrappedCallback = new ActionModeWrapper.CallbackWrapper(
+ context, callback);
+ ActionModeWrapper wrappedMode = null;
+
+ android.view.ActionMode frameworkMode = mActivity.startActionMode(wrappedCallback);
+
+ if (frameworkMode != null) {
+ wrappedMode = new ActionModeWrapper(context,
+ mActivity.startActionMode(wrappedCallback));
+ wrappedCallback.setLastStartedActionMode(wrappedMode);
+ }
+
+ return wrappedMode;
+ }
+
+ public void onActionModeStarted(android.view.ActionMode mode) {
+ mActivity.onSupportActionModeStarted(
+ new ActionModeWrapper(getActionBarThemedContext(), mode));
+ }
+
+ @Override
+ void setSupportProgressBarVisibility(boolean visible) {
+ mActivity.setProgressBarVisibility(visible);
+ }
+
+ @Override
+ void setSupportProgressBarIndeterminateVisibility(boolean visible) {
+ mActivity.setProgressBarIndeterminateVisibility(visible);
+ }
+
+ @Override
+ void setSupportProgressBarIndeterminate(boolean indeterminate) {
+ mActivity.setProgressBarIndeterminate(indeterminate);
+ }
+
+ @Override
+ void setSupportProgress(int progress) {
+ mActivity.setProgress(progress);
+ }
+
+ public void onActionModeFinished(android.view.ActionMode mode) {
+ mActivity.onSupportActionModeFinished(
+ new ActionModeWrapper(getActionBarThemedContext(), mode));
+ }
+
+ @Override
+ public void supportInvalidateOptionsMenu() {
+ mMenu = null;
+ }
+
+ @Override
+ public boolean onBackPressed() {
+ return false;
+ }
+
+ @Override
+ public ActionBarDrawerToggle.Delegate getDrawerToggleDelegate() {
+ // Return null so that ActionBarDrawableToggle uses it's standard impl
+ return null;
+ }
+
+ class WindowCallbackWrapper implements Window.Callback {
+ final Window.Callback mWrapped;
+
+ public WindowCallbackWrapper(Window.Callback wrapped) {
+ mWrapped = wrapped;
+ }
+
+ @Override
+ public boolean dispatchKeyEvent(KeyEvent event) {
+ return mWrapped.dispatchKeyEvent(event);
+ }
+
+ @Override
+ public boolean dispatchKeyShortcutEvent(KeyEvent event) {
+ return mWrapped.dispatchKeyShortcutEvent(event);
+ }
+
+ @Override
+ public boolean dispatchTouchEvent(MotionEvent event) {
+ return mWrapped.dispatchTouchEvent(event);
+ }
+
+ @Override
+ public boolean dispatchTrackballEvent(MotionEvent event) {
+ return mWrapped.dispatchTrackballEvent(event);
+ }
+
+ @Override
+ public boolean dispatchGenericMotionEvent(MotionEvent event) {
+ return mWrapped.dispatchGenericMotionEvent(event);
+ }
+
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+ return mWrapped.dispatchPopulateAccessibilityEvent(event);
+ }
+
+ @Override
+ public View onCreatePanelView(int featureId) {
+ return mWrapped.onCreatePanelView(featureId);
+ }
+
+ @Override
+ public boolean onCreatePanelMenu(int featureId, Menu menu) {
+ return mWrapped.onCreatePanelMenu(featureId, menu);
+ }
+
+ @Override
+ public boolean onPreparePanel(int featureId, View view, Menu menu) {
+ return mWrapped.onPreparePanel(featureId, view, menu);
+ }
+
+ @Override
+ public boolean onMenuOpened(int featureId, Menu menu) {
+ return mWrapped.onMenuOpened(featureId, menu);
+ }
+
+ @Override
+ public boolean onMenuItemSelected(int featureId, MenuItem item) {
+ return mWrapped.onMenuItemSelected(featureId, item);
+ }
+
+ @Override
+ public void onWindowAttributesChanged(WindowManager.LayoutParams attrs) {
+ mWrapped.onWindowAttributesChanged(attrs);
+ }
+
+ @Override
+ public void onContentChanged() {
+ mWrapped.onContentChanged();
+ }
+
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ mWrapped.onWindowFocusChanged(hasFocus);
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ mWrapped.onAttachedToWindow();
+ }
+
+ @Override
+ public void onDetachedFromWindow() {
+ mWrapped.onDetachedFromWindow();
+ }
+
+ @Override
+ public void onPanelClosed(int featureId, Menu menu) {
+ mWrapped.onPanelClosed(featureId, menu);
+ }
+
+ @Override
+ public boolean onSearchRequested() {
+ return mWrapped.onSearchRequested();
+ }
+
+ @Override
+ public android.view.ActionMode onWindowStartingActionMode(
+ android.view.ActionMode.Callback callback) {
+ return mWrapped.onWindowStartingActionMode(callback);
+ }
+
+ /*
+ * And here are the money methods, the reason why this wrapper exists:
+ */
+
+ @Override
+ public void onActionModeStarted(android.view.ActionMode mode) {
+ mWrapped.onActionModeStarted(mode);
+ ActionBarActivityDelegateICS.this.onActionModeStarted(mode);
+ }
+
+ @Override
+ public void onActionModeFinished(android.view.ActionMode mode) {
+ mWrapped.onActionModeFinished(mode);
+ ActionBarActivityDelegateICS.this.onActionModeFinished(mode);
+ }
+ }
}
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarImplBase.java b/v7/appcompat/src/android/support/v7/app/ActionBarImplBase.java
index e210559..75d1b7c 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBarImplBase.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBarImplBase.java
@@ -192,7 +192,6 @@
public void setCustomView(int resId) {
setCustomView(LayoutInflater.from(getThemedContext())
.inflate(resId, mActionView, false));
-
}
@Override
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarImplHC.java b/v7/appcompat/src/android/support/v7/app/ActionBarImplHC.java
deleted file mode 100644
index fefb9c0..0000000
--- a/v7/appcompat/src/android/support/v7/app/ActionBarImplHC.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-package android.support.v7.app;
-
-import android.app.Activity;
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.support.v4.app.FragmentTransaction;
-import android.util.Log;
-import android.view.View;
-import android.widget.SpinnerAdapter;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-
-class ActionBarImplHC extends ActionBar {
-
- final Activity mActivity;
- final Callback mCallback;
- final android.app.ActionBar mActionBar;
-
- private ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>> mAddedMenuVisWrappers =
- new ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>>();
-
- public ActionBarImplHC(Activity activity, Callback callback) {
- mActivity = activity;
- mCallback = callback;
- mActionBar = activity.getActionBar();
- }
-
- private OnMenuVisibilityListenerWrapper findAndRemoveMenuVisWrapper(
- OnMenuVisibilityListener compatListener) {
- for (int i = 0; i < mAddedMenuVisWrappers.size(); i++) {
- OnMenuVisibilityListenerWrapper wrapper = mAddedMenuVisWrappers.get(i).get();
- if (wrapper == null) {
- mAddedMenuVisWrappers.remove(i--);
- } else if (wrapper.mWrappedListener == compatListener) {
- mAddedMenuVisWrappers.remove(i);
- return wrapper;
- }
- }
- return null;
- }
-
- @Override
- public void setCustomView(View view) {
- mActionBar.setCustomView(view);
- }
-
- @Override
- public void setCustomView(View view, LayoutParams layoutParams) {
- android.app.ActionBar.LayoutParams lp =
- new android.app.ActionBar.LayoutParams(layoutParams);
- lp.gravity = layoutParams.gravity;
-
- mActionBar.setCustomView(view, lp);
- }
-
- @Override
- public void setCustomView(int resId) {
- mActionBar.setCustomView(resId);
- }
-
- @Override
- public void setIcon(int resId) {
- Log.i("ActionBarCompat", "setIcon() is not available when running on Honeycomb devices.");
- }
-
- @Override
- public void setIcon(Drawable icon) {
- Log.i("ActionBarCompat", "setIcon() is not available when running on Honeycomb devices.");
- }
-
- @Override
- public void setLogo(int resId) {
- Log.i("ActionBarCompat", "setLogo() is not available when running on Honeycomb devices.");
- }
-
- @Override
- public void setLogo(Drawable logo) {
- Log.i("ActionBarCompat", "setLogo() is not available when running on Honeycomb devices.");
- }
-
- @Override
- public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
- mActionBar.setListNavigationCallbacks(adapter,
- callback != null ? new OnNavigationListenerWrapper(callback) : null);
- }
-
- @Override
- public void setSelectedNavigationItem(int position) {
- mActionBar.setSelectedNavigationItem(position);
- }
-
- @Override
- public int getSelectedNavigationIndex() {
- return mActionBar.getSelectedNavigationIndex();
- }
-
- @Override
- public int getNavigationItemCount() {
- return mActionBar.getNavigationItemCount();
- }
-
- @Override
- public void setTitle(CharSequence title) {
- mActionBar.setTitle(title);
- }
-
- @Override
- public void setTitle(int resId) {
- mActionBar.setTitle(resId);
- }
-
- @Override
- public void setSubtitle(CharSequence subtitle) {
- mActionBar.setSubtitle(subtitle);
- }
-
- @Override
- public void setSubtitle(int resId) {
- mActionBar.setSubtitle(resId);
- }
-
- @Override
- public void setDisplayOptions(int options) {
- mActionBar.setDisplayOptions(options);
- }
-
- @Override
- public void setDisplayOptions(int options, int mask) {
- mActionBar.setDisplayOptions(options, mask);
- }
-
- @Override
- public void setDisplayUseLogoEnabled(boolean useLogo) {
- mActionBar.setDisplayUseLogoEnabled(useLogo);
- }
-
- @Override
- public void setDisplayShowHomeEnabled(boolean showHome) {
- mActionBar.setDisplayShowHomeEnabled(showHome);
- }
-
- @Override
- public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
- mActionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);
- }
-
- @Override
- public void setDisplayShowTitleEnabled(boolean showTitle) {
- mActionBar.setDisplayShowTitleEnabled(showTitle);
- }
-
- @Override
- public void setDisplayShowCustomEnabled(boolean showCustom) {
- mActionBar.setDisplayShowCustomEnabled(showCustom);
- }
-
- @Override
- public void setBackgroundDrawable(Drawable d) {
- mActionBar.setBackgroundDrawable(d);
- }
-
- @Override
- public View getCustomView() {
- return mActionBar.getCustomView();
- }
-
- @Override
- public CharSequence getTitle() {
- return mActionBar.getTitle();
- }
-
- @Override
- public CharSequence getSubtitle() {
- return mActionBar.getSubtitle();
- }
-
- @Override
- public int getNavigationMode() {
- return mActionBar.getNavigationMode();
- }
-
- @Override
- public void setNavigationMode(int mode) {
- mActionBar.setNavigationMode(mode);
- }
-
- @Override
- public int getDisplayOptions() {
- return mActionBar.getDisplayOptions();
- }
-
- @Override
- public Tab newTab() {
- final android.app.ActionBar.Tab realTab = mActionBar.newTab();
- final TabWrapper result = new TabWrapper(realTab);
- realTab.setTag(result);
- return result;
- }
-
- @Override
- public void addTab(Tab tab) {
- mActionBar.addTab(((TabWrapper) tab).mWrappedTab);
- }
-
- @Override
- public void addTab(Tab tab, boolean setSelected) {
- mActionBar.addTab(((TabWrapper) tab).mWrappedTab, setSelected);
- }
-
- @Override
- public void addTab(Tab tab, int position) {
- mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position);
- }
-
- @Override
- public void addTab(Tab tab, int position, boolean setSelected) {
- mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position, setSelected);
- }
-
- @Override
- public void removeTab(Tab tab) {
- mActionBar.removeTab(((TabWrapper) tab).mWrappedTab);
- }
-
- @Override
- public void removeTabAt(int position) {
- mActionBar.removeTabAt(position);
- }
-
- @Override
- public void removeAllTabs() {
- mActionBar.removeAllTabs();
- }
-
- @Override
- public void selectTab(Tab tab) {
- mActionBar.selectTab(((TabWrapper) tab).mWrappedTab);
- }
-
- @Override
- public Tab getSelectedTab() {
- return (Tab) mActionBar.getSelectedTab().getTag();
- }
-
- @Override
- public Tab getTabAt(int index) {
- return (Tab) mActionBar.getTabAt(index).getTag();
- }
-
- @Override
- public int getTabCount() {
- return mActionBar.getTabCount();
- }
-
- @Override
- public Context getThemedContext() {
- // v11 doesn't have the actionBarWidgetTheme attr, so just use the Activity
- // This means DarkActionBar theme does not work on v11.
- return mActivity;
- }
-
- @Override
- public int getHeight() {
- return mActionBar.getHeight();
- }
-
- @Override
- public void show() {
- mActionBar.show();
- }
-
- @Override
- public void hide() {
- mActionBar.hide();
- }
-
- @Override
- public boolean isShowing() {
- return mActionBar.isShowing();
- }
-
- @Override
- public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
- if (listener != null) {
- OnMenuVisibilityListenerWrapper w = new OnMenuVisibilityListenerWrapper(listener);
- mAddedMenuVisWrappers.add(new WeakReference<OnMenuVisibilityListenerWrapper>(w));
- mActionBar.addOnMenuVisibilityListener(w);
- }
- }
-
- @Override
- public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
- OnMenuVisibilityListenerWrapper l = findAndRemoveMenuVisWrapper(listener);
- mActionBar.removeOnMenuVisibilityListener(l);
- }
-
- static class OnNavigationListenerWrapper implements android.app.ActionBar.OnNavigationListener {
-
- private final OnNavigationListener mWrappedListener;
-
- public OnNavigationListenerWrapper(OnNavigationListener l) {
- mWrappedListener = l;
- }
-
- @Override
- public boolean onNavigationItemSelected(int itemPosition, long itemId) {
- return mWrappedListener.onNavigationItemSelected(itemPosition, itemId);
- }
-
- }
-
- static class OnMenuVisibilityListenerWrapper implements
- android.app.ActionBar.OnMenuVisibilityListener {
-
- final OnMenuVisibilityListener mWrappedListener;
-
- public OnMenuVisibilityListenerWrapper(OnMenuVisibilityListener l) {
- mWrappedListener = l;
- }
-
- @Override
- public void onMenuVisibilityChanged(boolean isVisible) {
- mWrappedListener.onMenuVisibilityChanged(isVisible);
- }
-
- }
-
- class TabWrapper extends ActionBar.Tab implements android.app.ActionBar.TabListener {
-
- final android.app.ActionBar.Tab mWrappedTab;
- private Object mTag;
- private FragmentTransaction mActiveTransaction;
- private CharSequence mContentDescription;
- private TabListener mTabListener;
-
- public TabWrapper(android.app.ActionBar.Tab tab) {
- mWrappedTab = tab;
- }
-
- @Override
- public int getPosition() {
- return mWrappedTab.getPosition();
- }
-
- @Override
- public Drawable getIcon() {
- return mWrappedTab.getIcon();
- }
-
- @Override
- public CharSequence getText() {
- return mWrappedTab.getText();
- }
-
- @Override
- public Tab setIcon(Drawable icon) {
- mWrappedTab.setIcon(icon);
- return this;
- }
-
- @Override
- public Tab setIcon(int resId) {
- mWrappedTab.setIcon(resId);
- return this;
- }
-
- @Override
- public Tab setText(CharSequence text) {
- mWrappedTab.setText(text);
- return this;
- }
-
- @Override
- public Tab setText(int resId) {
- mWrappedTab.setText(resId);
- return this;
- }
-
- @Override
- public Tab setCustomView(View view) {
- mWrappedTab.setCustomView(view);
- return this;
- }
-
- @Override
- public Tab setCustomView(int layoutResId) {
- mWrappedTab.setCustomView(layoutResId);
- return this;
- }
-
- @Override
- public View getCustomView() {
- return mWrappedTab.getCustomView();
- }
-
- @Override
- public Tab setTag(Object obj) {
- mTag = obj;
- return this;
- }
-
- @Override
- public Object getTag() {
- return mTag;
- }
-
- @Override
- public Tab setTabListener(TabListener listener) {
- mTabListener = listener;
- mWrappedTab.setTabListener(listener != null ? this : null);
- return this;
- }
-
- @Override
- public void select() {
- mWrappedTab.select();
- }
-
- @Override
- public Tab setContentDescription(int resId) {
- mContentDescription = mActivity.getText(resId);
- return this;
- }
-
- @Override
- public Tab setContentDescription(CharSequence contentDesc) {
- mContentDescription = contentDesc;
- return this;
- }
-
- @Override
- public CharSequence getContentDescription() {
- return mContentDescription;
- }
-
- @Override
- public void onTabSelected(android.app.ActionBar.Tab tab,
- android.app.FragmentTransaction ft) {
- mTabListener.onTabSelected(this, ft != null ? getActiveTransaction() : null);
- commitActiveTransaction();
- }
-
- @Override
- public void onTabUnselected(android.app.ActionBar.Tab tab,
- android.app.FragmentTransaction ft) {
- mTabListener.onTabUnselected(this, ft != null ? getActiveTransaction() : null);
- }
-
- @Override
- public void onTabReselected(android.app.ActionBar.Tab tab,
- android.app.FragmentTransaction ft) {
- mTabListener.onTabReselected(this, ft != null ? getActiveTransaction() : null);
- commitActiveTransaction();
- }
-
- private FragmentTransaction getActiveTransaction() {
- if (mActiveTransaction == null) {
- mActiveTransaction = mCallback.getSupportFragmentManager().beginTransaction()
- .disallowAddToBackStack();
- }
- return mActiveTransaction;
- }
-
- private void commitActiveTransaction() {
- if (mActiveTransaction != null && !mActiveTransaction.isEmpty()) {
- mActiveTransaction.commit();
- }
- mActiveTransaction = null;
- }
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/app/ActionBarImplICS.java b/v7/appcompat/src/android/support/v7/app/ActionBarImplICS.java
index d2e3f6f..b10b8c8 100644
--- a/v7/appcompat/src/android/support/v7/app/ActionBarImplICS.java
+++ b/v7/appcompat/src/android/support/v7/app/ActionBarImplICS.java
@@ -19,16 +19,60 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
+import android.support.v4.app.FragmentTransaction;
+import android.util.Log;
+import android.view.View;
+import android.widget.SpinnerAdapter;
-class ActionBarImplICS extends ActionBarImplHC {
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+
+class ActionBarImplICS extends ActionBar {
+
+ final Activity mActivity;
+ final Callback mCallback;
+ final android.app.ActionBar mActionBar;
+
+ private ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>> mAddedMenuVisWrappers =
+ new ArrayList<WeakReference<OnMenuVisibilityListenerWrapper>>();
public ActionBarImplICS(Activity activity, Callback callback) {
- super(activity, callback);
+ mActivity = activity;
+ mCallback = callback;
+ mActionBar = activity.getActionBar();
+ }
+
+ private OnMenuVisibilityListenerWrapper findAndRemoveMenuVisWrapper(
+ OnMenuVisibilityListener compatListener) {
+ for (int i = 0; i < mAddedMenuVisWrappers.size(); i++) {
+ OnMenuVisibilityListenerWrapper wrapper = mAddedMenuVisWrappers.get(i).get();
+ if (wrapper == null) {
+ mAddedMenuVisWrappers.remove(i--);
+ } else if (wrapper.mWrappedListener == compatListener) {
+ mAddedMenuVisWrappers.remove(i);
+ return wrapper;
+ }
+ }
+ return null;
}
@Override
- public Context getThemedContext() {
- return mActionBar.getThemedContext();
+ public void setCustomView(View view) {
+ mActionBar.setCustomView(view);
+ }
+
+ @Override
+ public void setCustomView(View view, LayoutParams layoutParams) {
+ android.app.ActionBar.LayoutParams lp =
+ new android.app.ActionBar.LayoutParams(layoutParams);
+ lp.gravity = layoutParams.gravity;
+
+ mActionBar.setCustomView(view, lp);
+ }
+
+ @Override
+ public void setCustomView(int resId) {
+ mActionBar.setCustomView(resId);
}
@Override
@@ -51,4 +95,392 @@
mActionBar.setLogo(logo);
}
+ @Override
+ public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
+ mActionBar.setListNavigationCallbacks(adapter,
+ callback != null ? new OnNavigationListenerWrapper(callback) : null);
+ }
+
+ @Override
+ public void setSelectedNavigationItem(int position) {
+ mActionBar.setSelectedNavigationItem(position);
+ }
+
+ @Override
+ public int getSelectedNavigationIndex() {
+ return mActionBar.getSelectedNavigationIndex();
+ }
+
+ @Override
+ public int getNavigationItemCount() {
+ return mActionBar.getNavigationItemCount();
+ }
+
+ @Override
+ public void setTitle(CharSequence title) {
+ mActionBar.setTitle(title);
+ }
+
+ @Override
+ public void setTitle(int resId) {
+ mActionBar.setTitle(resId);
+ }
+
+ @Override
+ public void setSubtitle(CharSequence subtitle) {
+ mActionBar.setSubtitle(subtitle);
+ }
+
+ @Override
+ public void setSubtitle(int resId) {
+ mActionBar.setSubtitle(resId);
+ }
+
+ @Override
+ public void setDisplayOptions(int options) {
+ mActionBar.setDisplayOptions(options);
+ }
+
+ @Override
+ public void setDisplayOptions(int options, int mask) {
+ mActionBar.setDisplayOptions(options, mask);
+ }
+
+ @Override
+ public void setDisplayUseLogoEnabled(boolean useLogo) {
+ mActionBar.setDisplayUseLogoEnabled(useLogo);
+ }
+
+ @Override
+ public void setDisplayShowHomeEnabled(boolean showHome) {
+ mActionBar.setDisplayShowHomeEnabled(showHome);
+ }
+
+ @Override
+ public void setDisplayHomeAsUpEnabled(boolean showHomeAsUp) {
+ mActionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);
+ }
+
+ @Override
+ public void setDisplayShowTitleEnabled(boolean showTitle) {
+ mActionBar.setDisplayShowTitleEnabled(showTitle);
+ }
+
+ @Override
+ public void setDisplayShowCustomEnabled(boolean showCustom) {
+ mActionBar.setDisplayShowCustomEnabled(showCustom);
+ }
+
+ @Override
+ public void setBackgroundDrawable(Drawable d) {
+ mActionBar.setBackgroundDrawable(d);
+ }
+
+ @Override
+ public View getCustomView() {
+ return mActionBar.getCustomView();
+ }
+
+ @Override
+ public CharSequence getTitle() {
+ return mActionBar.getTitle();
+ }
+
+ @Override
+ public CharSequence getSubtitle() {
+ return mActionBar.getSubtitle();
+ }
+
+ @Override
+ public int getNavigationMode() {
+ return mActionBar.getNavigationMode();
+ }
+
+ @Override
+ public void setNavigationMode(int mode) {
+ mActionBar.setNavigationMode(mode);
+ }
+
+ @Override
+ public int getDisplayOptions() {
+ return mActionBar.getDisplayOptions();
+ }
+
+ @Override
+ public Tab newTab() {
+ final android.app.ActionBar.Tab realTab = mActionBar.newTab();
+ final TabWrapper result = new TabWrapper(realTab);
+ realTab.setTag(result);
+ return result;
+ }
+
+ @Override
+ public void addTab(Tab tab) {
+ mActionBar.addTab(((TabWrapper) tab).mWrappedTab);
+ }
+
+ @Override
+ public void addTab(Tab tab, boolean setSelected) {
+ mActionBar.addTab(((TabWrapper) tab).mWrappedTab, setSelected);
+ }
+
+ @Override
+ public void addTab(Tab tab, int position) {
+ mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position);
+ }
+
+ @Override
+ public void addTab(Tab tab, int position, boolean setSelected) {
+ mActionBar.addTab(((TabWrapper) tab).mWrappedTab, position, setSelected);
+ }
+
+ @Override
+ public void removeTab(Tab tab) {
+ mActionBar.removeTab(((TabWrapper) tab).mWrappedTab);
+ }
+
+ @Override
+ public void removeTabAt(int position) {
+ mActionBar.removeTabAt(position);
+ }
+
+ @Override
+ public void removeAllTabs() {
+ mActionBar.removeAllTabs();
+ }
+
+ @Override
+ public void selectTab(Tab tab) {
+ mActionBar.selectTab(((TabWrapper) tab).mWrappedTab);
+ }
+
+ @Override
+ public Tab getSelectedTab() {
+ return (Tab) mActionBar.getSelectedTab().getTag();
+ }
+
+ @Override
+ public Tab getTabAt(int index) {
+ return (Tab) mActionBar.getTabAt(index).getTag();
+ }
+
+ @Override
+ public int getTabCount() {
+ return mActionBar.getTabCount();
+ }
+
+ @Override
+ public Context getThemedContext() {
+ return mActionBar.getThemedContext();
+ }
+
+ @Override
+ public int getHeight() {
+ return mActionBar.getHeight();
+ }
+
+ @Override
+ public void show() {
+ mActionBar.show();
+ }
+
+ @Override
+ public void hide() {
+ mActionBar.hide();
+ }
+
+ @Override
+ public boolean isShowing() {
+ return mActionBar.isShowing();
+ }
+
+ @Override
+ public void addOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
+ if (listener != null) {
+ OnMenuVisibilityListenerWrapper w = new OnMenuVisibilityListenerWrapper(listener);
+ mAddedMenuVisWrappers.add(new WeakReference<OnMenuVisibilityListenerWrapper>(w));
+ mActionBar.addOnMenuVisibilityListener(w);
+ }
+ }
+
+ @Override
+ public void removeOnMenuVisibilityListener(OnMenuVisibilityListener listener) {
+ OnMenuVisibilityListenerWrapper l = findAndRemoveMenuVisWrapper(listener);
+ mActionBar.removeOnMenuVisibilityListener(l);
+ }
+
+ static class OnNavigationListenerWrapper implements android.app.ActionBar.OnNavigationListener {
+
+ private final OnNavigationListener mWrappedListener;
+
+ public OnNavigationListenerWrapper(OnNavigationListener l) {
+ mWrappedListener = l;
+ }
+
+ @Override
+ public boolean onNavigationItemSelected(int itemPosition, long itemId) {
+ return mWrappedListener.onNavigationItemSelected(itemPosition, itemId);
+ }
+
+ }
+
+ static class OnMenuVisibilityListenerWrapper implements
+ android.app.ActionBar.OnMenuVisibilityListener {
+
+ final OnMenuVisibilityListener mWrappedListener;
+
+ public OnMenuVisibilityListenerWrapper(OnMenuVisibilityListener l) {
+ mWrappedListener = l;
+ }
+
+ @Override
+ public void onMenuVisibilityChanged(boolean isVisible) {
+ mWrappedListener.onMenuVisibilityChanged(isVisible);
+ }
+
+ }
+
+ class TabWrapper extends ActionBar.Tab implements android.app.ActionBar.TabListener {
+
+ final android.app.ActionBar.Tab mWrappedTab;
+ private Object mTag;
+ private FragmentTransaction mActiveTransaction;
+ private CharSequence mContentDescription;
+ private TabListener mTabListener;
+
+ public TabWrapper(android.app.ActionBar.Tab tab) {
+ mWrappedTab = tab;
+ }
+
+ @Override
+ public int getPosition() {
+ return mWrappedTab.getPosition();
+ }
+
+ @Override
+ public Drawable getIcon() {
+ return mWrappedTab.getIcon();
+ }
+
+ @Override
+ public CharSequence getText() {
+ return mWrappedTab.getText();
+ }
+
+ @Override
+ public Tab setIcon(Drawable icon) {
+ mWrappedTab.setIcon(icon);
+ return this;
+ }
+
+ @Override
+ public Tab setIcon(int resId) {
+ mWrappedTab.setIcon(resId);
+ return this;
+ }
+
+ @Override
+ public Tab setText(CharSequence text) {
+ mWrappedTab.setText(text);
+ return this;
+ }
+
+ @Override
+ public Tab setText(int resId) {
+ mWrappedTab.setText(resId);
+ return this;
+ }
+
+ @Override
+ public Tab setCustomView(View view) {
+ mWrappedTab.setCustomView(view);
+ return this;
+ }
+
+ @Override
+ public Tab setCustomView(int layoutResId) {
+ mWrappedTab.setCustomView(layoutResId);
+ return this;
+ }
+
+ @Override
+ public View getCustomView() {
+ return mWrappedTab.getCustomView();
+ }
+
+ @Override
+ public Tab setTag(Object obj) {
+ mTag = obj;
+ return this;
+ }
+
+ @Override
+ public Object getTag() {
+ return mTag;
+ }
+
+ @Override
+ public Tab setTabListener(TabListener listener) {
+ mTabListener = listener;
+ mWrappedTab.setTabListener(listener != null ? this : null);
+ return this;
+ }
+
+ @Override
+ public void select() {
+ mWrappedTab.select();
+ }
+
+ @Override
+ public Tab setContentDescription(int resId) {
+ mContentDescription = mActivity.getText(resId);
+ return this;
+ }
+
+ @Override
+ public Tab setContentDescription(CharSequence contentDesc) {
+ mContentDescription = contentDesc;
+ return this;
+ }
+
+ @Override
+ public CharSequence getContentDescription() {
+ return mContentDescription;
+ }
+
+ @Override
+ public void onTabSelected(android.app.ActionBar.Tab tab,
+ android.app.FragmentTransaction ft) {
+ mTabListener.onTabSelected(this, ft != null ? getActiveTransaction() : null);
+ commitActiveTransaction();
+ }
+
+ @Override
+ public void onTabUnselected(android.app.ActionBar.Tab tab,
+ android.app.FragmentTransaction ft) {
+ mTabListener.onTabUnselected(this, ft != null ? getActiveTransaction() : null);
+ }
+
+ @Override
+ public void onTabReselected(android.app.ActionBar.Tab tab,
+ android.app.FragmentTransaction ft) {
+ mTabListener.onTabReselected(this, ft != null ? getActiveTransaction() : null);
+ commitActiveTransaction();
+ }
+
+ private FragmentTransaction getActiveTransaction() {
+ if (mActiveTransaction == null) {
+ mActiveTransaction = mCallback.getSupportFragmentManager().beginTransaction()
+ .disallowAddToBackStack();
+ }
+ return mActiveTransaction;
+ }
+
+ private void commitActiveTransaction() {
+ if (mActiveTransaction != null && !mActiveTransaction.isEmpty()) {
+ mActiveTransaction.commit();
+ }
+ mActiveTransaction = null;
+ }
+ }
}
diff --git a/v7/appcompat/src/android/support/v7/internal/view/ActionBarPolicy.java b/v7/appcompat/src/android/support/v7/internal/view/ActionBarPolicy.java
index 8f809a4..e1b66d7 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/ActionBarPolicy.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/ActionBarPolicy.java
@@ -19,11 +19,14 @@
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.os.Build;
import android.support.v7.appcompat.R;
/**
* Allows components to query for various configuration policy decisions about how the action bar
* should lay out and behave on the current device.
+ *
+ * @hide
*/
public class ActionBarPolicy {
@@ -42,9 +45,8 @@
}
public boolean showsOverflowMenuButton() {
- // Permanent menu key is always present on pre-HC devices
- // return !ViewConfiguration.get(mContext).hasPermanentMenuKey();
- return false;
+ // Only show overflow on HC+ devices
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
public int getEmbeddedMenuWidthLimit() {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/CollapsibleActionView.java b/v7/appcompat/src/android/support/v7/internal/view/CollapsibleActionView.java
index e1034cd..dcc7a04 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/CollapsibleActionView.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/CollapsibleActionView.java
@@ -25,6 +25,8 @@
*
* <p>See {@link android.support.v4.internal.view.SupportMenuItem} for more information about action views.
* See {@link android.app.ActionBar} for more information about the action bar.
+ *
+ * @hide
*/
public interface CollapsibleActionView {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/SupportMenuInflater.java b/v7/appcompat/src/android/support/v7/internal/view/SupportMenuInflater.java
index 1ba0d9f..023a8c6 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/SupportMenuInflater.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/SupportMenuInflater.java
@@ -49,6 +49,8 @@
* to use SupportMenuInflater with an XmlPullParser over a plain XML file at runtime;
* it only works with an XmlPullParser returned from a compiled resource (R.
* <em>something</em> file.)
+ *
+ * @hide
*/
public class SupportMenuInflater extends MenuInflater {
private static final String LOG_TAG = "SupportMenuInflater";
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuItemView.java b/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuItemView.java
index fad5d26..c5d190d 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuItemView.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuItemView.java
@@ -22,6 +22,7 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.appcompat.R;
+import android.support.v7.internal.widget.CompatTextView;
import android.text.TextUtils;
import android.text.method.TransformationMethod;
import android.util.AttributeSet;
@@ -35,7 +36,7 @@
/**
* @hide
*/
-public class ActionMenuItemView extends TextView
+public class ActionMenuItemView extends CompatTextView
implements MenuView.ItemView, View.OnClickListener, View.OnLongClickListener,
ActionMenuView.ActionMenuChildView {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuPresenter.java b/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuPresenter.java
index 83533fd..d385fc4 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/ActionMenuPresenter.java
@@ -38,6 +38,8 @@
/**
* MenuPresenter for building action menus as seen in the action bar and action modes.
+ *
+ * @hide
*/
public class ActionMenuPresenter extends BaseMenuPresenter
implements ActionProvider.SubUiVisibilityListener {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java b/v7/appcompat/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java
index fde68bc..62b6bf1 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java
@@ -27,6 +27,8 @@
* Base class for MenuPresenters that have a consistent container view and item views. Behaves
* similarly to an AdapterView in that existing item views will be reused if possible when items
* change.
+ *
+ * @hide
*/
public abstract class BaseMenuPresenter implements MenuPresenter {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/ExpandedMenuView.java b/v7/appcompat/src/android/support/v7/internal/view/menu/ExpandedMenuView.java
index 72395b1..ba481fd 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/ExpandedMenuView.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/ExpandedMenuView.java
@@ -29,6 +29,8 @@
/**
* The expanded menu view is a list-like menu with all of the available menu items. It is opened
* by the user clicking no the 'More' button on the icon menu view.
+ *
+ * @hide
*/
public final class ExpandedMenuView extends ListView
implements ItemInvoker, MenuView, OnItemClickListener {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuItemView.java b/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuItemView.java
index e77f1f2..282ff9d 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuItemView.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuItemView.java
@@ -33,6 +33,8 @@
/**
* The item view for each item in the ListView-based MenuViews.
+ *
+ * @hide
*/
public class ListMenuItemView extends LinearLayout implements MenuView.ItemView {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuPresenter.java b/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuPresenter.java
index 2a6ef94..1d79f5f 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/ListMenuPresenter.java
@@ -34,6 +34,8 @@
/**
* MenuPresenter for list-style menus.
+ *
+ * @hide
*/
public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClickListener {
private static final String TAG = "ListMenuPresenter";
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuBuilder.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuBuilder.java
index 7b3b84c..34ccbf2 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuBuilder.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuBuilder.java
@@ -33,6 +33,8 @@
/**
* Implementation of the {@link android.support.v4.internal.view.SupportMenu} interface for creating a
* standard menu UI.
+ *
+ * @hide
*/
public class MenuBuilder implements SupportMenu {
@@ -157,6 +159,7 @@
/**
* Called by menu to notify of close and selection changes.
+ * @hide
*/
public interface Callback {
@@ -179,6 +182,7 @@
/**
* Called by menu items to execute their associated action
+ * @hide
*/
public interface ItemInvoker {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperHC.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperHC.java
deleted file mode 100644
index 93702bb..0000000
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperHC.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Copyright (C) 2012 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.
- */
-
-package android.support.v7.internal.view.menu;
-
-import android.content.Intent;
-import android.graphics.drawable.Drawable;
-import android.support.v4.internal.view.SupportMenuItem;
-import android.support.v4.view.ActionProvider;
-import android.support.v4.view.MenuItemCompat;
-import android.view.ContextMenu;
-import android.view.MenuItem;
-import android.view.SubMenu;
-import android.view.View;
-
-class MenuItemWrapperHC extends BaseMenuWrapper<android.view.MenuItem> implements SupportMenuItem {
- MenuItemWrapperHC(android.view.MenuItem object) {
- super(object);
- }
-
- @Override
- public int getItemId() {
- return mWrappedObject.getItemId();
- }
-
- @Override
- public int getGroupId() {
- return mWrappedObject.getGroupId();
- }
-
- @Override
- public int getOrder() {
- return mWrappedObject.getOrder();
- }
-
- @Override
- public MenuItem setTitle(CharSequence title) {
- mWrappedObject.setTitle(title);
- return this;
- }
-
- @Override
- public MenuItem setTitle(int title) {
- mWrappedObject.setTitle(title);
- return this;
- }
-
- @Override
- public CharSequence getTitle() {
- return mWrappedObject.getTitle();
- }
-
- @Override
- public MenuItem setTitleCondensed(CharSequence title) {
- mWrappedObject.setTitleCondensed(title);
- return this;
- }
-
- @Override
- public CharSequence getTitleCondensed() {
- return mWrappedObject.getTitleCondensed();
- }
-
- @Override
- public MenuItem setIcon(Drawable icon) {
- mWrappedObject.setIcon(icon);
- return this;
- }
-
- @Override
- public MenuItem setIcon(int iconRes) {
- mWrappedObject.setIcon(iconRes);
- return this;
- }
-
- @Override
- public Drawable getIcon() {
- return mWrappedObject.getIcon();
- }
-
- @Override
- public MenuItem setIntent(Intent intent) {
- mWrappedObject.setIntent(intent);
- return this;
- }
-
- @Override
- public Intent getIntent() {
- return mWrappedObject.getIntent();
- }
-
- @Override
- public MenuItem setShortcut(char numericChar, char alphaChar) {
- mWrappedObject.setShortcut(numericChar, alphaChar);
- return this;
- }
-
- @Override
- public MenuItem setNumericShortcut(char numericChar) {
- mWrappedObject.setNumericShortcut(numericChar);
- return this;
- }
-
- @Override
- public char getNumericShortcut() {
- return mWrappedObject.getNumericShortcut();
- }
-
- @Override
- public MenuItem setAlphabeticShortcut(char alphaChar) {
- mWrappedObject.setAlphabeticShortcut(alphaChar);
- return this;
- }
-
- @Override
- public char getAlphabeticShortcut() {
- return mWrappedObject.getAlphabeticShortcut();
- }
-
- @Override
- public MenuItem setCheckable(boolean checkable) {
- mWrappedObject.setCheckable(checkable);
- return this;
- }
-
- @Override
- public boolean isCheckable() {
- return mWrappedObject.isCheckable();
- }
-
- @Override
- public MenuItem setChecked(boolean checked) {
- mWrappedObject.setChecked(checked);
- return this;
- }
-
- @Override
- public boolean isChecked() {
- return mWrappedObject.isChecked();
- }
-
- @Override
- public MenuItem setVisible(boolean visible) {
- mWrappedObject.setVisible(visible);
- return this;
- }
-
- @Override
- public boolean isVisible() {
- return mWrappedObject.isVisible();
- }
-
- @Override
- public MenuItem setEnabled(boolean enabled) {
- mWrappedObject.setEnabled(enabled);
- return this;
- }
-
- @Override
- public boolean isEnabled() {
- return mWrappedObject.isEnabled();
- }
-
- @Override
- public boolean hasSubMenu() {
- return mWrappedObject.hasSubMenu();
- }
-
- @Override
- public SubMenu getSubMenu() {
- return getSubMenuWrapper(mWrappedObject.getSubMenu());
- }
-
- @Override
- public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) {
- mWrappedObject.setOnMenuItemClickListener(menuItemClickListener != null ?
- new OnMenuItemClickListenerWrapper(menuItemClickListener) : null);
- return this;
- }
-
- @Override
- public ContextMenu.ContextMenuInfo getMenuInfo() {
- return mWrappedObject.getMenuInfo();
- }
-
- @Override
- public void setShowAsAction(int actionEnum) {
- mWrappedObject.setShowAsAction(actionEnum);
- }
-
- @Override
- public MenuItem setShowAsActionFlags(int actionEnum) {
- mWrappedObject.setShowAsActionFlags(actionEnum);
- return this;
- }
-
- @Override
- public MenuItem setActionView(View view) {
- mWrappedObject.setActionView(view);
- return this;
- }
-
- @Override
- public MenuItem setActionView(int resId) {
- mWrappedObject.setActionView(resId);
- return this;
- }
-
- @Override
- public View getActionView() {
- return mWrappedObject.getActionView();
- }
-
- @Override
- public SupportMenuItem setSupportActionProvider(ActionProvider actionProvider) {
- // APIv14+ API
- return this;
- }
-
- @Override
- public ActionProvider getSupportActionProvider() {
- // APIv14+ API
- return null;
- }
-
- @Override
- public MenuItem setActionProvider(android.view.ActionProvider actionProvider) {
- // APIv14+ API
- throw new UnsupportedOperationException();
- }
-
- @Override
- public android.view.ActionProvider getActionProvider() {
- // APIv14+ API
- throw new UnsupportedOperationException();
- }
-
- @Override
- public boolean expandActionView() {
- // APIv14+ API
- return false;
- }
-
- @Override
- public boolean collapseActionView() {
- // APIv14+ API
- return false;
- }
-
- @Override
- public boolean isActionViewExpanded() {
- // APIv14+ API
- return false;
- }
-
- @Override
- public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener listener) {
- // APIv14+ API
- throw new UnsupportedOperationException();
- }
-
- @Override
- public SupportMenuItem setSupportOnActionExpandListener(
- MenuItemCompat.OnActionExpandListener listener) {
- // APIv14+ API
- return null;
- }
-
- private class OnMenuItemClickListenerWrapper extends BaseWrapper<OnMenuItemClickListener>
- implements android.view.MenuItem.OnMenuItemClickListener {
-
- OnMenuItemClickListenerWrapper(OnMenuItemClickListener object) {
- super(object);
- }
-
- @Override
- public boolean onMenuItemClick(android.view.MenuItem item) {
- return mWrappedObject.onMenuItemClick(getMenuItemWrapper(item));
- }
- }
-}
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperICS.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperICS.java
index b31abb3..3c653b8 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperICS.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuItemWrapperICS.java
@@ -16,12 +16,17 @@
package android.support.v7.internal.view.menu;
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
import android.support.v4.internal.view.SupportMenuItem;
import android.support.v4.view.ActionProvider;
+import android.support.v4.view.MenuItemCompat;
+import android.view.ContextMenu;
import android.view.MenuItem;
+import android.view.SubMenu;
import android.view.View;
-class MenuItemWrapperICS extends MenuItemWrapperHC {
+class MenuItemWrapperICS extends BaseMenuWrapper<android.view.MenuItem> implements SupportMenuItem {
private final boolean mEmulateProviderVisibilityOverride;
// Tracks the last requested visibility
private boolean mLastRequestVisible;
@@ -37,6 +42,127 @@
}
@Override
+ public int getItemId() {
+ return mWrappedObject.getItemId();
+ }
+
+ @Override
+ public int getGroupId() {
+ return mWrappedObject.getGroupId();
+ }
+
+ @Override
+ public int getOrder() {
+ return mWrappedObject.getOrder();
+ }
+
+ @Override
+ public MenuItem setTitle(CharSequence title) {
+ mWrappedObject.setTitle(title);
+ return this;
+ }
+
+ @Override
+ public MenuItem setTitle(int title) {
+ mWrappedObject.setTitle(title);
+ return this;
+ }
+
+ @Override
+ public CharSequence getTitle() {
+ return mWrappedObject.getTitle();
+ }
+
+ @Override
+ public MenuItem setTitleCondensed(CharSequence title) {
+ mWrappedObject.setTitleCondensed(title);
+ return this;
+ }
+
+ @Override
+ public CharSequence getTitleCondensed() {
+ return mWrappedObject.getTitleCondensed();
+ }
+
+ @Override
+ public MenuItem setIcon(Drawable icon) {
+ mWrappedObject.setIcon(icon);
+ return this;
+ }
+
+ @Override
+ public MenuItem setIcon(int iconRes) {
+ mWrappedObject.setIcon(iconRes);
+ return this;
+ }
+
+ @Override
+ public Drawable getIcon() {
+ return mWrappedObject.getIcon();
+ }
+
+ @Override
+ public MenuItem setIntent(Intent intent) {
+ mWrappedObject.setIntent(intent);
+ return this;
+ }
+
+ @Override
+ public Intent getIntent() {
+ return mWrappedObject.getIntent();
+ }
+
+ @Override
+ public MenuItem setShortcut(char numericChar, char alphaChar) {
+ mWrappedObject.setShortcut(numericChar, alphaChar);
+ return this;
+ }
+
+ @Override
+ public MenuItem setNumericShortcut(char numericChar) {
+ mWrappedObject.setNumericShortcut(numericChar);
+ return this;
+ }
+
+ @Override
+ public char getNumericShortcut() {
+ return mWrappedObject.getNumericShortcut();
+ }
+
+ @Override
+ public MenuItem setAlphabeticShortcut(char alphaChar) {
+ mWrappedObject.setAlphabeticShortcut(alphaChar);
+ return this;
+ }
+
+ @Override
+ public char getAlphabeticShortcut() {
+ return mWrappedObject.getAlphabeticShortcut();
+ }
+
+ @Override
+ public MenuItem setCheckable(boolean checkable) {
+ mWrappedObject.setCheckable(checkable);
+ return this;
+ }
+
+ @Override
+ public boolean isCheckable() {
+ return mWrappedObject.isCheckable();
+ }
+
+ @Override
+ public MenuItem setChecked(boolean checked) {
+ mWrappedObject.setChecked(checked);
+ return this;
+ }
+
+ @Override
+ public boolean isChecked() {
+ return mWrappedObject.isChecked();
+ }
+
+ @Override
public MenuItem setVisible(boolean visible) {
if (mEmulateProviderVisibilityOverride) {
mLastRequestVisible = visible;
@@ -49,6 +175,72 @@
}
@Override
+ public boolean isVisible() {
+ return mWrappedObject.isVisible();
+ }
+
+ @Override
+ public MenuItem setEnabled(boolean enabled) {
+ mWrappedObject.setEnabled(enabled);
+ return this;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return mWrappedObject.isEnabled();
+ }
+
+ @Override
+ public boolean hasSubMenu() {
+ return mWrappedObject.hasSubMenu();
+ }
+
+ @Override
+ public SubMenu getSubMenu() {
+ return getSubMenuWrapper(mWrappedObject.getSubMenu());
+ }
+
+ @Override
+ public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener menuItemClickListener) {
+ mWrappedObject.setOnMenuItemClickListener(menuItemClickListener != null ?
+ new OnMenuItemClickListenerWrapper(menuItemClickListener) : null);
+ return this;
+ }
+
+ @Override
+ public ContextMenu.ContextMenuInfo getMenuInfo() {
+ return mWrappedObject.getMenuInfo();
+ }
+
+ @Override
+ public void setShowAsAction(int actionEnum) {
+ mWrappedObject.setShowAsAction(actionEnum);
+ }
+
+ @Override
+ public MenuItem setShowAsActionFlags(int actionEnum) {
+ mWrappedObject.setShowAsActionFlags(actionEnum);
+ return this;
+ }
+
+ @Override
+ public MenuItem setActionView(View view) {
+ mWrappedObject.setActionView(view);
+ return this;
+ }
+
+ @Override
+ public MenuItem setActionView(int resId) {
+ mWrappedObject.setActionView(resId);
+ return this;
+ }
+
+ @Override
+ public View getActionView() {
+ return mWrappedObject.getActionView();
+ }
+
+ @Override
public MenuItem setActionProvider(android.view.ActionProvider provider) {
mWrappedObject.setActionProvider(provider);
if (provider != null && mEmulateProviderVisibilityOverride) {
@@ -79,9 +271,16 @@
@Override
public MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener listener) {
+ mWrappedObject.setOnActionExpandListener(listener);
+ return this;
+ }
+
+ @Override
+ public SupportMenuItem setSupportOnActionExpandListener(
+ MenuItemCompat.OnActionExpandListener listener) {
mWrappedObject.setOnActionExpandListener(listener != null ?
new OnActionExpandListenerWrapper(listener) : null);
- return this;
+ return null;
}
@Override
@@ -120,10 +319,23 @@
return mWrappedObject.setVisible(visible);
}
- private class OnActionExpandListenerWrapper extends BaseWrapper<MenuItem.OnActionExpandListener>
+ private class OnMenuItemClickListenerWrapper extends BaseWrapper<OnMenuItemClickListener>
+ implements android.view.MenuItem.OnMenuItemClickListener {
+
+ OnMenuItemClickListenerWrapper(OnMenuItemClickListener object) {
+ super(object);
+ }
+
+ @Override
+ public boolean onMenuItemClick(android.view.MenuItem item) {
+ return mWrappedObject.onMenuItemClick(getMenuItemWrapper(item));
+ }
+ }
+
+ private class OnActionExpandListenerWrapper extends BaseWrapper<MenuItemCompat.OnActionExpandListener>
implements android.view.MenuItem.OnActionExpandListener {
- OnActionExpandListenerWrapper(MenuItem.OnActionExpandListener object) {
+ OnActionExpandListenerWrapper(MenuItemCompat.OnActionExpandListener object) {
super(object);
}
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuPresenter.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuPresenter.java
index e480b21..f11a8e1 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuPresenter.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuPresenter.java
@@ -23,11 +23,15 @@
/**
* A MenuPresenter is responsible for building views for a Menu object. It takes over some
* responsibility from the old style monolithic MenuBuilder class.
+ *
+ * @hide
*/
public interface MenuPresenter {
/**
* Called by menu implementation to notify another component of open/close events.
+ *
+ * @hide
*/
public interface Callback {
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperFactory.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperFactory.java
index dbb6cc7..10e583e 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperFactory.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperFactory.java
@@ -23,13 +23,16 @@
import android.view.Menu;
import android.view.MenuItem;
+/**
+ * @hide
+ */
public final class MenuWrapperFactory {
private MenuWrapperFactory() {
}
public static Menu createMenuWrapper(android.view.Menu frameworkMenu) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new MenuWrapperHC(frameworkMenu);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return new MenuWrapperICS(frameworkMenu);
}
return frameworkMenu;
}
@@ -39,23 +42,21 @@
return new MenuItemWrapperJB(frameworkMenuItem);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new MenuItemWrapperICS(frameworkMenuItem);
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new MenuItemWrapperHC(frameworkMenuItem);
}
return frameworkMenuItem;
}
public static SupportMenu createSupportMenuWrapper(android.view.Menu frameworkMenu) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new MenuWrapperHC(frameworkMenu);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return new MenuWrapperICS(frameworkMenu);
}
throw new UnsupportedOperationException();
}
public static SupportSubMenu createSupportSubMenuWrapper(
android.view.SubMenu frameworkSubMenu) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new SubMenuWrapperHC(frameworkSubMenu);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ return new SubMenuWrapperICS(frameworkSubMenu);
}
throw new UnsupportedOperationException();
}
@@ -66,8 +67,6 @@
return new MenuItemWrapperJB(frameworkMenuItem);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new MenuItemWrapperICS(frameworkMenuItem);
- } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new MenuItemWrapperHC(frameworkMenuItem);
}
throw new UnsupportedOperationException();
}
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperHC.java b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperICS.java
similarity index 96%
rename from v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperHC.java
rename to v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperICS.java
index 0a247a4..8d0e30f 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperHC.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/MenuWrapperICS.java
@@ -24,9 +24,9 @@
import android.view.MenuItem;
import android.view.SubMenu;
-class MenuWrapperHC extends BaseMenuWrapper<android.view.Menu> implements SupportMenu {
+class MenuWrapperICS extends BaseMenuWrapper<android.view.Menu> implements SupportMenu {
- MenuWrapperHC(android.view.Menu object) {
+ MenuWrapperICS(android.view.Menu object) {
super(object);
}
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuBuilder.java b/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuBuilder.java
index fa3c3b0..24a7ddd 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuBuilder.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuBuilder.java
@@ -26,6 +26,8 @@
/**
* The model for a sub menu, which is an extension of the menu. Most methods are proxied to the
* parent menu.
+ *
+ * @hide
*/
public class SubMenuBuilder extends MenuBuilder implements SubMenu {
@@ -119,7 +121,6 @@
@Override
public void clearHeader() {
- //To change body of implemented methods use File | Settings | File Templates.
}
@Override
diff --git a/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperHC.java b/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperICS.java
similarity index 94%
rename from v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperHC.java
rename to v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperICS.java
index 77c0178..3e70e49 100644
--- a/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperHC.java
+++ b/v7/appcompat/src/android/support/v7/internal/view/menu/SubMenuWrapperICS.java
@@ -22,8 +22,8 @@
import android.view.SubMenu;
import android.view.View;
-class SubMenuWrapperHC extends MenuWrapperHC implements SupportSubMenu {
- SubMenuWrapperHC(android.view.SubMenu subMenu) {
+class SubMenuWrapperICS extends MenuWrapperICS implements SupportSubMenu {
+ SubMenuWrapperICS(android.view.SubMenu subMenu) {
super(subMenu);
}
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/ActionBarOverlayLayout.java b/v7/appcompat/src/android/support/v7/internal/widget/ActionBarOverlayLayout.java
index e6bcc99..b67254b 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/ActionBarOverlayLayout.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/ActionBarOverlayLayout.java
@@ -28,6 +28,8 @@
/**
* Special layout for the containing of an overlay action bar (and its content) to correctly handle
* fitting system windows when the content has request that its layout ignore them.
+ *
+ * @hide
*/
public class ActionBarOverlayLayout extends FrameLayout {
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/CompatTextView.java b/v7/appcompat/src/android/support/v7/internal/widget/CompatTextView.java
new file mode 100644
index 0000000..b446b47
--- /dev/null
+++ b/v7/appcompat/src/android/support/v7/internal/widget/CompatTextView.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package android.support.v7.internal.widget;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Rect;
+import android.support.v7.appcompat.R;
+import android.text.method.TransformationMethod;
+import android.util.AttributeSet;
+import android.view.View;
+import android.widget.TextView;
+
+import java.util.Locale;
+
+/**
+ * @hide
+ */
+public class CompatTextView extends TextView {
+
+ public CompatTextView(Context context) {
+ this(context, null);
+ }
+
+ public CompatTextView(Context context, AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public CompatTextView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+
+ boolean allCaps = false;
+
+ TypedArray style = context
+ .obtainStyledAttributes(attrs, R.styleable.CompatTextView, defStyle, 0);
+ allCaps = style.getBoolean(R.styleable.CompatTextView_textAllCaps, false);
+ style.recycle();
+
+ // Framework impl also checks TextAppearance for textAllCaps. This isn't needed for our
+ // purposes so has been omitted.
+
+ if (allCaps) {
+ setTransformationMethod(new AllCapsTransformationMethod(context));
+ }
+ }
+
+ /**
+ * Transforms source text into an ALL CAPS string, locale-aware.
+ */
+ private static class AllCapsTransformationMethod implements TransformationMethod {
+
+ private final Locale mLocale;
+
+ public AllCapsTransformationMethod(Context context) {
+ mLocale = context.getResources().getConfiguration().locale;
+ }
+
+ @Override
+ public CharSequence getTransformation(CharSequence source, View view) {
+ return source != null ? source.toString().toUpperCase(mLocale) : null;
+ }
+
+ @Override
+ public void onFocusChanged(View view, CharSequence charSequence, boolean b, int i,
+ Rect rect) {
+ }
+ }
+}
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/ListPopupWindow.java b/v7/appcompat/src/android/support/v7/internal/widget/ListPopupWindow.java
index 800fa46..8913fea 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/ListPopupWindow.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/ListPopupWindow.java
@@ -49,6 +49,8 @@
*
* @see android.widget.AutoCompleteTextView
* @see android.widget.Spinner
+ *
+ * @hide
*/
public class ListPopupWindow {
diff --git a/v7/appcompat/src/android/support/v7/internal/widget/ScrollingTabContainerView.java b/v7/appcompat/src/android/support/v7/internal/widget/ScrollingTabContainerView.java
index 2c1fac3..4f0d026 100644
--- a/v7/appcompat/src/android/support/v7/internal/widget/ScrollingTabContainerView.java
+++ b/v7/appcompat/src/android/support/v7/internal/widget/ScrollingTabContainerView.java
@@ -38,6 +38,8 @@
/**
* This widget implements the dynamic action bar tab behavior that can change across different
* configurations or circumstances.
+ *
+ * @hide
*/
public class ScrollingTabContainerView extends HorizontalScrollView
implements AdapterViewICS.OnItemClickListener {
@@ -316,6 +318,9 @@
tabView.getTab().select();
}
+ /**
+ * @hide
+ */
public static class TabView extends LinearLayout {
private ActionBar.Tab mTab;
@@ -404,7 +409,7 @@
if (text != null) {
if (mTextView == null) {
- TextView textView = new TextView(getContext(), null,
+ TextView textView = new CompatTextView(getContext(), null,
R.attr.actionBarTabTextStyle);
textView.setEllipsize(TruncateAt.END);
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,