diff options
author | Adam Powell <adamp@google.com> | 2014-05-30 16:19:16 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2014-05-30 16:19:16 -0700 |
commit | ebba5d4edd763b19124b715a0f084d2f00c84a47 (patch) | |
tree | 4cd6b7a6969094f4898ae33679729af2ce875eaa /core | |
parent | eec8f0cbbba8cfe3de29fef4b2362af3817ea575 (diff) | |
download | frameworks_base-ebba5d4edd763b19124b715a0f084d2f00c84a47.zip frameworks_base-ebba5d4edd763b19124b715a0f084d2f00c84a47.tar.gz frameworks_base-ebba5d4edd763b19124b715a0f084d2f00c84a47.tar.bz2 |
Fix action bar title TextAppearance usage for Toolbar decor
Pass through the appropriate action bar styles for title/subtitle
TextAppearance.
Bug 15345937
Change-Id: I93c648cf60b4a63498d127dbd6eac2c1fae33aa7
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/Toolbar.java | 22 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/ToolbarWidgetWrapper.java | 10 |
2 files changed, 32 insertions, 0 deletions
diff --git a/core/java/android/widget/Toolbar.java b/core/java/android/widget/Toolbar.java index 5033bee..f35ca27 100644 --- a/core/java/android/widget/Toolbar.java +++ b/core/java/android/widget/Toolbar.java @@ -557,6 +557,28 @@ public class Toolbar extends ViewGroup { } /** + * Sets the text color, size, style, hint color, and highlight color + * from the specified TextAppearance resource. + */ + public void setTitleTextAppearance(Context context, int resId) { + mTitleTextAppearance = resId; + if (mTitleTextView != null) { + mTitleTextView.setTextAppearance(context, resId); + } + } + + /** + * Sets the text color, size, style, hint color, and highlight color + * from the specified TextAppearance resource. + */ + public void setSubtitleTextAppearance(Context context, int resId) { + mSubtitleTextAppearance = resId; + if (mSubtitleTextView != null) { + mSubtitleTextView.setTextAppearance(context, resId); + } + } + + /** * Set the icon to use for the toolbar's navigation button. * * <p>The navigation button appears at the start of the toolbar if present. Setting an icon diff --git a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java index f90aaea..b8dc307 100644 --- a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java +++ b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java @@ -132,6 +132,16 @@ public class ToolbarWidgetWrapper implements DecorToolbar { mToolbar.setContentInsetsRelative(contentInsetStart, contentInsetEnd); } + final int titleTextStyle = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0); + if (titleTextStyle != 0) { + mToolbar.setTitleTextAppearance(mToolbar.getContext(), titleTextStyle); + } + + final int subtitleTextStyle = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0); + if (subtitleTextStyle != 0) { + mToolbar.setSubtitleTextAppearance(mToolbar.getContext(), subtitleTextStyle); + } + a.recycle(); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { |