Loading core/java/com/android/internal/widget/ActionBarView.java +9 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -125,6 +124,7 @@ public class ActionBarView extends AbsActionBarView { private boolean mWasHomeEnabled; // Was it enabled before action view expansion? private MenuBuilder mOptionsMenu; private boolean mMenuPrepared; private ActionBarContextView mContextView; Loading Loading @@ -164,8 +164,11 @@ public class ActionBarView extends AbsActionBarView { private final OnClickListener mUpClickListener = new OnClickListener() { public void onClick(View v) { if (mMenuPrepared) { // Only invoke the window callback if the options menu has been initialized. mWindowCallback.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem); } } }; public ActionBarView(Context context, AttributeSet attrs) { Loading Loading @@ -402,6 +405,10 @@ public class ActionBarView extends AbsActionBarView { mCallback = callback; } public void setMenuPrepared() { mMenuPrepared = true; } public void setMenu(Menu menu, MenuPresenter.Callback cb) { if (menu == mOptionsMenu) return; Loading policy/src/com/android/internal/policy/impl/PhoneWindow.java +12 −3 Original line number Diff line number Diff line Loading @@ -380,6 +380,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { st.createdPanelView = cb.onCreatePanelView(st.featureId); } final boolean isActionBarMenu = (st.featureId == FEATURE_OPTIONS_PANEL || st.featureId == FEATURE_ACTION_BAR); if (isActionBarMenu && mActionBar != null) { // Enforce ordering guarantees around events so that the action bar never // dispatches menu-related events before the panel is prepared. mActionBar.setMenuPrepared(); } if (st.createdPanelView == null) { // Init the panel state's menu--return false if init failed if (st.menu == null || st.refreshMenuContent) { Loading @@ -389,7 +398,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { if (mActionMenuPresenterCallback == null) { mActionMenuPresenterCallback = new ActionMenuPresenterCallback(); } Loading @@ -405,7 +414,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Ditch the menu created above st.setMenu(null); if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { // Don't show it in the action bar either mActionBar.setMenu(null, mActionMenuPresenterCallback); } Loading @@ -430,7 +439,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) { if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. mActionBar.setMenu(null, mActionMenuPresenterCallback); Loading Loading
core/java/com/android/internal/widget/ActionBarView.java +9 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,6 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; Loading Loading @@ -125,6 +124,7 @@ public class ActionBarView extends AbsActionBarView { private boolean mWasHomeEnabled; // Was it enabled before action view expansion? private MenuBuilder mOptionsMenu; private boolean mMenuPrepared; private ActionBarContextView mContextView; Loading Loading @@ -164,8 +164,11 @@ public class ActionBarView extends AbsActionBarView { private final OnClickListener mUpClickListener = new OnClickListener() { public void onClick(View v) { if (mMenuPrepared) { // Only invoke the window callback if the options menu has been initialized. mWindowCallback.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem); } } }; public ActionBarView(Context context, AttributeSet attrs) { Loading Loading @@ -402,6 +405,10 @@ public class ActionBarView extends AbsActionBarView { mCallback = callback; } public void setMenuPrepared() { mMenuPrepared = true; } public void setMenu(Menu menu, MenuPresenter.Callback cb) { if (menu == mOptionsMenu) return; Loading
policy/src/com/android/internal/policy/impl/PhoneWindow.java +12 −3 Original line number Diff line number Diff line Loading @@ -380,6 +380,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { st.createdPanelView = cb.onCreatePanelView(st.featureId); } final boolean isActionBarMenu = (st.featureId == FEATURE_OPTIONS_PANEL || st.featureId == FEATURE_ACTION_BAR); if (isActionBarMenu && mActionBar != null) { // Enforce ordering guarantees around events so that the action bar never // dispatches menu-related events before the panel is prepared. mActionBar.setMenuPrepared(); } if (st.createdPanelView == null) { // Init the panel state's menu--return false if init failed if (st.menu == null || st.refreshMenuContent) { Loading @@ -389,7 +398,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } } if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { if (mActionMenuPresenterCallback == null) { mActionMenuPresenterCallback = new ActionMenuPresenterCallback(); } Loading @@ -405,7 +414,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { // Ditch the menu created above st.setMenu(null); if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { // Don't show it in the action bar either mActionBar.setMenu(null, mActionMenuPresenterCallback); } Loading @@ -430,7 +439,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } if (!cb.onPreparePanel(st.featureId, st.createdPanelView, st.menu)) { if (mActionBar != null) { if (isActionBarMenu && mActionBar != null) { // The app didn't want to show the menu for now but it still exists. // Clear it out of the action bar. mActionBar.setMenu(null, mActionMenuPresenterCallback); Loading