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:
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user