Merge "Change the CAB to use the up-glyph for closing action modes" into lmp-dev

This commit is contained in:
Adam Powell
2014-09-04 01:18:13 +00:00
committed by Android (Google) Code Review
6 changed files with 26 additions and 10 deletions

View File

@@ -59,6 +59,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
private int mSubtitleStyleRes;
private Drawable mSplitBackground;
private boolean mTitleOptional;
private int mCloseItemLayout;
private Animator mCurrentAnimation;
private boolean mAnimateInOnLayout;
@@ -99,6 +100,10 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
mSplitBackground = a.getDrawable(
com.android.internal.R.styleable.ActionMode_backgroundSplit);
mCloseItemLayout = a.getResourceId(
com.android.internal.R.styleable.ActionMode_closeItemLayout,
R.layout.action_mode_close_item);
a.recycle();
}
@@ -120,7 +125,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
LayoutParams.MATCH_PARENT);
if (!split) {
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(null);
mMenuView.setBackground(null);
final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
if (oldParent != null) oldParent.removeView(mMenuView);
addView(mMenuView, layoutParams);
@@ -134,7 +139,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
layoutParams.width = LayoutParams.MATCH_PARENT;
layoutParams.height = mContentHeight;
mMenuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
mMenuView.setBackgroundDrawable(mSplitBackground);
mMenuView.setBackground(mSplitBackground);
final ViewGroup oldParent = (ViewGroup) mMenuView.getParent();
if (oldParent != null) oldParent.removeView(mMenuView);
mSplitView.addView(mMenuView, layoutParams);
@@ -211,7 +216,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
public void initForMode(final ActionMode mode) {
if (mClose == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
mClose = inflater.inflate(R.layout.action_mode_close_item, this, false);
mClose = inflater.inflate(mCloseItemLayout, this, false);
addView(mClose);
} else if (mClose.getParent() == null) {
addView(mClose);

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
<!-- Copyright (C) 2011 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,6 +14,13 @@
limitations under the License.
-->
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_cab_done_mtrl_alpha"
android:tint="?attr/colorControlNormal" />
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_mode_close_button"
android:focusable="true"
android:clickable="true"
android:paddingStart="8dip"
android:src="?android:attr/actionModeCloseDrawable"
style="?android:attr/actionModeCloseButtonStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginEnd="16dip" />

View File

@@ -7117,6 +7117,8 @@
<attr name="backgroundSplit" />
<!-- Specifies a fixed height for the action mode bar. -->
<attr name="height" />
<!-- Specifies a layout to use for the "close" item at the starting edge. -->
<attr name="closeItemLayout" format="reference" />
</declare-styleable>
<declare-styleable name="SearchView">

View File

@@ -838,7 +838,7 @@ please see styles_device_defaults.xml.
</style>
<style name="Widget.Material.ActionButton.CloseMode">
<item name="background">@drawable/btn_cab_done_material</item>
<item name="background">?attr/selectableItemBackgroundBorderless</item>
</style>
<style name="Widget.Material.ActionButton.Overflow">
@@ -901,6 +901,7 @@ please see styles_device_defaults.xml.
<style name="Widget.Material.ActionMode" parent="Widget.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Material.Widget.ActionMode.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Material.Widget.ActionMode.Subtitle</item>
<item name="closeItemLayout">@layout/action_mode_close_item_material</item>
</style>
<style name="Widget.Material.FastScroll" parent="Widget.FastScroll">

View File

@@ -2001,4 +2001,5 @@
<java-symbol type="id" name="parentMatrix" />
<java-symbol type="bool" name="config_auto_attach_data_on_creation" />
<java-symbol type="id" name="date_picker_month_day_year_layout" />
<java-symbol type="attr" name="closeItemLayout" />
</resources>

View File

@@ -306,7 +306,7 @@ please see themes_device_defaults.xml.
<item name="actionOverflowMenuStyle">@style/Widget.Material.PopupMenu.Overflow</item>
<item name="actionModeBackground">@drawable/cab_background_top_material</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_material</item>
<item name="actionModeCloseDrawable">@drawable/ic_cab_done_material</item>
<item name="actionModeCloseDrawable">@drawable/ic_ab_back_material</item>
<item name="actionBarTabStyle">@style/Widget.Material.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.Material.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.Material.ActionBar.TabText</item>
@@ -652,7 +652,7 @@ please see themes_device_defaults.xml.
<item name="actionOverflowMenuStyle">@style/Widget.Material.Light.PopupMenu.Overflow</item>
<item name="actionModeBackground">@drawable/cab_background_top_material</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_material</item>
<item name="actionModeCloseDrawable">@drawable/ic_cab_done_material</item>
<item name="actionModeCloseDrawable">@drawable/ic_ab_back_material</item>
<item name="actionBarTabStyle">@style/Widget.Material.Light.ActionBar.TabView</item>
<item name="actionBarTabBarStyle">@style/Widget.Material.Light.ActionBar.TabBar</item>
<item name="actionBarTabTextStyle">@style/Widget.Material.Light.ActionBar.TabText</item>