Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8917838b authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5386180 - Wire up action bar home/up for dialogs"

parents edb8b627 915ce0d9
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -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();
+1 −0
Original line number Diff line number Diff line
@@ -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);
                    }