hasCollapsibleActionView was previously checking only that mActionView
was not null, even if the item had a valid ActionProvider that would
later lazily create an action view when prompted. Account for this and
attempt to create the action view if needed when
hasCollapsibleActionView is called.
Bug
8732876
Change-Id: Idf7b329770f686208882509b82a4cb13c70ef32c
@Override
public boolean expandActionView() {
- if ((mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) == 0 || mActionView == null) {
+ if (hasCollapsibleActionView()) {
return false;
}
}
public boolean hasCollapsibleActionView() {
- return (mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) != 0 && mActionView != null;
+ if ((mShowAsAction & SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW) != 0) {
+ if (mActionView == null && mActionProvider != null) {
+ mActionView = mActionProvider.onCreateActionView(this);
+ }
+ return mActionView != null;
+ }
+ return false;
}
public void setActionViewExpanded(boolean isExpanded) {