diff options
author | Adam Powell <adamp@google.com> | 2014-09-04 01:18:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-04 01:18:14 +0000 |
commit | 4ef16eaa8db55b758ac8f8a0702b69c6124f84ae (patch) | |
tree | 25c540584c433877b46ca5693ef67e90f07560a5 | |
parent | 3bdda955a17676f689d484a1070f9b0ad5d34365 (diff) | |
parent | b2536cf473a6fc386eea75ab8c97edf3a1ad323b (diff) | |
download | frameworks_base-4ef16eaa8db55b758ac8f8a0702b69c6124f84ae.zip frameworks_base-4ef16eaa8db55b758ac8f8a0702b69c6124f84ae.tar.gz frameworks_base-4ef16eaa8db55b758ac8f8a0702b69c6124f84ae.tar.bz2 |
Merge "Change the CAB to use the up-glyph for closing action modes" into lmp-dev
-rw-r--r-- | core/java/com/android/internal/widget/ActionBarContextView.java | 11 | ||||
-rw-r--r-- | core/res/res/layout/action_mode_close_item_material.xml (renamed from core/res/res/drawable/ic_cab_done_material.xml) | 15 | ||||
-rw-r--r-- | core/res/res/values/attrs.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/styles_material.xml | 3 | ||||
-rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
-rw-r--r-- | core/res/res/values/themes_material.xml | 4 |
6 files changed, 26 insertions, 10 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index c7ac815..062a9b1 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -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); diff --git a/core/res/res/drawable/ic_cab_done_material.xml b/core/res/res/layout/action_mode_close_item_material.xml index a370288..8eb780b 100644 --- a/core/res/res/drawable/ic_cab_done_material.xml +++ b/core/res/res/layout/action_mode_close_item_material.xml @@ -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" /> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 95fdae1..a5a0e30 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -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"> diff --git a/core/res/res/values/styles_material.xml b/core/res/res/values/styles_material.xml index 452ee11..77484e6 100644 --- a/core/res/res/values/styles_material.xml +++ b/core/res/res/values/styles_material.xml @@ -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"> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 7ddeea9..1b0f9c4 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -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> diff --git a/core/res/res/values/themes_material.xml b/core/res/res/values/themes_material.xml index 2296a12..ab5cd5a 100644 --- a/core/res/res/values/themes_material.xml +++ b/core/res/res/values/themes_material.xml @@ -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> |