diff options
| -rw-r--r-- | core/java/android/view/LayoutInflater.java | 4 | ||||
| -rw-r--r-- | core/java/com/android/internal/view/StandaloneActionMode.java | 7 | ||||
| -rw-r--r-- | core/res/res/layout/screen.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_custom_title.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_progress.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_simple.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_simple_overlay_action_mode.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_title.xml | 3 | ||||
| -rw-r--r-- | core/res/res/layout/screen_title_icons.xml | 3 | ||||
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 34 |
10 files changed, 45 insertions, 21 deletions
diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 577415e9f7d8..5f3704224ef9 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -606,9 +606,9 @@ public abstract class LayoutInflater { constructor.setAccessible(true); final View view = constructor.newInstance(args); if (view instanceof ViewStub) { - // always use ourselves when inflating ViewStub later + // Use the same context when inflating ViewStub later. final ViewStub viewStub = (ViewStub) view; - viewStub.setLayoutInflater(this); + viewStub.setLayoutInflater(cloneInContext((Context) args[0])); } return view; diff --git a/core/java/com/android/internal/view/StandaloneActionMode.java b/core/java/com/android/internal/view/StandaloneActionMode.java index fae7ea12fd83..d5d360243e01 100644 --- a/core/java/com/android/internal/view/StandaloneActionMode.java +++ b/core/java/com/android/internal/view/StandaloneActionMode.java @@ -46,7 +46,8 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call mContextView = view; mCallback = callback; - mMenu = new MenuBuilder(context).setDefaultShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); + mMenu = new MenuBuilder(view.getContext()).setDefaultShowAsAction( + MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.setCallback(this); mFocusable = isFocusable; } @@ -126,7 +127,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call @Override public MenuInflater getMenuInflater() { - return new MenuInflater(mContext); + return new MenuInflater(mContextView.getContext()); } public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) { @@ -141,7 +142,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call return true; } - new MenuPopupHelper(mContext, subMenu).show(); + new MenuPopupHelper(mContextView.getContext(), subMenu).show(); return true; } diff --git a/core/res/res/layout/screen.xml b/core/res/res/layout/screen.xml index 902a797fdadc..403ffd63debb 100644 --- a/core/res/res/layout/screen.xml +++ b/core/res/res/layout/screen.xml @@ -30,7 +30,8 @@ This is the basic layout for a screen, with all of its features enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> <!-- Title bar --> <RelativeLayout android:id="@android:id/title_container" diff --git a/core/res/res/layout/screen_custom_title.xml b/core/res/res/layout/screen_custom_title.xml index b385bed36234..a3312dcf7867 100644 --- a/core/res/res/layout/screen_custom_title.xml +++ b/core/res/res/layout/screen_custom_title.xml @@ -26,7 +26,8 @@ This is a custom layout for a screen. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> <FrameLayout android:id="@android:id/title_container" android:layout_width="match_parent" diff --git a/core/res/res/layout/screen_progress.xml b/core/res/res/layout/screen_progress.xml index 1f04d35758e7..e70f2ec0a372 100644 --- a/core/res/res/layout/screen_progress.xml +++ b/core/res/res/layout/screen_progress.xml @@ -31,7 +31,8 @@ This is the basic layout for a screen, with all of its features enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> <RelativeLayout android:id="@android:id/title_container" style="?android:attr/windowTitleBackgroundStyle" diff --git a/core/res/res/layout/screen_simple.xml b/core/res/res/layout/screen_simple.xml index c1914e7964b9..6111348acd08 100644 --- a/core/res/res/layout/screen_simple.xml +++ b/core/res/res/layout/screen_simple.xml @@ -30,7 +30,8 @@ enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> <FrameLayout android:id="@android:id/content" android:layout_width="match_parent" diff --git a/core/res/res/layout/screen_simple_overlay_action_mode.xml b/core/res/res/layout/screen_simple_overlay_action_mode.xml index c790d10c529e..52b893b316d4 100644 --- a/core/res/res/layout/screen_simple_overlay_action_mode.xml +++ b/core/res/res/layout/screen_simple_overlay_action_mode.xml @@ -35,5 +35,6 @@ enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> </FrameLayout> diff --git a/core/res/res/layout/screen_title.xml b/core/res/res/layout/screen_title.xml index f5134f9faba7..409e9c6ec2b3 100644 --- a/core/res/res/layout/screen_title.xml +++ b/core/res/res/layout/screen_title.xml @@ -27,7 +27,8 @@ enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme" /> <FrameLayout android:layout_width="match_parent" android:layout_height="?android:attr/windowTitleSize" diff --git a/core/res/res/layout/screen_title_icons.xml b/core/res/res/layout/screen_title_icons.xml index b866e57f9347..f145429b4702 100644 --- a/core/res/res/layout/screen_title_icons.xml +++ b/core/res/res/layout/screen_title_icons.xml @@ -28,7 +28,8 @@ This is the basic layout for a screen, with all of its features enabled. android:inflatedId="@+id/action_mode_bar" android:layout="@layout/action_mode_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + android:theme="?attr/actionBarTheme"/> <RelativeLayout android:id="@android:id/title_container" style="?android:attr/windowTitleBackgroundStyle" android:layout_width="match_parent" diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index c5168744415d..737b1cd136b7 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2643,19 +2643,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() { @@ -2676,8 +2692,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); |