From 22a117d1b60869ed36d125796396f190b4b002fb Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Mon, 21 Jul 2014 19:40:24 -0700 Subject: Add popupTheme attr, propagate from ActionBar to ToolBar BUG: 16347549 Change-Id: I934ec2469f8c136f750e2e2cf9b333e229393ac3 --- api/current.txt | 1 + core/java/android/widget/Toolbar.java | 5 ++--- .../internal/widget/ToolbarWidgetWrapper.java | 7 +++++++ core/res/res/values/attrs.xml | 6 ++++++ core/res/res/values/public.xml | 1 + 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 168be11d95e4..71030e3dd628 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 @@ + + @@ -7184,6 +7187,9 @@ + + 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 @@ + 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. ?attr/dividerVertical @style/TextAppearance.Material.Widget.ActionBar.Title @style/TextAppearance.Material.Widget.ActionBar.Subtitle - @style/Widget.Material.ProgressBar.Horizontal - @style/Widget.Material.ProgressBar + ?attr/progressBarStyleHorizontal + ?attr/progressBarStyle 32dip 8dip @layout/action_bar_home_material center_vertical 16dp 8dp + ?attr/actionBarPopupTheme - - - +