677 lines
24 KiB
Java
677 lines
24 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 {
|
|
private int A;
|
|
OnMenuItemClickListener B;
|
|
private MenuBuilder p;
|
|
private Context q;
|
|
private int r;
|
|
private boolean s;
|
|
private ActionMenuPresenter t;
|
|
private MenuPresenter.Callback u;
|
|
MenuBuilder.Callback v;
|
|
private boolean x;
|
|
private int y;
|
|
private int z;
|
|
|
|
public interface ActionMenuChildView {
|
|
boolean b();
|
|
|
|
boolean c();
|
|
}
|
|
|
|
private static class ActionMenuPresenterCallback implements MenuPresenter.Callback {
|
|
ActionMenuPresenterCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public void a(MenuBuilder menuBuilder, boolean z) {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuPresenter.Callback
|
|
public boolean a(MenuBuilder menuBuilder) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static class LayoutParams extends LinearLayoutCompat.LayoutParams {
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean c;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public int d;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public int e;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean f;
|
|
|
|
@ViewDebug.ExportedProperty
|
|
public boolean g;
|
|
boolean h;
|
|
|
|
public LayoutParams(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
}
|
|
|
|
public LayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
}
|
|
|
|
public LayoutParams(LayoutParams layoutParams) {
|
|
super(layoutParams);
|
|
this.c = layoutParams.c;
|
|
}
|
|
|
|
public LayoutParams(int i, int i2) {
|
|
super(i, i2);
|
|
this.c = false;
|
|
}
|
|
}
|
|
|
|
public interface OnMenuItemClickListener {
|
|
boolean onMenuItemClick(MenuItem menuItem);
|
|
}
|
|
|
|
public ActionMenuView(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
static int a(View view, int i, int i2, int i3, int i4) {
|
|
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.d();
|
|
int i5 = 2;
|
|
if (i2 <= 0 || (z && i2 < 2)) {
|
|
i5 = 0;
|
|
} else {
|
|
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.f = !layoutParams.c && z;
|
|
layoutParams.d = i5;
|
|
view.measure(View.MeasureSpec.makeMeasureSpec(i * i5, 1073741824), makeMeasureSpec);
|
|
return i5;
|
|
}
|
|
|
|
/* JADX WARN: Type inference failed for: r13v12 */
|
|
/* JADX WARN: Type inference failed for: r13v13, types: [boolean, int] */
|
|
/* JADX WARN: Type inference failed for: r13v16 */
|
|
private void c(int i, int i2) {
|
|
int i3;
|
|
int i4;
|
|
boolean z;
|
|
int i5;
|
|
int i6;
|
|
int i7;
|
|
int i8;
|
|
?? r13;
|
|
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 = ViewGroup.getChildMeasureSpec(i2, paddingTop, -2);
|
|
int i9 = size - paddingLeft;
|
|
int i10 = this.z;
|
|
int i11 = i9 / i10;
|
|
int i12 = i9 % i10;
|
|
if (i11 == 0) {
|
|
setMeasuredDimension(i9, 0);
|
|
return;
|
|
}
|
|
int i13 = i10 + (i12 / i11);
|
|
int childCount = getChildCount();
|
|
int i14 = i11;
|
|
int i15 = 0;
|
|
int i16 = 0;
|
|
boolean z2 = false;
|
|
int i17 = 0;
|
|
int i18 = 0;
|
|
int i19 = 0;
|
|
long j = 0;
|
|
while (i15 < childCount) {
|
|
View childAt = getChildAt(i15);
|
|
int i20 = size2;
|
|
if (childAt.getVisibility() != 8) {
|
|
boolean z3 = childAt instanceof ActionMenuItemView;
|
|
int i21 = i17 + 1;
|
|
if (z3) {
|
|
int i22 = this.A;
|
|
i8 = i21;
|
|
r13 = 0;
|
|
childAt.setPadding(i22, 0, i22, 0);
|
|
} else {
|
|
i8 = i21;
|
|
r13 = 0;
|
|
}
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
layoutParams.h = r13;
|
|
layoutParams.e = r13;
|
|
layoutParams.d = r13;
|
|
layoutParams.f = r13;
|
|
((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = r13;
|
|
((ViewGroup.MarginLayoutParams) layoutParams).rightMargin = r13;
|
|
layoutParams.g = z3 && ((ActionMenuItemView) childAt).d();
|
|
int a = a(childAt, i13, layoutParams.c ? 1 : i14, childMeasureSpec, paddingTop);
|
|
int max = Math.max(i18, a);
|
|
if (layoutParams.f) {
|
|
i19++;
|
|
}
|
|
if (layoutParams.c) {
|
|
z2 = true;
|
|
}
|
|
i14 -= a;
|
|
i16 = Math.max(i16, childAt.getMeasuredHeight());
|
|
if (a == 1) {
|
|
j |= 1 << i15;
|
|
i16 = i16;
|
|
}
|
|
i18 = max;
|
|
i17 = i8;
|
|
}
|
|
i15++;
|
|
size2 = i20;
|
|
}
|
|
int i23 = size2;
|
|
boolean z4 = z2 && i17 == 2;
|
|
boolean z5 = false;
|
|
while (i19 > 0 && i14 > 0) {
|
|
int i24 = Integer.MAX_VALUE;
|
|
int i25 = 0;
|
|
int i26 = 0;
|
|
long j2 = 0;
|
|
while (i25 < childCount) {
|
|
boolean z6 = z5;
|
|
LayoutParams layoutParams2 = (LayoutParams) getChildAt(i25).getLayoutParams();
|
|
int i27 = i16;
|
|
if (layoutParams2.f) {
|
|
int i28 = layoutParams2.d;
|
|
if (i28 < i24) {
|
|
i24 = i28;
|
|
j2 = 1 << i25;
|
|
i26 = 1;
|
|
} else if (i28 == i24) {
|
|
j2 |= 1 << i25;
|
|
i26++;
|
|
}
|
|
}
|
|
i25++;
|
|
i16 = i27;
|
|
z5 = z6;
|
|
}
|
|
z = z5;
|
|
i5 = i16;
|
|
j |= j2;
|
|
if (i26 > i14) {
|
|
i3 = mode;
|
|
i4 = i9;
|
|
break;
|
|
}
|
|
int i29 = i24 + 1;
|
|
int i30 = 0;
|
|
while (i30 < childCount) {
|
|
View childAt2 = getChildAt(i30);
|
|
LayoutParams layoutParams3 = (LayoutParams) childAt2.getLayoutParams();
|
|
int i31 = i9;
|
|
int i32 = mode;
|
|
long j3 = 1 << i30;
|
|
if ((j2 & j3) == 0) {
|
|
if (layoutParams3.d == i29) {
|
|
j |= j3;
|
|
}
|
|
i7 = i29;
|
|
} else {
|
|
if (z4 && layoutParams3.g && i14 == 1) {
|
|
int i33 = this.A;
|
|
i7 = i29;
|
|
childAt2.setPadding(i33 + i13, 0, i33, 0);
|
|
} else {
|
|
i7 = i29;
|
|
}
|
|
layoutParams3.d++;
|
|
layoutParams3.h = true;
|
|
i14--;
|
|
}
|
|
i30++;
|
|
mode = i32;
|
|
i29 = i7;
|
|
i9 = i31;
|
|
}
|
|
i16 = i5;
|
|
z5 = true;
|
|
}
|
|
i3 = mode;
|
|
i4 = i9;
|
|
z = z5;
|
|
i5 = i16;
|
|
boolean z7 = !z2 && i17 == 1;
|
|
if (i14 <= 0 || j == 0 || (i14 >= i17 - 1 && !z7 && i18 <= 1)) {
|
|
i6 = 0;
|
|
} else {
|
|
float bitCount = Long.bitCount(j);
|
|
if (z7) {
|
|
i6 = 0;
|
|
} else {
|
|
i6 = 0;
|
|
if ((j & 1) != 0 && !((LayoutParams) getChildAt(0).getLayoutParams()).g) {
|
|
bitCount -= 0.5f;
|
|
}
|
|
int i34 = childCount - 1;
|
|
if ((j & (1 << i34)) != 0 && !((LayoutParams) getChildAt(i34).getLayoutParams()).g) {
|
|
bitCount -= 0.5f;
|
|
}
|
|
}
|
|
int i35 = bitCount > 0.0f ? (int) ((i14 * i13) / bitCount) : 0;
|
|
for (int i36 = 0; i36 < childCount; i36++) {
|
|
if ((j & (1 << i36)) != 0) {
|
|
View childAt3 = getChildAt(i36);
|
|
LayoutParams layoutParams4 = (LayoutParams) childAt3.getLayoutParams();
|
|
if (childAt3 instanceof ActionMenuItemView) {
|
|
layoutParams4.e = i35;
|
|
layoutParams4.h = true;
|
|
if (i36 == 0 && !layoutParams4.g) {
|
|
((ViewGroup.MarginLayoutParams) layoutParams4).leftMargin = (-i35) / 2;
|
|
}
|
|
} else if (layoutParams4.c) {
|
|
layoutParams4.e = i35;
|
|
layoutParams4.h = true;
|
|
((ViewGroup.MarginLayoutParams) layoutParams4).rightMargin = (-i35) / 2;
|
|
} else {
|
|
if (i36 != 0) {
|
|
((ViewGroup.MarginLayoutParams) layoutParams4).leftMargin = i35 / 2;
|
|
}
|
|
if (i36 != childCount - 1) {
|
|
((ViewGroup.MarginLayoutParams) layoutParams4).rightMargin = i35 / 2;
|
|
}
|
|
}
|
|
z = true;
|
|
}
|
|
}
|
|
}
|
|
if (z) {
|
|
while (i6 < childCount) {
|
|
View childAt4 = getChildAt(i6);
|
|
LayoutParams layoutParams5 = (LayoutParams) childAt4.getLayoutParams();
|
|
if (layoutParams5.h) {
|
|
childAt4.measure(View.MeasureSpec.makeMeasureSpec((layoutParams5.d * i13) + layoutParams5.e, 1073741824), childMeasureSpec);
|
|
}
|
|
i6++;
|
|
}
|
|
}
|
|
setMeasuredDimension(i4, i3 != 1073741824 ? i5 : i23);
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup
|
|
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
|
|
return layoutParams != null && (layoutParams instanceof LayoutParams);
|
|
}
|
|
|
|
public void d() {
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
if (actionMenuPresenter != null) {
|
|
actionMenuPresenter.c();
|
|
}
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
|
|
return false;
|
|
}
|
|
|
|
public LayoutParams e() {
|
|
LayoutParams generateDefaultLayoutParams = generateDefaultLayoutParams();
|
|
generateDefaultLayoutParams.c = true;
|
|
return generateDefaultLayoutParams;
|
|
}
|
|
|
|
public boolean f() {
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
return actionMenuPresenter != null && actionMenuPresenter.e();
|
|
}
|
|
|
|
public boolean g() {
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
return actionMenuPresenter != null && actionMenuPresenter.g();
|
|
}
|
|
|
|
public Menu getMenu() {
|
|
if (this.p == null) {
|
|
Context context = getContext();
|
|
this.p = new MenuBuilder(context);
|
|
this.p.a(new MenuBuilderCallback());
|
|
this.t = new ActionMenuPresenter(context);
|
|
this.t.c(true);
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
MenuPresenter.Callback callback = this.u;
|
|
if (callback == null) {
|
|
callback = new ActionMenuPresenterCallback();
|
|
}
|
|
actionMenuPresenter.a(callback);
|
|
this.p.a(this.t, this.q);
|
|
this.t.a(this);
|
|
}
|
|
return this.p;
|
|
}
|
|
|
|
public Drawable getOverflowIcon() {
|
|
getMenu();
|
|
return this.t.d();
|
|
}
|
|
|
|
public int getPopupTheme() {
|
|
return this.r;
|
|
}
|
|
|
|
public int getWindowAnimations() {
|
|
return 0;
|
|
}
|
|
|
|
public boolean h() {
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
return actionMenuPresenter != null && actionMenuPresenter.h();
|
|
}
|
|
|
|
public boolean i() {
|
|
return this.s;
|
|
}
|
|
|
|
public MenuBuilder j() {
|
|
return this.p;
|
|
}
|
|
|
|
public boolean k() {
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
return actionMenuPresenter != null && actionMenuPresenter.i();
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
super.onConfigurationChanged(configuration);
|
|
ActionMenuPresenter actionMenuPresenter = this.t;
|
|
if (actionMenuPresenter != null) {
|
|
actionMenuPresenter.a(false);
|
|
if (this.t.h()) {
|
|
this.t.e();
|
|
this.t.i();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.view.ViewGroup, android.view.View
|
|
public void onDetachedFromWindow() {
|
|
super.onDetachedFromWindow();
|
|
d();
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.ViewGroup, android.view.View
|
|
protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
|
|
int i5;
|
|
int i6;
|
|
int width;
|
|
int i7;
|
|
if (!this.x) {
|
|
super.onLayout(z, i, i2, i3, i4);
|
|
return;
|
|
}
|
|
int childCount = getChildCount();
|
|
int i8 = (i4 - i2) / 2;
|
|
int dividerWidth = getDividerWidth();
|
|
int i9 = i3 - i;
|
|
int paddingRight = (i9 - getPaddingRight()) - getPaddingLeft();
|
|
boolean a = ViewUtils.a(this);
|
|
int i10 = paddingRight;
|
|
int i11 = 0;
|
|
int i12 = 0;
|
|
for (int i13 = 0; i13 < childCount; i13++) {
|
|
View childAt = getChildAt(i13);
|
|
if (childAt.getVisibility() != 8) {
|
|
LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
|
|
if (layoutParams.c) {
|
|
int measuredWidth = childAt.getMeasuredWidth();
|
|
if (d(i13)) {
|
|
measuredWidth += dividerWidth;
|
|
}
|
|
int measuredHeight = childAt.getMeasuredHeight();
|
|
if (a) {
|
|
i7 = getPaddingLeft() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin;
|
|
width = i7 + measuredWidth;
|
|
} else {
|
|
width = (getWidth() - getPaddingRight()) - ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
|
i7 = width - measuredWidth;
|
|
}
|
|
int i14 = i8 - (measuredHeight / 2);
|
|
childAt.layout(i7, i14, width, measuredHeight + i14);
|
|
i10 -= measuredWidth;
|
|
i11 = 1;
|
|
} else {
|
|
i10 -= (childAt.getMeasuredWidth() + ((ViewGroup.MarginLayoutParams) layoutParams).leftMargin) + ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin;
|
|
d(i13);
|
|
i12++;
|
|
}
|
|
}
|
|
}
|
|
if (childCount == 1 && i11 == 0) {
|
|
View childAt2 = getChildAt(0);
|
|
int measuredWidth2 = childAt2.getMeasuredWidth();
|
|
int measuredHeight2 = childAt2.getMeasuredHeight();
|
|
int i15 = (i9 / 2) - (measuredWidth2 / 2);
|
|
int i16 = i8 - (measuredHeight2 / 2);
|
|
childAt2.layout(i15, i16, measuredWidth2 + i15, measuredHeight2 + i16);
|
|
return;
|
|
}
|
|
int i17 = i12 - (i11 ^ 1);
|
|
if (i17 > 0) {
|
|
i6 = i10 / i17;
|
|
i5 = 0;
|
|
} else {
|
|
i5 = 0;
|
|
i6 = 0;
|
|
}
|
|
int max = Math.max(i5, i6);
|
|
if (a) {
|
|
int width2 = getWidth() - getPaddingRight();
|
|
while (i5 < childCount) {
|
|
View childAt3 = getChildAt(i5);
|
|
LayoutParams layoutParams2 = (LayoutParams) childAt3.getLayoutParams();
|
|
if (childAt3.getVisibility() != 8 && !layoutParams2.c) {
|
|
int i18 = width2 - ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin;
|
|
int measuredWidth3 = childAt3.getMeasuredWidth();
|
|
int measuredHeight3 = childAt3.getMeasuredHeight();
|
|
int i19 = i8 - (measuredHeight3 / 2);
|
|
childAt3.layout(i18 - measuredWidth3, i19, i18, measuredHeight3 + i19);
|
|
width2 = i18 - ((measuredWidth3 + ((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin) + max);
|
|
}
|
|
i5++;
|
|
}
|
|
return;
|
|
}
|
|
int paddingLeft = getPaddingLeft();
|
|
while (i5 < childCount) {
|
|
View childAt4 = getChildAt(i5);
|
|
LayoutParams layoutParams3 = (LayoutParams) childAt4.getLayoutParams();
|
|
if (childAt4.getVisibility() != 8 && !layoutParams3.c) {
|
|
int i20 = paddingLeft + ((ViewGroup.MarginLayoutParams) layoutParams3).leftMargin;
|
|
int measuredWidth4 = childAt4.getMeasuredWidth();
|
|
int measuredHeight4 = childAt4.getMeasuredHeight();
|
|
int i21 = i8 - (measuredHeight4 / 2);
|
|
childAt4.layout(i20, i21, i20 + measuredWidth4, measuredHeight4 + i21);
|
|
paddingLeft = i20 + measuredWidth4 + ((ViewGroup.MarginLayoutParams) layoutParams3).rightMargin + max;
|
|
}
|
|
i5++;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View
|
|
protected void onMeasure(int i, int i2) {
|
|
MenuBuilder menuBuilder;
|
|
boolean z = this.x;
|
|
this.x = View.MeasureSpec.getMode(i) == 1073741824;
|
|
if (z != this.x) {
|
|
this.y = 0;
|
|
}
|
|
int size = View.MeasureSpec.getSize(i);
|
|
if (this.x && (menuBuilder = this.p) != null && size != this.y) {
|
|
this.y = size;
|
|
menuBuilder.b(true);
|
|
}
|
|
int childCount = getChildCount();
|
|
if (this.x && childCount > 0) {
|
|
c(i, i2);
|
|
return;
|
|
}
|
|
for (int i3 = 0; i3 < childCount; i3++) {
|
|
LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
|
|
((ViewGroup.MarginLayoutParams) layoutParams).rightMargin = 0;
|
|
((ViewGroup.MarginLayoutParams) layoutParams).leftMargin = 0;
|
|
}
|
|
super.onMeasure(i, i2);
|
|
}
|
|
|
|
public void setExpandedActionViewsExclusive(boolean z) {
|
|
this.t.b(z);
|
|
}
|
|
|
|
public void setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
|
|
this.B = onMenuItemClickListener;
|
|
}
|
|
|
|
public void setOverflowIcon(Drawable drawable) {
|
|
getMenu();
|
|
this.t.a(drawable);
|
|
}
|
|
|
|
public void setOverflowReserved(boolean z) {
|
|
this.s = z;
|
|
}
|
|
|
|
public void setPopupTheme(int i) {
|
|
if (this.r != i) {
|
|
this.r = i;
|
|
if (i == 0) {
|
|
this.q = getContext();
|
|
} else {
|
|
this.q = new ContextThemeWrapper(getContext(), i);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void setPresenter(ActionMenuPresenter actionMenuPresenter) {
|
|
this.t = actionMenuPresenter;
|
|
this.t.a(this);
|
|
}
|
|
|
|
private class MenuBuilderCallback implements MenuBuilder.Callback {
|
|
MenuBuilderCallback() {
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public boolean a(MenuBuilder menuBuilder, MenuItem menuItem) {
|
|
OnMenuItemClickListener onMenuItemClickListener = ActionMenuView.this.B;
|
|
return onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(menuItem);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.Callback
|
|
public void a(MenuBuilder menuBuilder) {
|
|
MenuBuilder.Callback callback = ActionMenuView.this.v;
|
|
if (callback != null) {
|
|
callback.a(menuBuilder);
|
|
}
|
|
}
|
|
}
|
|
|
|
public ActionMenuView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
setBaselineAligned(false);
|
|
float f = context.getResources().getDisplayMetrics().density;
|
|
this.z = (int) (56.0f * f);
|
|
this.A = (int) (f * 4.0f);
|
|
this.q = context;
|
|
this.r = 0;
|
|
}
|
|
|
|
protected boolean d(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 = false | ((ActionMenuChildView) childAt).b();
|
|
}
|
|
return (i <= 0 || !(childAt2 instanceof ActionMenuChildView)) ? z : z | ((ActionMenuChildView) childAt2).c();
|
|
}
|
|
|
|
/* 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.b = 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) {
|
|
if (layoutParams != null) {
|
|
LayoutParams layoutParams2 = layoutParams instanceof LayoutParams ? new LayoutParams((LayoutParams) layoutParams) : new LayoutParams(layoutParams);
|
|
if (layoutParams2.b <= 0) {
|
|
layoutParams2.b = 16;
|
|
}
|
|
return layoutParams2;
|
|
}
|
|
return generateDefaultLayoutParams();
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuBuilder.ItemInvoker
|
|
public boolean a(MenuItemImpl menuItemImpl) {
|
|
return this.p.a(menuItemImpl, 0);
|
|
}
|
|
|
|
@Override // androidx.appcompat.view.menu.MenuView
|
|
public void a(MenuBuilder menuBuilder) {
|
|
this.p = menuBuilder;
|
|
}
|
|
|
|
public void a(MenuPresenter.Callback callback, MenuBuilder.Callback callback2) {
|
|
this.u = callback;
|
|
this.v = callback2;
|
|
}
|
|
}
|