diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/widget/Toolbar.java | 5 | ||||
| -rw-r--r-- | core/java/com/android/internal/widget/ToolbarWidgetWrapper.java | 7 | ||||
| -rw-r--r-- | core/res/res/values/attrs.xml | 6 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 1 | ||||
| -rw-r--r-- | core/res/res/values/styles_material.xml | 24 |
6 files changed, 22 insertions, 22 deletions
diff --git a/api/current.txt b/api/current.txt index 76616c3938e6..0ca563997d0d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -948,6 +948,7 @@ package android { field public static final int popupKeyboard = 16843331; // 0x1010243 field public static final int popupLayout = 16843323; // 0x101023b field public static final int popupMenuStyle = 16843520; // 0x1010300 + field public static final int popupTheme = 16843951; // 0x10104af field public static final int popupWindowStyle = 16842870; // 0x1010076 field public static final int port = 16842793; // 0x1010029 field public static final int positiveButtonText = 16843253; // 0x10101f5 diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java index 64d03bee5235..79557adca1b2 100644 --- a/core/java/android/widget/Toolbar.java +++ b/core/java/android/widget/Toolbar.java @@ -233,10 +233,9 @@ public class Toolbar extends ViewGroup { if (!TextUtils.isEmpty(subtitle)) { setSubtitle(subtitle); } - a.recycle(); - mPopupContext = context; - mPopupTheme = 0; + setPopupTheme(a.getResourceId(R.styleable.Toolbar_popupTheme, 0)); + a.recycle(); } /** diff --git a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java index e1a490995ffc..5da5ae918c6b 100644 --- a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java +++ b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java @@ -27,6 +27,8 @@ import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import android.util.SparseArray; +import android.util.TypedValue; +import android.view.ContextThemeWrapper; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; @@ -154,6 +156,11 @@ public class ToolbarWidgetWrapper implements DecorToolbar { mToolbar.setSubtitleTextAppearance(mToolbar.getContext(), subtitleTextStyle); } + final int popupTheme = a.getResourceId(R.styleable.ActionBar_popupTheme, 0); + if (popupTheme != 0) { + mToolbar.setPopupTheme(popupTheme); + } + a.recycle(); } diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index d7525d594bc2..00a04ba4930e 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -6896,6 +6896,9 @@ <attr name="contentInsetRight" format="dimension" /> <!-- Elevation for the action bar itself --> <attr name="elevation" /> + <!-- Reference to a theme that should be used to inflate popups + shown by widgets in the action bar. --> + <attr name="popupTheme" /> </declare-styleable> <declare-styleable name="ActionMode"> @@ -7184,6 +7187,9 @@ <flag name="bottom" value="0x50" /> </attr> <attr name="collapseIcon" format="reference" /> + <!-- Reference to a theme that should be used to inflate popups + shown by widgets in the toolbar. --> + <attr name="popupTheme" format="reference" /> </declare-styleable> <declare-styleable name="Toolbar_LayoutParams"> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 5036c24e018a..afa2487b54bf 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2266,6 +2266,7 @@ <public type="attr" name="searchKeyphraseRecognitionFlags" /> <public type="attr" name="checkMarkTint" /> <public type="attr" name="checkMarkTintMode" /> + <public type="attr" name="popupTheme" /> <public-padding type="dimen" name="l_resource_pad" end="0x01050010" /> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 575bbe83f070..e79f223bfb02 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -863,14 +863,15 @@ please see styles_device_defaults.xml. <item name="divider">?attr/dividerVertical</item> <item name="titleTextStyle">@style/TextAppearance.Material.Widget.ActionBar.Title</item> <item name="subtitleTextStyle">@style/TextAppearance.Material.Widget.ActionBar.Subtitle</item> - <item name="progressBarStyle">@style/Widget.Material.ProgressBar.Horizontal</item> - <item name="indeterminateProgressStyle">@style/Widget.Material.ProgressBar</item> + <item name="progressBarStyle">?attr/progressBarStyleHorizontal</item> + <item name="indeterminateProgressStyle">?attr/progressBarStyle</item> <item name="progressBarPadding">32dip</item> <item name="itemPadding">8dip</item> <item name="homeLayout">@layout/action_bar_home_material</item> <item name="gravity">center_vertical</item> <item name="contentInsetStart">16dp</item> <item name="elevation">8dp</item> + <item name="popupTheme">?attr/actionBarPopupTheme</item> </style> <style name="Widget.Material.ActionBar.Solid"> @@ -1032,23 +1033,8 @@ please see styles_device_defaults.xml. <style name="Widget.Material.Light.ActionBar.TabText" parent="Widget.Material.ActionBar.TabText"/> <style name="Widget.Material.Light.ActionMode" parent="Widget.Material.ActionMode" /> <style name="Widget.Material.Light.ActionButton.CloseMode" parent="Widget.Material.ActionButton.CloseMode" /> - - <style name="Widget.Material.Light.ActionBar" parent="Widget.Material.ActionBar"> - <item name="titleTextStyle">@style/TextAppearance.Material.Widget.ActionBar.Title</item> - <item name="subtitleTextStyle">@style/TextAppearance.Material.Widget.ActionBar.Subtitle</item> - <item name="background">@null</item> - <item name="backgroundStacked">@null</item> - <item name="backgroundSplit">@null</item> - <item name="progressBarStyle">@style/Widget.Material.Light.ProgressBar.Horizontal</item> - <item name="indeterminateProgressStyle">@style/Widget.Material.Light.ProgressBar</item> - </style> - - <style name="Widget.Material.Light.ActionBar.Solid"> - <item name="background">?attr/colorPrimary</item> - <item name="backgroundStacked">?attr/colorPrimary</item> - <item name="backgroundSplit">?attr/colorPrimary</item> - </style> - + <style name="Widget.Material.Light.ActionBar" parent="Widget.Material.ActionBar" /> + <style name="Widget.Material.Light.ActionBar.Solid" parent="Widget.Material.ActionBar.Solid" /> <style name="Widget.Material.Light.FastScroll" parent="Widget.Material.FastScroll"/> <style name="Widget.Material.Light.MediaRouteButton" parent="Widget.Material.MediaRouteButton" /> |