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
This commit is contained in:
Adam Powell
2014-08-20 17:33:24 -07:00
parent 3f38f72a1b
commit 5352a89e8a
2 changed files with 9 additions and 23 deletions

View File

@@ -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
*/

View File

@@ -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();