From b2536cf473a6fc386eea75ab8c97edf3a1ad323b Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 3 Sep 2014 17:17:45 -0700 Subject: Change the CAB to use the up-glyph for closing action modes In an effort to reduce glyph proliferation, change the "done" checkmark from the CAB to the up-navigation arrow, placing the CAB firmly in the current navigation hierarchy. This matches behavior for expandable action views such as SearchView. Allow the use of different CAB "done" layouts by theme; the material layout should not include the "done" text and should use the standard borderless selectable item background. Bug 17372188 Change-Id: Icfb3e0bbc6a718e22ab27f9d520da5fe4eb833e7 --- .../com/android/internal/widget/ActionBarContextView.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'core/java') 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); -- cgit v1.1