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

Commit 5352a89e authored by Adam Powell's avatar Adam Powell
Browse files

Unify code paths for collapsing action views in action bars

This reverts a well-intentioned bugfix that made
ActionBarOverlayLayout focusable in touch mode and caused issues with
some activity layouts. Removes the associated key handling code for
the Back key in ActionBarOverlayLayout and handles it at a higher
level in Activity instead. (This same code path was already in use by
ToolbarActionBar.)

Bug 17105724

Change-Id: I57e4cace44a6d11f25a2549644b565446d616a52
parent 3f38f72a
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -925,6 +925,15 @@ public class WindowDecorActionBar extends ActionBar implements
    public void onContentScrollStopped() {
    }

    @Override
    public boolean collapseActionView() {
        if (mDecorToolbar != null && mDecorToolbar.hasExpandedActionView()) {
            mDecorToolbar.collapseActionView();
            return true;
        }
        return false;
    }

    /**
     * @hide 
     */
+0 −23
Original line number Diff line number Diff line
@@ -184,8 +184,6 @@ public class ActionBarOverlayLayout extends ViewGroup implements DecorContentPar
                Build.VERSION_CODES.KITKAT;

        mFlingEstimator = new OverScroller(context);

        setFocusableInTouchMode(true);
    }

    @Override
@@ -660,27 +658,6 @@ public class ActionBarOverlayLayout extends ViewGroup implements DecorContentPar
        return finalY > mActionBarTop.getHeight();
    }

    @Override
    public boolean dispatchKeyEvent(KeyEvent event) {
        if (super.dispatchKeyEvent(event)) {
            return true;
        }

        if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
            final int action = event.getAction();

            // Collapse any expanded action views.
            if (mDecorToolbar != null && mDecorToolbar.hasExpandedActionView()) {
                if (action == KeyEvent.ACTION_UP) {
                    mDecorToolbar.collapseActionView();
                }
                return true;
            }
        }

        return false;
    }

    @Override
    public void setWindowCallback(Window.Callback cb) {
        pullChildren();