Merge "Handle callbacks to CollapsibleActionViews that are in an actionLayout."
This commit is contained in:
committed by
Android (Google) Code Review
commit
377fe39329
@@ -330,9 +330,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
@Override
|
||||
public void clearFocus() {
|
||||
mClearingFocus = true;
|
||||
setImeVisibility(false);
|
||||
super.clearFocus();
|
||||
mQueryTextView.clearFocus();
|
||||
setImeVisibility(false);
|
||||
mClearingFocus = false;
|
||||
}
|
||||
|
||||
@@ -1041,8 +1041,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView {
|
||||
*/
|
||||
@Override
|
||||
public void onActionViewCollapsed() {
|
||||
clearFocus();
|
||||
updateViewsVisibility(true);
|
||||
mQueryTextView.setText("");
|
||||
setIconified(true);
|
||||
mExpandedInActionView = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -563,7 +563,7 @@ public final class MenuItemImpl implements MenuItem {
|
||||
public MenuItem setActionView(int resId) {
|
||||
final Context context = mMenu.getContext();
|
||||
final LayoutInflater inflater = LayoutInflater.from(context);
|
||||
setActionView(inflater.inflate(resId, new LinearLayout(context)));
|
||||
setActionView(inflater.inflate(resId, new LinearLayout(context), false));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1323,11 +1323,18 @@ public class ActionBarView extends AbsActionBarView {
|
||||
if (mExpandedActionView instanceof CollapsibleActionView) {
|
||||
((CollapsibleActionView) mExpandedActionView).onActionViewExpanded();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean collapseItemActionView(MenuBuilder menu, MenuItemImpl item) {
|
||||
// Do this before detaching the actionview from the hierarchy, in case
|
||||
// it needs to dismiss the soft keyboard, etc.
|
||||
if (mExpandedActionView instanceof CollapsibleActionView) {
|
||||
((CollapsibleActionView) mExpandedActionView).onActionViewCollapsed();
|
||||
}
|
||||
|
||||
removeView(mExpandedActionView);
|
||||
removeView(mExpandedHomeLayout);
|
||||
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
|
||||
@@ -1349,16 +1356,12 @@ public class ActionBarView extends AbsActionBarView {
|
||||
if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
|
||||
mCustomNavView.setVisibility(VISIBLE);
|
||||
}
|
||||
View collapsedView = mExpandedActionView;
|
||||
mExpandedActionView = null;
|
||||
mExpandedHomeLayout.setIcon(null);
|
||||
mCurrentExpandedItem = null;
|
||||
requestLayout();
|
||||
item.setActionViewExpanded(false);
|
||||
|
||||
if (collapsedView instanceof CollapsibleActionView) {
|
||||
((CollapsibleActionView) collapsedView).onActionViewCollapsed();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user