diff options
author | Alan Viverette <alanv@google.com> | 2014-09-18 20:57:26 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-18 20:57:26 +0000 |
commit | 194206c4d7ec9b7e519b8e72e234514abbf0c9cd (patch) | |
tree | e8af2f224753535ea3989f6cb03a2aaae1d7822c /policy/src | |
parent | c5e711eeb2c95c14eeb029863e3ef6f0723ed7e7 (diff) | |
parent | 42f36235affd3cddde16cd53471aad935dfa6564 (diff) | |
download | frameworks_base-194206c4d7ec9b7e519b8e72e234514abbf0c9cd.zip frameworks_base-194206c4d7ec9b7e519b8e72e234514abbf0c9cd.tar.gz frameworks_base-194206c4d7ec9b7e519b8e72e234514abbf0c9cd.tar.bz2 |
am c5073a81: am fb15b0e2: Merge "Use action bar theme for action modes, fix ViewStub inflation theme" into lmp-dev
* commit 'c5073a812a82928ae681c9fcd328a3b1323b4edc':
Use action bar theme for action modes, fix ViewStub inflation theme
Diffstat (limited to 'policy/src')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 57ed619..3419119 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2640,19 +2640,35 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } else { if (mActionModeView == null) { if (isFloating()) { - mActionModeView = new ActionBarContextView(mContext); - mActionModePopup = new PopupWindow(mContext, null, + // Use the action bar theme. + final TypedValue outValue = new TypedValue(); + final Theme baseTheme = mContext.getTheme(); + baseTheme.resolveAttribute(R.attr.actionBarTheme, outValue, true); + + final Context actionBarContext; + if (outValue.resourceId != 0) { + final Theme actionBarTheme = mContext.getResources().newTheme(); + actionBarTheme.setTo(baseTheme); + actionBarTheme.applyStyle(outValue.resourceId, true); + + actionBarContext = new ContextThemeWrapper(mContext, 0); + actionBarContext.getTheme().setTo(actionBarTheme); + } else { + actionBarContext = mContext; + } + + mActionModeView = new ActionBarContextView(actionBarContext); + mActionModePopup = new PopupWindow(actionBarContext, null, R.attr.actionModePopupWindowStyle); mActionModePopup.setWindowLayoutType( WindowManager.LayoutParams.TYPE_APPLICATION); mActionModePopup.setContentView(mActionModeView); mActionModePopup.setWidth(MATCH_PARENT); - TypedValue heightValue = new TypedValue(); - mContext.getTheme().resolveAttribute( - R.attr.actionBarSize, heightValue, true); - final int height = TypedValue.complexToDimensionPixelSize(heightValue.data, - mContext.getResources().getDisplayMetrics()); + actionBarContext.getTheme().resolveAttribute( + R.attr.actionBarSize, outValue, true); + final int height = TypedValue.complexToDimensionPixelSize(outValue.data, + actionBarContext.getResources().getDisplayMetrics()); mActionModeView.setContentHeight(height); mActionModePopup.setHeight(WRAP_CONTENT); mShowActionModePopup = new Runnable() { @@ -2673,8 +2689,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { if (mActionModeView != null) { mActionModeView.killMode(); - mode = new StandaloneActionMode(getContext(), mActionModeView, wrappedCallback, - mActionModePopup == null); + mode = new StandaloneActionMode(mActionModeView.getContext(), mActionModeView, + wrappedCallback, mActionModePopup == null); if (callback.onCreateActionMode(mode, mode.getMenu())) { mode.invalidate(); mActionModeView.initForMode(mode); |