Merge "Add content description to Toolbar collapse button" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7a0ae7ed31
@@ -402,6 +402,7 @@ package android {
|
|||||||
field public static final int closeIcon = 16843905; // 0x1010481
|
field public static final int closeIcon = 16843905; // 0x1010481
|
||||||
field public static final int codes = 16843330; // 0x1010242
|
field public static final int codes = 16843330; // 0x1010242
|
||||||
field public static final int collapseColumns = 16843083; // 0x101014b
|
field public static final int collapseColumns = 16843083; // 0x101014b
|
||||||
|
field public static final int collapseContentDescription = 16844034; // 0x1010502
|
||||||
field public static final int color = 16843173; // 0x10101a5
|
field public static final int color = 16843173; // 0x10101a5
|
||||||
field public static final int colorAccent = 16843829; // 0x1010435
|
field public static final int colorAccent = 16843829; // 0x1010435
|
||||||
field public static final int colorActivatedHighlight = 16843664; // 0x1010390
|
field public static final int colorActivatedHighlight = 16843664; // 0x1010390
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ public class Toolbar extends ViewGroup {
|
|||||||
private ImageView mLogoView;
|
private ImageView mLogoView;
|
||||||
|
|
||||||
private Drawable mCollapseIcon;
|
private Drawable mCollapseIcon;
|
||||||
|
private CharSequence mCollapseDescription;
|
||||||
private ImageButton mCollapseButtonView;
|
private ImageButton mCollapseButtonView;
|
||||||
View mExpandedActionView;
|
View mExpandedActionView;
|
||||||
|
|
||||||
@@ -238,6 +239,7 @@ public class Toolbar extends ViewGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mCollapseIcon = a.getDrawable(R.styleable.Toolbar_collapseIcon);
|
mCollapseIcon = a.getDrawable(R.styleable.Toolbar_collapseIcon);
|
||||||
|
mCollapseDescription = a.getText(R.styleable.Toolbar_collapseContentDescription);
|
||||||
|
|
||||||
final CharSequence title = a.getText(R.styleable.Toolbar_title);
|
final CharSequence title = a.getText(R.styleable.Toolbar_title);
|
||||||
if (!TextUtils.isEmpty(title)) {
|
if (!TextUtils.isEmpty(title)) {
|
||||||
@@ -998,6 +1000,7 @@ public class Toolbar extends ViewGroup {
|
|||||||
if (mCollapseButtonView == null) {
|
if (mCollapseButtonView == null) {
|
||||||
mCollapseButtonView = new ImageButton(getContext(), null, 0, mNavButtonStyle);
|
mCollapseButtonView = new ImageButton(getContext(), null, 0, mNavButtonStyle);
|
||||||
mCollapseButtonView.setImageDrawable(mCollapseIcon);
|
mCollapseButtonView.setImageDrawable(mCollapseIcon);
|
||||||
|
mCollapseButtonView.setContentDescription(mCollapseDescription);
|
||||||
final LayoutParams lp = generateDefaultLayoutParams();
|
final LayoutParams lp = generateDefaultLayoutParams();
|
||||||
lp.gravity = Gravity.START | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
|
lp.gravity = Gravity.START | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
|
||||||
lp.mViewType = LayoutParams.EXPANDED;
|
lp.mViewType = LayoutParams.EXPANDED;
|
||||||
|
|||||||
@@ -99,7 +99,8 @@
|
|||||||
android:paddingStart="12dp"
|
android:paddingStart="12dp"
|
||||||
android:paddingEnd="12dp"
|
android:paddingEnd="12dp"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingBottom="8dp">
|
android:paddingBottom="8dp"
|
||||||
|
android:gravity="bottom">
|
||||||
<Button android:id="@+id/button3"
|
<Button android:id="@+id/button3"
|
||||||
style="?attr/buttonBarNeutralButtonStyle"
|
style="?attr/buttonBarNeutralButtonStyle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -7460,7 +7460,10 @@
|
|||||||
<!-- Push object to the bottom of its container, not changing its size. -->
|
<!-- Push object to the bottom of its container, not changing its size. -->
|
||||||
<flag name="bottom" value="0x50" />
|
<flag name="bottom" value="0x50" />
|
||||||
</attr>
|
</attr>
|
||||||
|
<!-- Icon drawable to use for the collapse button. -->
|
||||||
<attr name="collapseIcon" format="reference" />
|
<attr name="collapseIcon" format="reference" />
|
||||||
|
<!-- Text to set as the content description for the collapse button. -->
|
||||||
|
<attr name="collapseContentDescription" format="string" />
|
||||||
<!-- Reference to a theme that should be used to inflate popups
|
<!-- Reference to a theme that should be used to inflate popups
|
||||||
shown by widgets in the toolbar. -->
|
shown by widgets in the toolbar. -->
|
||||||
<attr name="popupTheme" format="reference" />
|
<attr name="popupTheme" format="reference" />
|
||||||
|
|||||||
@@ -2589,6 +2589,13 @@
|
|||||||
|
|
||||||
<!-- @hide -->
|
<!-- @hide -->
|
||||||
<public-padding type="attr" name="private_resource_pad" end="0x01010500" />
|
<public-padding type="attr" name="private_resource_pad" end="0x01010500" />
|
||||||
|
|
||||||
|
<!-- ===============================================================
|
||||||
|
Resources added in version 22 of the platform
|
||||||
|
=============================================================== -->
|
||||||
|
<eat-comment />
|
||||||
|
|
||||||
<public type="attr" name="resizeClip"/>
|
<public type="attr" name="resizeClip"/>
|
||||||
|
<public type="attr" name="collapseContentDescription"/>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -4902,4 +4902,7 @@
|
|||||||
|
|
||||||
<!-- Zen mode condition: no exit criteria. [CHAR LIMIT=NONE] -->
|
<!-- Zen mode condition: no exit criteria. [CHAR LIMIT=NONE] -->
|
||||||
<string name="zen_mode_forever">Indefinitely</string>
|
<string name="zen_mode_forever">Indefinitely</string>
|
||||||
|
|
||||||
|
<!-- Content description for the Toolbar icon used to collapse an expanded action mode. [CHAR LIMIT=NONE] -->
|
||||||
|
<string name="toolbar_collapse_description">Collapse</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1218,6 +1218,7 @@ please see styles_device_defaults.xml.
|
|||||||
<item name="buttonGravity">top</item>
|
<item name="buttonGravity">top</item>
|
||||||
<item name="navigationButtonStyle">@style/Widget.Toolbar.Button.Navigation</item>
|
<item name="navigationButtonStyle">@style/Widget.Toolbar.Button.Navigation</item>
|
||||||
<item name="collapseIcon">?attr/homeAsUpIndicator</item>
|
<item name="collapseIcon">?attr/homeAsUpIndicator</item>
|
||||||
|
<item name="collapseContentDescription">@string/toolbar_collapse_description</item>
|
||||||
<item name="contentInsetStart">16dp</item>
|
<item name="contentInsetStart">16dp</item>
|
||||||
<item name="touchscreenBlocksFocus">true</item>
|
<item name="touchscreenBlocksFocus">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user