694 lines
24 KiB
Java
694 lines
24 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.util.SparseBooleanArray;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.appcompat.R$attr;
|
|
import androidx.appcompat.R$layout;
|
|
import androidx.appcompat.view.ActionBarPolicy;
|
|
import androidx.appcompat.view.menu.ActionMenuItemView;
|
|
import androidx.appcompat.view.menu.BaseMenuPresenter;
|
|
import androidx.appcompat.view.menu.MenuBuilder;
|
|
import androidx.appcompat.view.menu.MenuItemImpl;
|
|
import androidx.appcompat.view.menu.MenuPopupHelper;
|
|
import androidx.appcompat.view.menu.MenuPresenter;
|
|
import androidx.appcompat.view.menu.MenuView;
|
|
import androidx.appcompat.view.menu.ShowableListMenu;
|
|
import androidx.appcompat.view.menu.SubMenuBuilder;
|
|
import androidx.appcompat.widget.ActionMenuView;
|
|
import androidx.core.graphics.drawable.DrawableCompat;
|
|
import androidx.core.view.ActionProvider;
|
|
import java.util.ArrayList;
|
|
|
|
/* loaded from: classes.dex */
|
|
class ActionMenuPresenter extends BaseMenuPresenter implements ActionProvider.SubUiVisibilityListener {
|
|
OpenOverflowRunnable A;
|
|
private ActionMenuPopupCallback B;
|
|
final PopupPresenterCallback C;
|
|
int D;
|
|
OverflowMenuButton i;
|
|
private Drawable j;
|
|
private boolean k;
|
|
private boolean l;
|
|
private boolean m;
|
|
private int n;
|
|
private int o;
|
|
private int p;
|
|
private boolean q;
|
|
private boolean r;
|
|
private boolean s;
|
|
private boolean t;
|
|
private int u;
|
|
private final SparseBooleanArray v;
|
|
private View x;
|
|
OverflowPopup y;
|
|
ActionButtonSubmenu z;
|
|
|
|
private class ActionButtonSubmenu extends MenuPopupHelper {
|
|
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenuBuilder, View view) {
|
|
super(context, subMenuBuilder, view, false, R$attr.actionOverflowMenuStyle);
|
|
if (!((MenuItemImpl) subMenuBuilder.getItem()).h()) {
|
|
View view2 = ActionMenuPresenter.this.i;
|
|
a(view2 == null ? (View) ((BaseMenuPresenter) ActionMenuPresenter.this).h : view2);
|
|
}
|
|
a(ActionMenuPresenter.this.C);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
|
protected void d() {
|
|
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
|
|
actionMenuPresenter.z = null;
|
|
actionMenuPresenter.D = 0;
|
|
super.d();
|
|
}
|
|
}
|
|
|
|
private class ActionMenuPopupCallback extends ActionMenuItemView.PopupCallback {
|
|
ActionMenuPopupCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.ActionMenuItemView.PopupCallback
|
|
public ShowableListMenu a() {
|
|
ActionButtonSubmenu actionButtonSubmenu = ActionMenuPresenter.this.z;
|
|
if (actionButtonSubmenu != null) {
|
|
return actionButtonSubmenu.b();
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private class OpenOverflowRunnable implements Runnable {
|
|
private OverflowPopup a;
|
|
|
|
public OpenOverflowRunnable(OverflowPopup overflowPopup) {
|
|
this.a = overflowPopup;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
if (((BaseMenuPresenter) ActionMenuPresenter.this).c != null) {
|
|
((BaseMenuPresenter) ActionMenuPresenter.this).c.a();
|
|
}
|
|
View view = (View) ((BaseMenuPresenter) ActionMenuPresenter.this).h;
|
|
if (view != null && view.getWindowToken() != null && this.a.f()) {
|
|
ActionMenuPresenter.this.y = this.a;
|
|
}
|
|
ActionMenuPresenter.this.A = null;
|
|
}
|
|
}
|
|
|
|
private class OverflowMenuButton extends AppCompatImageView implements ActionMenuView.ActionMenuChildView {
|
|
public OverflowMenuButton(Context context) {
|
|
super(context, null, R$attr.actionOverflowButtonStyle);
|
|
setClickable(true);
|
|
setFocusable(true);
|
|
setVisibility(0);
|
|
setEnabled(true);
|
|
TooltipCompat.a(this, getContentDescription());
|
|
setOnTouchListener(new ForwardingListener(this, ActionMenuPresenter.this) { // from class: androidx.appcompat.widget.ActionMenuPresenter.OverflowMenuButton.1
|
|
@Override // androidx.appcompat.widget.ForwardingListener
|
|
public ShowableListMenu a() {
|
|
OverflowPopup overflowPopup = ActionMenuPresenter.this.y;
|
|
if (overflowPopup == null) {
|
|
return null;
|
|
}
|
|
return overflowPopup.b();
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ForwardingListener
|
|
public boolean b() {
|
|
ActionMenuPresenter.this.i();
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ForwardingListener
|
|
public boolean c() {
|
|
ActionMenuPresenter actionMenuPresenter = ActionMenuPresenter.this;
|
|
if (actionMenuPresenter.A != null) {
|
|
return false;
|
|
}
|
|
actionMenuPresenter.e();
|
|
return true;
|
|
}
|
|
});
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
|
public boolean b() {
|
|
return false;
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.ActionMenuView.ActionMenuChildView
|
|
public boolean c() {
|
|
return false;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean performClick() {
|
|
if (super.performClick()) {
|
|
return true;
|
|
}
|
|
playSoundEffect(0);
|
|
ActionMenuPresenter.this.i();
|
|
return true;
|
|
}
|
|
|
|
@Override // android.widget.ImageView
|
|
protected boolean setFrame(int i, int i2, int i3, int i4) {
|
|
boolean frame = super.setFrame(i, i2, i3, i4);
|
|
Drawable drawable = getDrawable();
|
|
Drawable background = getBackground();
|
|
if (drawable != null && background != null) {
|
|
int width = getWidth();
|
|
int height = getHeight();
|
|
int max = Math.max(width, height) / 2;
|
|
int paddingLeft = (width + (getPaddingLeft() - getPaddingRight())) / 2;
|
|
int paddingTop = (height + (getPaddingTop() - getPaddingBottom())) / 2;
|
|
DrawableCompat.a(background, paddingLeft - max, paddingTop - max, paddingLeft + max, paddingTop + max);
|
|
}
|
|
return frame;
|
|
}
|
|
}
|
|
|
|
private class OverflowPopup extends MenuPopupHelper {
|
|
public OverflowPopup(Context context, MenuBuilder menuBuilder, View view, boolean z) {
|
|
super(context, menuBuilder, view, z, R$attr.actionOverflowMenuStyle);
|
|
a(8388613);
|
|
a(ActionMenuPresenter.this.C);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPopupHelper
|
|
protected void d() {
|
|
if (((BaseMenuPresenter) ActionMenuPresenter.this).c != null) {
|
|
((BaseMenuPresenter) ActionMenuPresenter.this).c.close();
|
|
}
|
|
ActionMenuPresenter.this.y = null;
|
|
super.d();
|
|
}
|
|
}
|
|
|
|
private static class SavedState implements Parcelable {
|
|
public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { // from class: androidx.appcompat.widget.ActionMenuPresenter.SavedState.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState createFromParcel(Parcel parcel) {
|
|
return new SavedState(parcel);
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public SavedState[] newArray(int i) {
|
|
return new SavedState[i];
|
|
}
|
|
};
|
|
public int openSubMenuId;
|
|
|
|
SavedState() {
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeInt(this.openSubMenuId);
|
|
}
|
|
|
|
SavedState(Parcel parcel) {
|
|
this.openSubMenuId = parcel.readInt();
|
|
}
|
|
}
|
|
|
|
public ActionMenuPresenter(Context context) {
|
|
super(context, R$layout.abc_action_menu_layout, R$layout.abc_action_menu_item_layout);
|
|
this.v = new SparseBooleanArray();
|
|
this.C = new PopupPresenterCallback();
|
|
}
|
|
|
|
public boolean g() {
|
|
return this.A != null || h();
|
|
}
|
|
|
|
public boolean h() {
|
|
OverflowPopup overflowPopup = this.y;
|
|
return overflowPopup != null && overflowPopup.c();
|
|
}
|
|
|
|
public boolean i() {
|
|
MenuBuilder menuBuilder;
|
|
if (!this.l || h() || (menuBuilder = this.c) == null || this.h == null || this.A != null || menuBuilder.j().isEmpty()) {
|
|
return false;
|
|
}
|
|
this.A = new OpenOverflowRunnable(new OverflowPopup(this.b, this.c, this.i, true));
|
|
((View) this.h).post(this.A);
|
|
super.a((SubMenuBuilder) null);
|
|
return true;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
|
public void a(Context context, MenuBuilder menuBuilder) {
|
|
super.a(context, menuBuilder);
|
|
Resources resources = context.getResources();
|
|
ActionBarPolicy a = ActionBarPolicy.a(context);
|
|
if (!this.m) {
|
|
this.l = a.g();
|
|
}
|
|
if (!this.s) {
|
|
this.n = a.b();
|
|
}
|
|
if (!this.q) {
|
|
this.p = a.c();
|
|
}
|
|
int i = this.n;
|
|
if (this.l) {
|
|
if (this.i == null) {
|
|
this.i = new OverflowMenuButton(this.a);
|
|
if (this.k) {
|
|
this.i.setImageDrawable(this.j);
|
|
this.j = null;
|
|
this.k = false;
|
|
}
|
|
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
|
this.i.measure(makeMeasureSpec, makeMeasureSpec);
|
|
}
|
|
i -= this.i.getMeasuredWidth();
|
|
} else {
|
|
this.i = null;
|
|
}
|
|
this.o = i;
|
|
this.u = (int) (resources.getDisplayMetrics().density * 56.0f);
|
|
this.x = null;
|
|
}
|
|
|
|
public void b(boolean z) {
|
|
this.t = z;
|
|
}
|
|
|
|
public void c(boolean z) {
|
|
this.l = z;
|
|
this.m = true;
|
|
}
|
|
|
|
public Drawable d() {
|
|
OverflowMenuButton overflowMenuButton = this.i;
|
|
if (overflowMenuButton != null) {
|
|
return overflowMenuButton.getDrawable();
|
|
}
|
|
if (this.k) {
|
|
return this.j;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public boolean e() {
|
|
Object obj;
|
|
OpenOverflowRunnable openOverflowRunnable = this.A;
|
|
if (openOverflowRunnable != null && (obj = this.h) != null) {
|
|
((View) obj).removeCallbacks(openOverflowRunnable);
|
|
this.A = null;
|
|
return true;
|
|
}
|
|
OverflowPopup overflowPopup = this.y;
|
|
if (overflowPopup == null) {
|
|
return false;
|
|
}
|
|
overflowPopup.a();
|
|
return true;
|
|
}
|
|
|
|
public boolean f() {
|
|
ActionButtonSubmenu actionButtonSubmenu = this.z;
|
|
if (actionButtonSubmenu == null) {
|
|
return false;
|
|
}
|
|
actionButtonSubmenu.a();
|
|
return true;
|
|
}
|
|
|
|
private class PopupPresenterCallback implements MenuPresenter.Callback {
|
|
PopupPresenterCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public boolean a(MenuBuilder menuBuilder) {
|
|
if (menuBuilder == null) {
|
|
return false;
|
|
}
|
|
ActionMenuPresenter.this.D = ((SubMenuBuilder) menuBuilder).getItem().getItemId();
|
|
MenuPresenter.Callback a = ActionMenuPresenter.this.a();
|
|
if (a != null) {
|
|
return a.a(menuBuilder);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public void a(MenuBuilder menuBuilder, boolean z) {
|
|
if (menuBuilder instanceof SubMenuBuilder) {
|
|
menuBuilder.m().a(false);
|
|
}
|
|
MenuPresenter.Callback a = ActionMenuPresenter.this.a();
|
|
if (a != null) {
|
|
a.a(menuBuilder, z);
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
|
public MenuView b(ViewGroup viewGroup) {
|
|
MenuView menuView = this.h;
|
|
MenuView b = super.b(viewGroup);
|
|
if (menuView != b) {
|
|
((ActionMenuView) b).setPresenter(this);
|
|
}
|
|
return b;
|
|
}
|
|
|
|
public boolean c() {
|
|
return e() | f();
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter
|
|
public boolean b() {
|
|
ArrayList<MenuItemImpl> arrayList;
|
|
int i;
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
ActionMenuPresenter actionMenuPresenter = this;
|
|
MenuBuilder menuBuilder = actionMenuPresenter.c;
|
|
int i5 = 0;
|
|
if (menuBuilder != null) {
|
|
arrayList = menuBuilder.n();
|
|
i = arrayList.size();
|
|
} else {
|
|
arrayList = null;
|
|
i = 0;
|
|
}
|
|
int i6 = actionMenuPresenter.p;
|
|
int i7 = actionMenuPresenter.o;
|
|
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
|
ViewGroup viewGroup = (ViewGroup) actionMenuPresenter.h;
|
|
int i8 = i6;
|
|
boolean z = false;
|
|
int i9 = 0;
|
|
int i10 = 0;
|
|
for (int i11 = 0; i11 < i; i11++) {
|
|
MenuItemImpl menuItemImpl = arrayList.get(i11);
|
|
if (menuItemImpl.k()) {
|
|
i9++;
|
|
} else if (menuItemImpl.j()) {
|
|
i10++;
|
|
} else {
|
|
z = true;
|
|
}
|
|
if (actionMenuPresenter.t && menuItemImpl.isActionViewExpanded()) {
|
|
i8 = 0;
|
|
}
|
|
}
|
|
if (actionMenuPresenter.l && (z || i10 + i9 > i8)) {
|
|
i8--;
|
|
}
|
|
int i12 = i8 - i9;
|
|
SparseBooleanArray sparseBooleanArray = actionMenuPresenter.v;
|
|
sparseBooleanArray.clear();
|
|
if (actionMenuPresenter.r) {
|
|
int i13 = actionMenuPresenter.u;
|
|
i3 = i7 / i13;
|
|
i2 = i13 + ((i7 % i13) / i3);
|
|
} else {
|
|
i2 = 0;
|
|
i3 = 0;
|
|
}
|
|
int i14 = i7;
|
|
int i15 = 0;
|
|
int i16 = 0;
|
|
while (i15 < i) {
|
|
MenuItemImpl menuItemImpl2 = arrayList.get(i15);
|
|
if (menuItemImpl2.k()) {
|
|
View a = actionMenuPresenter.a(menuItemImpl2, actionMenuPresenter.x, viewGroup);
|
|
if (actionMenuPresenter.x == null) {
|
|
actionMenuPresenter.x = a;
|
|
}
|
|
if (actionMenuPresenter.r) {
|
|
i3 -= ActionMenuView.a(a, i2, i3, makeMeasureSpec, i5);
|
|
} else {
|
|
a.measure(makeMeasureSpec, makeMeasureSpec);
|
|
}
|
|
int measuredWidth = a.getMeasuredWidth();
|
|
i14 -= measuredWidth;
|
|
if (i16 != 0) {
|
|
measuredWidth = i16;
|
|
}
|
|
int groupId = menuItemImpl2.getGroupId();
|
|
if (groupId != 0) {
|
|
sparseBooleanArray.put(groupId, true);
|
|
}
|
|
menuItemImpl2.d(true);
|
|
i4 = i;
|
|
i16 = measuredWidth;
|
|
} else if (menuItemImpl2.j()) {
|
|
int groupId2 = menuItemImpl2.getGroupId();
|
|
boolean z2 = sparseBooleanArray.get(groupId2);
|
|
boolean z3 = (i12 > 0 || z2) && i14 > 0 && (!actionMenuPresenter.r || i3 > 0);
|
|
boolean z4 = z3;
|
|
if (z3) {
|
|
View a2 = actionMenuPresenter.a(menuItemImpl2, actionMenuPresenter.x, viewGroup);
|
|
i4 = i;
|
|
if (actionMenuPresenter.x == null) {
|
|
actionMenuPresenter.x = a2;
|
|
}
|
|
if (actionMenuPresenter.r) {
|
|
int a3 = ActionMenuView.a(a2, i2, i3, makeMeasureSpec, 0);
|
|
i3 -= a3;
|
|
if (a3 == 0) {
|
|
z4 = false;
|
|
}
|
|
} else {
|
|
a2.measure(makeMeasureSpec, makeMeasureSpec);
|
|
}
|
|
int measuredWidth2 = a2.getMeasuredWidth();
|
|
i14 -= measuredWidth2;
|
|
if (i16 == 0) {
|
|
i16 = measuredWidth2;
|
|
}
|
|
z3 = z4 & (!actionMenuPresenter.r ? i14 + i16 <= 0 : i14 < 0);
|
|
} else {
|
|
i4 = i;
|
|
}
|
|
if (z3 && groupId2 != 0) {
|
|
sparseBooleanArray.put(groupId2, true);
|
|
} else if (z2) {
|
|
sparseBooleanArray.put(groupId2, false);
|
|
for (int i17 = 0; i17 < i15; i17++) {
|
|
MenuItemImpl menuItemImpl3 = arrayList.get(i17);
|
|
if (menuItemImpl3.getGroupId() == groupId2) {
|
|
if (menuItemImpl3.h()) {
|
|
i12++;
|
|
}
|
|
menuItemImpl3.d(false);
|
|
}
|
|
}
|
|
}
|
|
if (z3) {
|
|
i12--;
|
|
}
|
|
menuItemImpl2.d(z3);
|
|
} else {
|
|
i4 = i;
|
|
menuItemImpl2.d(false);
|
|
i15++;
|
|
i5 = 0;
|
|
actionMenuPresenter = this;
|
|
i = i4;
|
|
}
|
|
i15++;
|
|
i5 = 0;
|
|
actionMenuPresenter = this;
|
|
i = i4;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public void a(Configuration configuration) {
|
|
if (!this.q) {
|
|
this.p = ActionBarPolicy.a(this.b).c();
|
|
}
|
|
MenuBuilder menuBuilder = this.c;
|
|
if (menuBuilder != null) {
|
|
menuBuilder.b(true);
|
|
}
|
|
}
|
|
|
|
public void a(Drawable drawable) {
|
|
OverflowMenuButton overflowMenuButton = this.i;
|
|
if (overflowMenuButton != null) {
|
|
overflowMenuButton.setImageDrawable(drawable);
|
|
} else {
|
|
this.k = true;
|
|
this.j = drawable;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
|
public View a(MenuItemImpl menuItemImpl, View view, ViewGroup viewGroup) {
|
|
View actionView = menuItemImpl.getActionView();
|
|
if (actionView == null || menuItemImpl.f()) {
|
|
actionView = super.a(menuItemImpl, view, viewGroup);
|
|
}
|
|
actionView.setVisibility(menuItemImpl.isActionViewExpanded() ? 8 : 0);
|
|
ActionMenuView actionMenuView = (ActionMenuView) viewGroup;
|
|
ViewGroup.LayoutParams layoutParams = actionView.getLayoutParams();
|
|
if (!actionMenuView.checkLayoutParams(layoutParams)) {
|
|
actionView.setLayoutParams(actionMenuView.generateLayoutParams(layoutParams));
|
|
}
|
|
return actionView;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
|
public void a(MenuItemImpl menuItemImpl, MenuView.ItemView itemView) {
|
|
itemView.a(menuItemImpl, 0);
|
|
ActionMenuItemView actionMenuItemView = (ActionMenuItemView) itemView;
|
|
actionMenuItemView.setItemInvoker((ActionMenuView) this.h);
|
|
if (this.B == null) {
|
|
this.B = new ActionMenuPopupCallback();
|
|
}
|
|
actionMenuItemView.setPopupCallback(this.B);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
|
public boolean a(int i, MenuItemImpl menuItemImpl) {
|
|
return menuItemImpl.h();
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
|
public void a(boolean z) {
|
|
super.a(z);
|
|
((View) this.h).requestLayout();
|
|
MenuBuilder menuBuilder = this.c;
|
|
boolean z2 = false;
|
|
if (menuBuilder != null) {
|
|
ArrayList<MenuItemImpl> c = menuBuilder.c();
|
|
int size = c.size();
|
|
for (int i = 0; i < size; i++) {
|
|
ActionProvider a = c.get(i).a();
|
|
if (a != null) {
|
|
a.a(this);
|
|
}
|
|
}
|
|
}
|
|
MenuBuilder menuBuilder2 = this.c;
|
|
ArrayList<MenuItemImpl> j = menuBuilder2 != null ? menuBuilder2.j() : null;
|
|
if (this.l && j != null) {
|
|
int size2 = j.size();
|
|
if (size2 == 1) {
|
|
z2 = !j.get(0).isActionViewExpanded();
|
|
} else if (size2 > 0) {
|
|
z2 = true;
|
|
}
|
|
}
|
|
if (z2) {
|
|
if (this.i == null) {
|
|
this.i = new OverflowMenuButton(this.a);
|
|
}
|
|
ViewGroup viewGroup = (ViewGroup) this.i.getParent();
|
|
if (viewGroup != this.h) {
|
|
if (viewGroup != null) {
|
|
viewGroup.removeView(this.i);
|
|
}
|
|
ActionMenuView actionMenuView = (ActionMenuView) this.h;
|
|
actionMenuView.addView(this.i, actionMenuView.e());
|
|
}
|
|
} else {
|
|
OverflowMenuButton overflowMenuButton = this.i;
|
|
if (overflowMenuButton != null) {
|
|
Object parent = overflowMenuButton.getParent();
|
|
Object obj = this.h;
|
|
if (parent == obj) {
|
|
((ViewGroup) obj).removeView(this.i);
|
|
}
|
|
}
|
|
}
|
|
((ActionMenuView) this.h).setOverflowReserved(this.l);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter
|
|
public boolean a(ViewGroup viewGroup, int i) {
|
|
if (viewGroup.getChildAt(i) == this.i) {
|
|
return false;
|
|
}
|
|
return super.a(viewGroup, i);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
|
public boolean a(SubMenuBuilder subMenuBuilder) {
|
|
boolean z = false;
|
|
if (!subMenuBuilder.hasVisibleItems()) {
|
|
return false;
|
|
}
|
|
SubMenuBuilder subMenuBuilder2 = subMenuBuilder;
|
|
while (subMenuBuilder2.t() != this.c) {
|
|
subMenuBuilder2 = (SubMenuBuilder) subMenuBuilder2.t();
|
|
}
|
|
View a = a(subMenuBuilder2.getItem());
|
|
if (a == null) {
|
|
return false;
|
|
}
|
|
subMenuBuilder.getItem().getItemId();
|
|
int size = subMenuBuilder.size();
|
|
int i = 0;
|
|
while (true) {
|
|
if (i >= size) {
|
|
break;
|
|
}
|
|
MenuItem item = subMenuBuilder.getItem(i);
|
|
if (item.isVisible() && item.getIcon() != null) {
|
|
z = true;
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
this.z = new ActionButtonSubmenu(this.b, subMenuBuilder, a);
|
|
this.z.a(z);
|
|
this.z.e();
|
|
super.a(subMenuBuilder);
|
|
return true;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
private View a(MenuItem menuItem) {
|
|
ViewGroup viewGroup = (ViewGroup) this.h;
|
|
if (viewGroup == null) {
|
|
return null;
|
|
}
|
|
int childCount = viewGroup.getChildCount();
|
|
for (int i = 0; i < childCount; i++) {
|
|
View childAt = viewGroup.getChildAt(i);
|
|
if ((childAt instanceof MenuView.ItemView) && ((MenuView.ItemView) childAt).getItemData() == menuItem) {
|
|
return childAt;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.BaseMenuPresenter, androidx.appcompat.view.menu.MenuPresenter
|
|
public void a(MenuBuilder menuBuilder, boolean z) {
|
|
c();
|
|
super.a(menuBuilder, z);
|
|
}
|
|
|
|
public void a(ActionMenuView actionMenuView) {
|
|
this.h = actionMenuView;
|
|
actionMenuView.a(this.c);
|
|
}
|
|
}
|