diff options
author | Alan Viverette <alanv@google.com> | 2014-10-29 11:03:35 -0700 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-10-29 11:03:35 -0700 |
commit | 3abf5c4bd167547b7e995f1b14ae1bae210c5fec (patch) | |
tree | a30b061e86560cee914f67b3acac732fb29aaa75 /core/java/com | |
parent | db41880dd3259646b9ea43be6d8a91d4adb40122 (diff) | |
download | frameworks_base-3abf5c4bd167547b7e995f1b14ae1bae210c5fec.zip frameworks_base-3abf5c4bd167547b7e995f1b14ae1bae210c5fec.tar.gz frameworks_base-3abf5c4bd167547b7e995f1b14ae1bae210c5fec.tar.bz2 |
Use action mode context for ActionMode menu inflater
BUG: 18078900
Change-Id: Iff837e741dde79a565f1e8c83846ee6155da179e
Diffstat (limited to 'core/java/com')
-rw-r--r-- | core/java/com/android/internal/app/WindowDecorActionBar.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/core/java/com/android/internal/app/WindowDecorActionBar.java b/core/java/com/android/internal/app/WindowDecorActionBar.java index 785b303..d95f0e5 100644 --- a/core/java/com/android/internal/app/WindowDecorActionBar.java +++ b/core/java/com/android/internal/app/WindowDecorActionBar.java @@ -876,7 +876,7 @@ public class WindowDecorActionBar extends ActionBar implements currentTheme.resolveAttribute(com.android.internal.R.attr.actionBarWidgetTheme, outValue, true); final int targetThemeRes = outValue.resourceId; - + if (targetThemeRes != 0 && mContext.getThemeResId() != targetThemeRes) { mThemedContext = new ContextThemeWrapper(mContext, targetThemeRes); } else { @@ -885,7 +885,7 @@ public class WindowDecorActionBar extends ActionBar implements } return mThemedContext; } - + @Override public boolean isTitleTruncated() { return mDecorToolbar != null && mDecorToolbar.isTitleTruncated(); @@ -933,14 +933,17 @@ public class WindowDecorActionBar extends ActionBar implements } /** - * @hide + * @hide */ public class ActionModeImpl extends ActionMode implements MenuBuilder.Callback { + private final Context mActionModeContext; + private final MenuBuilder mMenu; + private ActionMode.Callback mCallback; - private MenuBuilder mMenu; private WeakReference<View> mCustomView; - + public ActionModeImpl(Context context, ActionMode.Callback callback) { + mActionModeContext = context; mCallback = callback; mMenu = new MenuBuilder(context) .setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); @@ -949,7 +952,7 @@ public class WindowDecorActionBar extends ActionBar implements @Override public MenuInflater getMenuInflater() { - return new MenuInflater(getThemedContext()); + return new MenuInflater(mActionModeContext); } @Override @@ -1042,7 +1045,7 @@ public class WindowDecorActionBar extends ActionBar implements public CharSequence getSubtitle() { return mContextView.getSubtitle(); } - + @Override public void setTitleOptionalHint(boolean titleOptional) { super.setTitleOptionalHint(titleOptional); |