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;
|
private ExpandedActionViewMenuPresenter mExpandedMenuPresenter;
|
||||||
View mExpandedActionView;
|
View mExpandedActionView;
|
||||||
|
|
||||||
|
Window.Callback mWindowCallback;
|
||||||
|
|
||||||
private final AdapterView.OnItemSelectedListener mNavItemSelectedListener =
|
private final AdapterView.OnItemSelectedListener mNavItemSelectedListener =
|
||||||
new AdapterView.OnItemSelectedListener() {
|
new AdapterView.OnItemSelectedListener() {
|
||||||
public void onItemSelected(AdapterView parent, View view, int position, long id) {
|
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() {
|
private final OnClickListener mUpClickListener = new OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Context context = getContext();
|
mWindowCallback.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mLogoNavItem);
|
||||||
if (context instanceof Activity) {
|
|
||||||
Activity activity = (Activity) context;
|
|
||||||
activity.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
|
@Override
|
||||||
public void onDetachedFromWindow() {
|
public void onDetachedFromWindow() {
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
|
|||||||
@@ -2750,6 +2750,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
|||||||
} else {
|
} else {
|
||||||
mActionBar = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
|
mActionBar = (ActionBarView) findViewById(com.android.internal.R.id.action_bar);
|
||||||
if (mActionBar != null) {
|
if (mActionBar != null) {
|
||||||
|
mActionBar.setWindowCallback(getCallback());
|
||||||
if (mActionBar.getTitle() == null) {
|
if (mActionBar.getTitle() == null) {
|
||||||
mActionBar.setWindowTitle(mTitle);
|
mActionBar.setWindowTitle(mTitle);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user