summaryrefslogtreecommitdiffstats
path: root/core/java/com
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2011-01-07 11:12:02 -0800
committerAdam Powell <adamp@google.com>2011-01-07 11:33:41 -0800
commitd16c9884bb0bd06f9d7aa1be649226a5df6591ee (patch)
treea6a9a86cc5b98d92d0a692de9775dfaa2ab9b06e /core/java/com
parent81f573de6361b0420b22c857afa7e03df125d1a5 (diff)
downloadframeworks_base-d16c9884bb0bd06f9d7aa1be649226a5df6591ee.zip
frameworks_base-d16c9884bb0bd06f9d7aa1be649226a5df6591ee.tar.gz
frameworks_base-d16c9884bb0bd06f9d7aa1be649226a5df6591ee.tar.bz2
Fix bug 3330223 - onCreateOptionsMenu() unable to getActionView()
immediately after orientation change Inflate action view layout resource earlier so that calls to getActionView are valid immediately after menu inflation. Change-Id: I8023328b1a77670ac42a783f6e4b46aa5c2a798e
Diffstat (limited to 'core/java/com')
-rw-r--r--core/java/com/android/internal/view/menu/ActionMenuView.java11
-rw-r--r--core/java/com/android/internal/view/menu/MenuItemImpl.java9
2 files changed, 3 insertions, 17 deletions
diff --git a/core/java/com/android/internal/view/menu/ActionMenuView.java b/core/java/com/android/internal/view/menu/ActionMenuView.java
index f927fae..2c5baba 100644
--- a/core/java/com/android/internal/view/menu/ActionMenuView.java
+++ b/core/java/com/android/internal/view/menu/ActionMenuView.java
@@ -187,17 +187,6 @@ public class ActionMenuView extends LinearLayout implements MenuBuilder.ItemInvo
final MenuItemImpl itemData = itemsToShow.get(i);
View actionView = itemData.getActionView();
- if (actionView == null) {
- // Check for a layout ID instead
- final int layoutId = itemData.getActionViewId();
- if (layoutId != 0) {
- LayoutInflater inflater = LayoutInflater.from(getContext());
- actionView = inflater.inflate(layoutId, this, false);
- itemData.setActionView(0);
- itemData.setActionView(actionView);
- }
- }
-
if (actionView != null) {
final ViewParent parent = actionView.getParent();
if (parent instanceof ViewGroup) {
diff --git a/core/java/com/android/internal/view/menu/MenuItemImpl.java b/core/java/com/android/internal/view/menu/MenuItemImpl.java
index 9faffe5..e1aa385 100644
--- a/core/java/com/android/internal/view/menu/MenuItemImpl.java
+++ b/core/java/com/android/internal/view/menu/MenuItemImpl.java
@@ -83,7 +83,6 @@ public final class MenuItemImpl implements MenuItem {
private int mShowAsAction = SHOW_AS_ACTION_NEVER;
private View mActionView;
- private int mActionViewId;
/** Used for the icon resource ID if this item does not have an icon */
static final int NO_ICON = 0;
@@ -696,15 +695,13 @@ public final class MenuItemImpl implements MenuItem {
}
public MenuItem setActionView(int resId) {
- mActionViewId = resId;
+ LayoutInflater inflater = LayoutInflater.from(mMenu.getContext());
+ ViewGroup parent = (ViewGroup) mMenu.getMenuView(MenuBuilder.TYPE_ACTION_BUTTON, null);
+ setActionView(inflater.inflate(resId, parent, false));
return this;
}
public View getActionView() {
return mActionView;
}
-
- public int getActionViewId() {
- return mActionViewId;
- }
}