diff options
| author | Adam Powell <adamp@google.com> | 2010-08-16 18:01:21 -0700 |
|---|---|---|
| committer | Adam Powell <adamp@google.com> | 2010-08-16 18:02:58 -0700 |
| commit | fbb72fdbe58142e0f1f7ffa17f009b0d829b33c3 (patch) | |
| tree | cfca1ad413ea22f2b1e2363dbd39207cff6a9bd4 /core/java/android/view/MenuInflater.java | |
| parent | 6236d61400b5a801547bebd6417b1f936fe12474 (diff) | |
Fix bug 2923440 - ActionMode buttons show as action by default
The MenuInflater returned by ActionModes will set the default
showAsAction value to "ifRoom" if not otherwise specified.
Change-Id: I86045dc4e877a97a3464a1a5f44d8d1e2120b086
Diffstat (limited to 'core/java/android/view/MenuInflater.java')
| -rw-r--r-- | core/java/android/view/MenuInflater.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/view/MenuInflater.java b/core/java/android/view/MenuInflater.java index a959e0d45e6e..43512740e099 100644 --- a/core/java/android/view/MenuInflater.java +++ b/core/java/android/view/MenuInflater.java @@ -53,14 +53,24 @@ public class MenuInflater { private static final int NO_ID = 0; private Context mContext; - + + private int mDefaultShowAsAction; + /** * Constructs a menu inflater. * * @see Activity#getMenuInflater() */ public MenuInflater(Context context) { + this(context, MenuItem.SHOW_AS_ACTION_NEVER); + } + + /** + * @hide used internally to change the default showAsAction setting in action modes + */ + public MenuInflater(Context context, int defaultShowAsAction) { mContext = context; + mDefaultShowAsAction = defaultShowAsAction; } /** @@ -247,7 +257,7 @@ public class MenuInflater { * - 1: ifRoom * - 2: always */ - private int itemShowAsAction = MenuItem.SHOW_AS_ACTION_NEVER; + private int itemShowAsAction; private String itemListenerMethodName; @@ -262,6 +272,7 @@ public class MenuInflater { public MenuState(final Menu menu) { this.menu = menu; + this.itemShowAsAction = mDefaultShowAsAction; resetGroup(); } |
