Merge "Fix bug 5386180 - Wire up action bar home/up for dialogs"
This commit is contained in:
@@ -132,6 +132,8 @@ public class ActionBarView extends AbsActionBarView {
|
||||
private ExpandedActionViewMenuPresenter mExpandedMenuPresenter;
|
||||
View mExpandedActionView;
|
||||
|
||||
Window.Callback mWindowCallback;
|
||||
|
||||
private final AdapterView.OnItemSelectedListener mNavItemSelectedListener =
|
||||
new AdapterView.OnItemSelectedListener() {
|
||||
public void onItemSelected(AdapterView parent, View view, int position, long id) {
|
||||
@@ -156,11 +158,7 @@ public class ActionBarView extends AbsActionBarView {
|
||||
|
||||
private final OnClickListener mUpClickListener = new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Context context = getContext();
|
||||
if (context instanceof Activity) {
|
||||
Activity activity = (Activity) context;
|
||||
activity.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem);
|
||||
}
|
||||
mWindowCallback.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -275,6 +273,14 @@ public class ActionBarView extends AbsActionBarView {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the window callback used to invoke menu items; used for dispatching home button presses.
|
||||
* @param cb Window callback to dispatch to
|
||||
*/
|
||||
public void setWindowCallback(Window.Callback cb) {
|
||||
mWindowCallback = cb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
@@ -2750,6 +2750,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
} else {
|
||||
mActionBar = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
|
||||
if (mActionBar != null) {
|
||||
mActionBar.setWindowCallback(getCallback());
|
||||
if (mActionBar.getTitle() == null) {
|
||||
mActionBar.setWindowTitle(mTitle);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user