Add xml attributes to Toolbar for navigation icon

...to match the existing setters/getters.

Change-Id: I9814c5d7f2aa0559c93fbb74881e29064473f186
This commit is contained in:
Adam Powell
2014-08-28 18:19:59 -07:00
parent b712458362
commit 7c13bc2a70
4 changed files with 16 additions and 0 deletions

View File

@@ -905,6 +905,8 @@ package android {
field public static final int multiprocess = 16842771; // 0x1010013
field public static final int name = 16842755; // 0x1010003
field public static final int navigationBarColor = 16843858; // 0x1010452
field public static final int navigationContentDescription = 16843970; // 0x10104c2
field public static final int navigationIcon = 16843969; // 0x10104c1
field public static final int navigationMode = 16843471; // 0x10102cf
field public static final int negativeButtonText = 16843254; // 0x10101f6
field public static final int nestedScrollingEnabled = 16843830; // 0x1010436

View File

@@ -244,6 +244,16 @@ public class Toolbar extends ViewGroup {
// Set the default context, since setPopupTheme() may be a no-op.
mPopupContext = mContext;
setPopupTheme(a.getResourceId(R.styleable.Toolbar_popupTheme, 0));
final Drawable navIcon = a.getDrawable(R.styleable.Toolbar_navigationIcon);
if (navIcon != null) {
setNavigationIcon(navIcon);
final CharSequence navDesc = a.getText(
R.styleable.Toolbar_navigationContentDescription);
if (!TextUtils.isEmpty(navDesc)) {
setNavigationContentDescription(navDesc);
}
}
a.recycle();
}

View File

@@ -7322,6 +7322,8 @@
<!-- Reference to a theme that should be used to inflate popups
shown by widgets in the toolbar. -->
<attr name="popupTheme" format="reference" />
<attr name="navigationIcon" format="reference" />
<attr name="navigationContentDescription" format="string|reference" />
</declare-styleable>
<declare-styleable name="Toolbar_LayoutParams">

View File

@@ -2280,6 +2280,8 @@
<public type="attr" name="reparentWithOverlay" />
<public type="attr" name="ambientShadowAlpha" />
<public type="attr" name="spotShadowAlpha" />
<public type="attr" name="navigationIcon" />
<public type="attr" name="navigationContentDescription" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />