mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
696 lines
26 KiB
Java
696 lines
26 KiB
Java
package androidx.appcompat.widget;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.util.AttributeSet;
|
|
import android.view.ContextThemeWrapper;
|
|
import android.view.KeyEvent;
|
|
import android.view.Menu;
|
|
import android.view.MenuItem;
|
|
import android.view.View;
|
|
import android.view.ViewDebug;
|
|
import android.view.ViewGroup;
|
|
import android.view.accessibility.AccessibilityEvent;
|
|
import androidx.appcompat.view.menu.ActionMenuItemView;
|
|
import androidx.appcompat.view.menu.MenuBuilder;
|
|
import androidx.appcompat.view.menu.MenuItemImpl;
|
|
import androidx.appcompat.view.menu.MenuPresenter;
|
|
import androidx.appcompat.view.menu.MenuView;
|
|
import androidx.appcompat.widget.LinearLayoutCompat;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ActionMenuView extends LinearLayoutCompat implements MenuBuilder.ItemInvoker, MenuView {
|
|
static final int GENERATED_ITEM_PADDING = 4;
|
|
static final int MIN_CELL_SIZE = 56;
|
|
private static final String TAG = "ActionMenuView";
|
|
private MenuPresenter.Callback mActionMenuPresenterCallback;
|
|
private boolean mFormatItems;
|
|
private int mFormatItemsWidth;
|
|
private int mGeneratedItemPadding;
|
|
private MenuBuilder mMenu;
|
|
MenuBuilder.Callback mMenuBuilderCallback;
|
|
private int mMinCellSize;
|
|
OnMenuItemClickListener mOnMenuItemClickListener;
|
|
private Context mPopupContext;
|
|
private int mPopupTheme;
|
|
private ActionMenuPresenter mPresenter;
|
|
private boolean mReserveOverflow;
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface ActionMenuChildView {
|
|
boolean needsDividerAfter();
|
|
|
|
boolean needsDividerBefore();
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public interface OnMenuItemClickListener {
|
|
boolean onMenuItemClick(MenuItem menuItem);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
|
return false;
|
|
}
|
|
|
|
public int getPopupTheme() {
|
|
return this.mPopupTheme;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuView
|
|
public int getWindowAnimations() {
|
|
return 0;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuView
|
|
public void initialize(MenuBuilder menuBuilder) {
|
|
this.mMenu = menuBuilder;
|
|
}
|
|
|
|
public boolean isOverflowReserved() {
|
|
return this.mReserveOverflow;
|
|
}
|
|
|
|
public MenuBuilder peekMenu() {
|
|
return this.mMenu;
|
|
}
|
|
|
|
public void setMenuCallbacks(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
|
this.mActionMenuPresenterCallback = callback;
|
|
this.mMenuBuilderCallback = callback2;
|
|
}
|
|
|
|
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
|
this.mOnMenuItemClickListener = onMenuItemClickListener;
|
|
}
|
|
|
|
public void setOverflowReserved(boolean z) {
|
|
this.mReserveOverflow = z;
|
|
}
|
|
|
|
public ActionMenuView(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public ActionMenuView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
setBaselineAligned(false);
|
|
float f = context.getResources().getDisplayMetrics().density;
|
|
this.mMinCellSize = (int) (56.0f * f);
|
|
this.mGeneratedItemPadding = (int) (f * 4.0f);
|
|
this.mPopupContext = context;
|
|
this.mPopupTheme = 0;
|
|
}
|
|
|
|
public void setPopupTheme(int i) {
|
|
if (this.mPopupTheme != i) {
|
|
this.mPopupTheme = i;
|
|
if (i == 0) {
|
|
this.mPopupContext = getContext();
|
|
} else {
|
|
this.mPopupContext = new ContextThemeWrapper(getContext(), i);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setPresenter(ActionMenuPresenter actionMenuPresenter) {
|
|
this.mPresenter = actionMenuPresenter;
|
|
actionMenuPresenter.setMenuView(this);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
if (actionMenuPresenter != null) {
|
|
actionMenuPresenter.updateMenuView(false);
|
|
if (this.mPresenter.isOverflowMenuShowing()) {
|
|
this.mPresenter.hideOverflowMenu();
|
|
this.mPresenter.showOverflowMenu();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
MenuBuilder menuBuilder;
|
|
boolean z = this.mFormatItems;
|
|
boolean z2 = View.MeasureSpec.getMode(i) == 1073741824;
|
|
this.mFormatItems = z2;
|
|
if (z != z2) {
|
|
this.mFormatItemsWidth = 0;
|
|
}
|
|
int size = View.MeasureSpec.getSize(i);
|
|
if (this.mFormatItems && (menuBuilder = this.mMenu) != null && size != this.mFormatItemsWidth) {
|
|
this.mFormatItemsWidth = size;
|
|
menuBuilder.onItemsChanged(true);
|
|
}
|
|
int childCount = getChildCount();
|
|
if (this.mFormatItems && childCount > 0) {
|
|
onMeasureExactFormat(i, i2);
|
|
return;
|
|
}
|
|
for (int i3 = 0; i3 < childCount; i3++) {
|
|
LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
|
|
layoutParams.rightMargin = 0;
|
|
layoutParams.leftMargin = 0;
|
|
}
|
|
super.onMeasure(i, i2);
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r14v10 */
|
|
/* JADX WARN: Type inference failed for: r14v11, types: [boolean, int] */
|
|
/* JADX WARN: Type inference failed for: r14v14 */
|
|
private void onMeasureExactFormat(int i, int i2) {
|
|
int i3;
|
|
int i4;
|
|
boolean z;
|
|
int i5;
|
|
int i6;
|
|
boolean z2;
|
|
boolean z3;
|
|
int i7;
|
|
?? r14;
|
|
int mode = View.MeasureSpec.getMode(i2);
|
|
int size = View.MeasureSpec.getSize(i);
|
|
int size2 = View.MeasureSpec.getSize(i2);
|
|
int paddingLeft = getPaddingLeft() + getPaddingRight();
|
|
int paddingTop = getPaddingTop() + getPaddingBottom();
|
|
int childMeasureSpec = getChildMeasureSpec(i2, paddingTop, -2);
|
|
int i8 = size - paddingLeft;
|
|
int i9 = this.mMinCellSize;
|
|
int i10 = i8 / i9;
|
|
int i11 = i8 % i9;
|
|
if (i10 == 0) {
|
|
setMeasuredDimension(i8, 0);
|
|
return;
|
|
}
|
|
int i12 = i9 + (i11 / i10);
|
|
int childCount = getChildCount();
|
|
int i13 = 0;
|
|
int i14 = 0;
|
|
boolean z4 = false;
|
|
int i15 = 0;
|
|
int i16 = 0;
|
|
int i17 = 0;
|
|
long j = 0;
|
|
while (i14 < childCount) {
|
|
View childAt = getChildAt(i14);
|
|
int i18 = size2;
|
|
if (childAt.getVisibility() != 8) {
|
|
boolean z5 = childAt instanceof ActionMenuItemView;
|
|
int i19 = i15 + 1;
|
|
if (z5) {
|
|
int i20 = this.mGeneratedItemPadding;
|
|
i7 = i19;
|
|
r14 = 0;
|
|
childAt.setPadding(i20, 0, i20, 0);
|
|
} else {
|
|
i7 = i19;
|
|
r14 = 0;
|
|
}
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
layoutParams.expanded = r14;
|
|
layoutParams.extraPixels = r14;
|
|
layoutParams.cellsUsed = r14;
|
|
layoutParams.expandable = r14;
|
|
layoutParams.leftMargin = r14;
|
|
layoutParams.rightMargin = r14;
|
|
layoutParams.preventEdgeOffset = z5 && ((ActionMenuItemView) childAt).hasText();
|
|
int measureChildForCells = measureChildForCells(childAt, i12, layoutParams.isOverflowButton ? 1 : i10, childMeasureSpec, paddingTop);
|
|
i16 = Math.max(i16, measureChildForCells);
|
|
if (layoutParams.expandable) {
|
|
i17++;
|
|
}
|
|
if (layoutParams.isOverflowButton) {
|
|
z4 = true;
|
|
}
|
|
i10 -= measureChildForCells;
|
|
i13 = Math.max(i13, childAt.getMeasuredHeight());
|
|
if (measureChildForCells == 1) {
|
|
j |= 1 << i14;
|
|
i13 = i13;
|
|
}
|
|
i15 = i7;
|
|
}
|
|
i14++;
|
|
size2 = i18;
|
|
}
|
|
int i21 = size2;
|
|
boolean z6 = z4 && i15 == 2;
|
|
boolean z7 = false;
|
|
while (i17 > 0 && i10 > 0) {
|
|
int i22 = Integer.MAX_VALUE;
|
|
int i23 = 0;
|
|
int i24 = 0;
|
|
long j2 = 0;
|
|
while (i24 < childCount) {
|
|
boolean z8 = z7;
|
|
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i24).getLayoutParams();
|
|
int i25 = i13;
|
|
if (layoutParams2.expandable) {
|
|
if (layoutParams2.cellsUsed < i22) {
|
|
i22 = layoutParams2.cellsUsed;
|
|
j2 = 1 << i24;
|
|
i23 = 1;
|
|
} else if (layoutParams2.cellsUsed == i22) {
|
|
i23++;
|
|
j2 |= 1 << i24;
|
|
}
|
|
}
|
|
i24++;
|
|
i13 = i25;
|
|
z7 = z8;
|
|
}
|
|
z = z7;
|
|
i5 = i13;
|
|
j |= j2;
|
|
if (i23 > i10) {
|
|
i3 = mode;
|
|
i4 = i8;
|
|
break;
|
|
}
|
|
int i26 = i22 + 1;
|
|
int i27 = 0;
|
|
while (i27 < childCount) {
|
|
View childAt2 = getChildAt(i27);
|
|
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
|
|
int i28 = i8;
|
|
int i29 = mode;
|
|
long j3 = 1 << i27;
|
|
if ((j2 & j3) == 0) {
|
|
if (layoutParams3.cellsUsed == i26) {
|
|
j |= j3;
|
|
}
|
|
z3 = z6;
|
|
} else {
|
|
if (z6 && layoutParams3.preventEdgeOffset && i10 == 1) {
|
|
int i30 = this.mGeneratedItemPadding;
|
|
z3 = z6;
|
|
childAt2.setPadding(i30 + i12, 0, i30, 0);
|
|
} else {
|
|
z3 = z6;
|
|
}
|
|
layoutParams3.cellsUsed++;
|
|
layoutParams3.expanded = true;
|
|
i10--;
|
|
}
|
|
i27++;
|
|
mode = i29;
|
|
i8 = i28;
|
|
z6 = z3;
|
|
}
|
|
i13 = i5;
|
|
z7 = true;
|
|
}
|
|
i3 = mode;
|
|
i4 = i8;
|
|
z = z7;
|
|
i5 = i13;
|
|
boolean z9 = !z4 && i15 == 1;
|
|
if (i10 <= 0 || j == 0 || (i10 >= i15 - 1 && !z9 && i16 <= 1)) {
|
|
i6 = 0;
|
|
z2 = z;
|
|
} else {
|
|
float bitCount = Long.bitCount(j);
|
|
if (z9) {
|
|
i6 = 0;
|
|
} else {
|
|
i6 = 0;
|
|
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).preventEdgeOffset) {
|
|
bitCount -= 0.5f;
|
|
}
|
|
int i31 = childCount - 1;
|
|
if ((j & (1 << i31)) != 0 && !((LayoutParams) getChildAt(i31).getLayoutParams()).preventEdgeOffset) {
|
|
bitCount -= 0.5f;
|
|
}
|
|
}
|
|
int i32 = bitCount > 0.0f ? (int) ((i10 * i12) / bitCount) : i6;
|
|
z2 = z;
|
|
for (int i33 = i6; i33 < childCount; i33++) {
|
|
if ((j & (1 << i33)) != 0) {
|
|
View childAt3 = getChildAt(i33);
|
|
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
|
|
if (childAt3 instanceof ActionMenuItemView) {
|
|
layoutParams4.extraPixels = i32;
|
|
layoutParams4.expanded = true;
|
|
if (i33 == 0 && !layoutParams4.preventEdgeOffset) {
|
|
layoutParams4.leftMargin = (-i32) / 2;
|
|
}
|
|
z2 = true;
|
|
} else if (layoutParams4.isOverflowButton) {
|
|
layoutParams4.extraPixels = i32;
|
|
layoutParams4.expanded = true;
|
|
layoutParams4.rightMargin = (-i32) / 2;
|
|
z2 = true;
|
|
} else {
|
|
if (i33 != 0) {
|
|
layoutParams4.leftMargin = i32 / 2;
|
|
}
|
|
if (i33 != childCount - 1) {
|
|
layoutParams4.rightMargin = i32 / 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (z2) {
|
|
for (int i34 = i6; i34 < childCount; i34++) {
|
|
View childAt4 = getChildAt(i34);
|
|
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
|
|
if (layoutParams5.expanded) {
|
|
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.cellsUsed * i12) + layoutParams5.extraPixels, 1073741824), childMeasureSpec);
|
|
}
|
|
}
|
|
}
|
|
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i21);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public static int measureChildForCells(View view, int i, int i2, int i3, int i4) {
|
|
int i5;
|
|
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
|
int makeMeasureSpec = View.MeasureSpec.makeMeasureSpec(View.MeasureSpec.getSize(i3) - i4, View.MeasureSpec.getMode(i3));
|
|
ActionMenuItemView actionMenuItemView = view instanceof ActionMenuItemView ? (ActionMenuItemView) view : null;
|
|
boolean z = actionMenuItemView != null && actionMenuItemView.hasText();
|
|
if (i2 > 0) {
|
|
i5 = 2;
|
|
if (!z || i2 >= 2) {
|
|
view.measure(View.MeasureSpec.makeMeasureSpec(i2 * i, Integer.MIN_VALUE), makeMeasureSpec);
|
|
int measuredWidth = view.getMeasuredWidth();
|
|
int i6 = measuredWidth / i;
|
|
if (measuredWidth % i != 0) {
|
|
i6++;
|
|
}
|
|
if (!z || i6 >= 2) {
|
|
i5 = i6;
|
|
}
|
|
layoutParams.expandable = layoutParams.isOverflowButton && z;
|
|
layoutParams.cellsUsed = i5;
|
|
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
|
|
return i5;
|
|
}
|
|
}
|
|
i5 = 0;
|
|
layoutParams.expandable = layoutParams.isOverflowButton && z;
|
|
layoutParams.cellsUsed = i5;
|
|
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
|
|
return i5;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
|
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
int width;
|
|
int i5;
|
|
if (!this.mFormatItems) {
|
|
super.onLayout(z, i, i2, i3, i4);
|
|
return;
|
|
}
|
|
int childCount = getChildCount();
|
|
int i6 = (i4 - i2) / 2;
|
|
int dividerWidth = getDividerWidth();
|
|
int i7 = i3 - i;
|
|
int paddingRight = (i7 - getPaddingRight()) - getPaddingLeft();
|
|
boolean isLayoutRtl = ViewUtils.isLayoutRtl(this);
|
|
int i8 = 0;
|
|
int i9 = 0;
|
|
for (int i10 = 0; i10 < childCount; i10++) {
|
|
View childAt = getChildAt(i10);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.isOverflowButton) {
|
|
int measuredWidth = childAt.getMeasuredWidth();
|
|
if (hasSupportDividerBeforeChildAt(i10)) {
|
|
measuredWidth += dividerWidth;
|
|
}
|
|
int measuredHeight = childAt.getMeasuredHeight();
|
|
if (isLayoutRtl) {
|
|
i5 = getPaddingLeft() + layoutParams.leftMargin;
|
|
width = i5 + measuredWidth;
|
|
} else {
|
|
width = (getWidth() - getPaddingRight()) - layoutParams.rightMargin;
|
|
i5 = width - measuredWidth;
|
|
}
|
|
int i11 = i6 - (measuredHeight / 2);
|
|
childAt.layout(i5, i11, width, measuredHeight + i11);
|
|
paddingRight -= measuredWidth;
|
|
i8 = 1;
|
|
} else {
|
|
paddingRight -= (childAt.getMeasuredWidth() + layoutParams.leftMargin) + layoutParams.rightMargin;
|
|
hasSupportDividerBeforeChildAt(i10);
|
|
i9++;
|
|
}
|
|
}
|
|
}
|
|
if (childCount == 1 && i8 == 0) {
|
|
View childAt2 = getChildAt(0);
|
|
int measuredWidth2 = childAt2.getMeasuredWidth();
|
|
int measuredHeight2 = childAt2.getMeasuredHeight();
|
|
int i12 = (i7 / 2) - (measuredWidth2 / 2);
|
|
int i13 = i6 - (measuredHeight2 / 2);
|
|
childAt2.layout(i12, i13, measuredWidth2 + i12, measuredHeight2 + i13);
|
|
return;
|
|
}
|
|
int i14 = i9 - (i8 ^ 1);
|
|
int max = Math.max(0, i14 > 0 ? paddingRight / i14 : 0);
|
|
if (isLayoutRtl) {
|
|
int width2 = getWidth() - getPaddingRight();
|
|
for (int i15 = 0; i15 < childCount; i15++) {
|
|
View childAt3 = getChildAt(i15);
|
|
LayoutParams layoutParams2 = (LayoutParams) childAt3.getLayoutParams();
|
|
if (childAt3.getVisibility() != 8 && !layoutParams2.isOverflowButton) {
|
|
int i16 = width2 - layoutParams2.rightMargin;
|
|
int measuredWidth3 = childAt3.getMeasuredWidth();
|
|
int measuredHeight3 = childAt3.getMeasuredHeight();
|
|
int i17 = i6 - (measuredHeight3 / 2);
|
|
childAt3.layout(i16 - measuredWidth3, i17, i16, measuredHeight3 + i17);
|
|
width2 = i16 - ((measuredWidth3 + layoutParams2.leftMargin) + max);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
int paddingLeft = getPaddingLeft();
|
|
for (int i18 = 0; i18 < childCount; i18++) {
|
|
View childAt4 = getChildAt(i18);
|
|
LayoutParams layoutParams3 = (LayoutParams) childAt4.getLayoutParams();
|
|
if (childAt4.getVisibility() != 8 && !layoutParams3.isOverflowButton) {
|
|
int i19 = paddingLeft + layoutParams3.leftMargin;
|
|
int measuredWidth4 = childAt4.getMeasuredWidth();
|
|
int measuredHeight4 = childAt4.getMeasuredHeight();
|
|
int i20 = i6 - (measuredHeight4 / 2);
|
|
childAt4.layout(i19, i20, i19 + measuredWidth4, measuredHeight4 + i20);
|
|
paddingLeft = i19 + measuredWidth4 + layoutParams3.rightMargin + max;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
dismissPopupMenus();
|
|
}
|
|
|
|
public void setOverflowIcon(Drawable drawable) {
|
|
getMenu();
|
|
this.mPresenter.setOverflowIcon(drawable);
|
|
}
|
|
|
|
public Drawable getOverflowIcon() {
|
|
getMenu();
|
|
return this.mPresenter.getOverflowIcon();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
|
public LayoutParams generateDefaultLayoutParams() {
|
|
LayoutParams layoutParams = new LayoutParams(-2, -2);
|
|
layoutParams.gravity = 16;
|
|
return layoutParams;
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
|
public LayoutParams generateLayoutParams(AttributeSet attributeSet) {
|
|
return new LayoutParams(getContext(), attributeSet);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
|
public LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
LayoutParams layoutParams2;
|
|
if (layoutParams != null) {
|
|
if (layoutParams instanceof LayoutParams) {
|
|
layoutParams2 = new LayoutParams((LayoutParams) layoutParams);
|
|
} else {
|
|
layoutParams2 = new LayoutParams(layoutParams);
|
|
}
|
|
if (layoutParams2.gravity <= 0) {
|
|
layoutParams2.gravity = 16;
|
|
}
|
|
return layoutParams2;
|
|
}
|
|
return generateDefaultLayoutParams();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
|
public boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return layoutParams instanceof LayoutParams;
|
|
}
|
|
|
|
public LayoutParams generateOverflowButtonLayoutParams() {
|
|
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
|
|
generateDefaultLayoutParams.isOverflowButton = true;
|
|
return generateDefaultLayoutParams;
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
|
public boolean invokeItem(MenuItemImpl menuItemImpl) {
|
|
return this.mMenu.performItemAction(menuItemImpl, 0);
|
|
}
|
|
|
|
public Menu getMenu() {
|
|
if (this.mMenu == null) {
|
|
Context context = getContext();
|
|
MenuBuilder menuBuilder = new MenuBuilder(context);
|
|
this.mMenu = menuBuilder;
|
|
menuBuilder.setCallback(new MenuBuilderCallback());
|
|
ActionMenuPresenter actionMenuPresenter = new ActionMenuPresenter(context);
|
|
this.mPresenter = actionMenuPresenter;
|
|
actionMenuPresenter.setReserveOverflow(true);
|
|
ActionMenuPresenter actionMenuPresenter2 = this.mPresenter;
|
|
MenuPresenter.Callback callback = this.mActionMenuPresenterCallback;
|
|
if (callback == null) {
|
|
callback = new ActionMenuPresenterCallback();
|
|
}
|
|
actionMenuPresenter2.setCallback(callback);
|
|
this.mMenu.addMenuPresenter(this.mPresenter, this.mPopupContext);
|
|
this.mPresenter.setMenuView(this);
|
|
}
|
|
return this.mMenu;
|
|
}
|
|
|
|
public boolean showOverflowMenu() {
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
return actionMenuPresenter != null && actionMenuPresenter.showOverflowMenu();
|
|
}
|
|
|
|
public boolean hideOverflowMenu() {
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
return actionMenuPresenter != null && actionMenuPresenter.hideOverflowMenu();
|
|
}
|
|
|
|
public boolean isOverflowMenuShowing() {
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowing();
|
|
}
|
|
|
|
public boolean isOverflowMenuShowPending() {
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
return actionMenuPresenter != null && actionMenuPresenter.isOverflowMenuShowPending();
|
|
}
|
|
|
|
public void dismissPopupMenus() {
|
|
ActionMenuPresenter actionMenuPresenter = this.mPresenter;
|
|
if (actionMenuPresenter != null) {
|
|
actionMenuPresenter.dismissPopupMenus();
|
|
}
|
|
}
|
|
|
|
protected boolean hasSupportDividerBeforeChildAt(int i) {
|
|
boolean z = false;
|
|
if (i == 0) {
|
|
return false;
|
|
}
|
|
KeyEvent.Callback childAt = getChildAt(i - 1);
|
|
KeyEvent.Callback childAt2 = getChildAt(i);
|
|
if (i < getChildCount() && (childAt instanceof ActionMenuChildView)) {
|
|
z = ((ActionMenuChildView) childAt).needsDividerAfter();
|
|
}
|
|
return (i <= 0 || !(childAt2 instanceof ActionMenuChildView)) ? z : z | ((ActionMenuChildView) childAt2).needsDividerBefore();
|
|
}
|
|
|
|
public void setExpandedActionViewsExclusive(boolean z) {
|
|
this.mPresenter.setExpandedActionViewsExclusive(z);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* loaded from: classes.dex */
|
|
public class MenuBuilderCallback implements MenuBuilder.Callback {
|
|
MenuBuilderCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public boolean onMenuItemSelected(MenuBuilder menuBuilder, MenuItem menuItem) {
|
|
return ActionMenuView.this.mOnMenuItemClickListener != null && ActionMenuView.this.mOnMenuItemClickListener.onMenuItemClick(menuItem);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public void onMenuModeChange(MenuBuilder menuBuilder) {
|
|
if (ActionMenuView.this.mMenuBuilderCallback != null) {
|
|
ActionMenuView.this.mMenuBuilderCallback.onMenuModeChange(menuBuilder);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* loaded from: classes.dex */
|
|
public static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public void onCloseMenu(MenuBuilder menuBuilder, boolean z) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public boolean onOpenSubMenu(MenuBuilder menuBuilder) {
|
|
return false;
|
|
}
|
|
|
|
ActionMenuPresenterCallback() {
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static class LayoutParams extends LinearLayoutCompat.LayoutParams {
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public int cellsUsed;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean expandable;
|
|
boolean expanded;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public int extraPixels;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean isOverflowButton;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean preventEdgeOffset;
|
|
|
|
public LayoutParams(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
}
|
|
|
|
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
}
|
|
|
|
public LayoutParams(LayoutParams layoutParams) {
|
|
super((ViewGroup.LayoutParams) layoutParams);
|
|
this.isOverflowButton = layoutParams.isOverflowButton;
|
|
}
|
|
|
|
public LayoutParams(int i, int i2) {
|
|
super(i, i2);
|
|
this.isOverflowButton = false;
|
|
}
|
|
|
|
LayoutParams(int i, int i2, boolean z) {
|
|
super(i, i2);
|
|
this.isOverflowButton = z;
|
|
}
|
|
}
|
|
}
|