Clean up some options menu/action bar menu handling for Dialogs.

Add Dialog#invalidateOptionsMenu so that dialogs hosting action bars
have a way to request a refresh of menu content.

Change-Id: I73aa22c2df1c5e60b94035e30af548f87073dbb9
This commit is contained in:
Adam Powell
2010-08-17 17:28:56 -07:00
parent b04f7ad90b
commit e67a9dc83d
2 changed files with 21 additions and 0 deletions

View File

@@ -26619,6 +26619,17 @@
visibility="public"
>
</method>
<method name="invalidateOptionsMenu"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
</method>
<method name="isShowing"
return="boolean"
abstract="false"

View File

@@ -228,6 +228,9 @@ public class Dialog implements DialogInterface, Window.Callback,
public void show() {
if (mShowing) {
if (mDecor != null) {
if (mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) {
mWindow.invalidatePanelMenu(Window.FEATURE_ACTION_BAR);
}
mDecor.setVisibility(View.VISIBLE);
}
return;
@@ -791,6 +794,13 @@ public class Dialog implements DialogInterface, Window.Callback,
mWindow.closePanel(Window.FEATURE_OPTIONS_PANEL);
}
/**
* @see Activity#invalidateOptionsMenu()
*/
public void invalidateOptionsMenu() {
mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
}
/**
* @see Activity#onCreateContextMenu(ContextMenu, View, ContextMenuInfo)
*/