what-the-bank/sources/androidx/appcompat/view/menu/ListMenuItemView.java

387 lines
13 KiB
Java

package androidx.appcompat.view.menu;
import android.R;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import o.C0683McA;
import o.SYO;
import o.Sya;
/* loaded from: classes.dex */
public class ListMenuItemView extends LinearLayout implements Sya.HBt, AbsListView.SelectionBoundsAdjuster {
private Drawable a;
private CheckBox b;
private boolean c;
private LinearLayout d;
public MenuItemImpl e;
private ImageView f;
private LayoutInflater g;
private ImageView h;
private boolean i;
private boolean j;
private ImageView k;
private Drawable l;
private TextView m;
private int n;
/* renamed from: o, reason: collision with root package name */
private RadioButton f6369o;
private TextView p;
private Context r;
@Override // o.Sya.HBt
public final boolean b() {
return false;
}
public ListMenuItemView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, SYO.IeS.listMenuViewStyle);
}
public ListMenuItemView(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet);
Context context2 = getContext();
C0683McA c0683McA = new C0683McA(context2, context2.obtainStyledAttributes(attributeSet, SYO.ZqN.MenuView, i, 0));
this.a = c0683McA.jL_(SYO.ZqN.MenuView_android_itemBackground);
this.n = c0683McA.d.getResourceId(SYO.ZqN.MenuView_android_itemTextAppearance, -1);
this.j = c0683McA.d.getBoolean(SYO.ZqN.MenuView_preserveIconSpacing, false);
this.r = context;
this.l = c0683McA.jL_(SYO.ZqN.MenuView_subMenuArrow);
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, new int[]{R.attr.divider}, SYO.IeS.dropDownListViewStyle, 0);
this.i = obtainStyledAttributes.hasValue(0);
c0683McA.d.recycle();
obtainStyledAttributes.recycle();
}
@Override // android.view.View
protected void onFinishInflate() {
super.onFinishInflate();
ViewCompat.sn_(this, this.a);
TextView textView = (TextView) findViewById(SYO.saX.title);
this.p = textView;
int i = this.n;
if (i != -1) {
textView.setTextAppearance(this.r, i);
}
this.m = (TextView) findViewById(SYO.saX.shortcut);
ImageView imageView = (ImageView) findViewById(SYO.saX.submenuarrow);
this.k = imageView;
if (imageView != null) {
imageView.setImageDrawable(this.l);
}
this.h = (ImageView) findViewById(SYO.saX.group_divider);
this.d = (LinearLayout) findViewById(SYO.saX.content);
}
/* JADX WARN: Removed duplicated region for block: B:16:0x004c */
/* JADX WARN: Removed duplicated region for block: B:19:0x006a */
/* JADX WARN: Removed duplicated region for block: B:25:0x004f */
@Override // o.Sya.HBt
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void c(androidx.appcompat.view.menu.MenuItemImpl r5) {
/*
r4 = this;
r4.e = r5
boolean r0 = r5.isVisible()
r1 = 8
r2 = 0
if (r0 == 0) goto Ld
r0 = r2
goto Le
Ld:
r0 = r1
Le:
r4.setVisibility(r0)
boolean r0 = r4.b()
if (r0 == 0) goto L1c
java.lang.CharSequence r0 = r5.getTitleCondensed()
goto L20
L1c:
java.lang.CharSequence r0 = r5.getTitle()
L20:
r4.setTitle(r0)
boolean r0 = r5.isCheckable()
r4.setCheckable(r0)
o.NoP r0 = r5.e
boolean r0 = r0.h()
if (r0 == 0) goto L43
o.NoP r0 = r5.e
boolean r0 = r0.g()
if (r0 == 0) goto L3d
char r0 = r5.f
goto L3f
L3d:
char r0 = r5.g
L3f:
if (r0 == 0) goto L43
r0 = 1
goto L44
L43:
r0 = r2
L44:
o.NoP r3 = r5.e
boolean r3 = r3.g()
if (r3 == 0) goto L4f
char r3 = r5.f
goto L51
L4f:
char r3 = r5.g
L51:
r4.setShortcut(r0, r3)
android.graphics.drawable.Drawable r0 = r5.getIcon()
r4.setIcon(r0)
boolean r0 = r5.isEnabled()
r4.setEnabled(r0)
boolean r0 = r5.hasSubMenu()
android.widget.ImageView r3 = r4.k
if (r3 == 0) goto L70
if (r0 == 0) goto L6d
r1 = r2
L6d:
r3.setVisibility(r1)
L70:
java.lang.CharSequence r5 = r5.getContentDescription()
r4.setContentDescription(r5)
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.menu.ListMenuItemView.c(androidx.appcompat.view.menu.MenuItemImpl):void");
}
public void setTitle(CharSequence charSequence) {
if (charSequence != null) {
this.p.setText(charSequence);
if (this.p.getVisibility() != 0) {
this.p.setVisibility(0);
return;
}
return;
}
if (this.p.getVisibility() != 8) {
this.p.setVisibility(8);
}
}
/* JADX WARN: Removed duplicated region for block: B:10:0x0021 */
/* JADX WARN: Removed duplicated region for block: B:13:0x0034 */
/* JADX WARN: Removed duplicated region for block: B:16:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void setShortcut(boolean r2, char r3) {
/*
r1 = this;
if (r2 == 0) goto L1d
androidx.appcompat.view.menu.MenuItemImpl r2 = r1.e
o.NoP r3 = r2.e
boolean r3 = r3.h()
if (r3 == 0) goto L1d
o.NoP r3 = r2.e
boolean r3 = r3.g()
if (r3 == 0) goto L17
char r2 = r2.f
goto L19
L17:
char r2 = r2.g
L19:
if (r2 == 0) goto L1d
r2 = 0
goto L1f
L1d:
r2 = 8
L1f:
if (r2 != 0) goto L2c
android.widget.TextView r3 = r1.m
androidx.appcompat.view.menu.MenuItemImpl r0 = r1.e
java.lang.String r0 = r0.c()
r3.setText(r0)
L2c:
android.widget.TextView r3 = r1.m
int r3 = r3.getVisibility()
if (r3 == r2) goto L39
android.widget.TextView r3 = r1.m
r3.setVisibility(r2)
L39:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.menu.ListMenuItemView.setShortcut(boolean, char):void");
}
public void setIcon(Drawable drawable) {
boolean z = this.e.e.k;
boolean z2 = this.c;
if (z2 || this.j) {
ImageView imageView = this.f;
if (imageView == null && drawable == null && !this.j) {
return;
}
if (imageView == null) {
if (this.g == null) {
this.g = LayoutInflater.from(getContext());
}
ImageView imageView2 = (ImageView) this.g.inflate(SYO.ojQ.abc_list_menu_item_icon, (ViewGroup) this, false);
this.f = imageView2;
LinearLayout linearLayout = this.d;
if (linearLayout != null) {
linearLayout.addView(imageView2, 0);
} else {
addView(imageView2, 0);
}
}
if (drawable != null || this.j) {
ImageView imageView3 = this.f;
if (!z2) {
drawable = null;
}
imageView3.setImageDrawable(drawable);
if (this.f.getVisibility() != 0) {
this.f.setVisibility(0);
return;
}
return;
}
this.f.setVisibility(8);
}
}
@Override // android.widget.LinearLayout, android.view.View
protected void onMeasure(int i, int i2) {
if (this.f != null && this.j) {
ViewGroup.LayoutParams layoutParams = getLayoutParams();
LinearLayout.LayoutParams layoutParams2 = (LinearLayout.LayoutParams) this.f.getLayoutParams();
if (layoutParams.height > 0 && ((ViewGroup.LayoutParams) layoutParams2).width <= 0) {
((ViewGroup.LayoutParams) layoutParams2).width = layoutParams.height;
}
}
super.onMeasure(i, i2);
}
private void c() {
if (this.g == null) {
this.g = LayoutInflater.from(getContext());
}
RadioButton radioButton = (RadioButton) this.g.inflate(SYO.ojQ.abc_list_menu_item_radio, (ViewGroup) this, false);
this.f6369o = radioButton;
LinearLayout linearLayout = this.d;
if (linearLayout != null) {
linearLayout.addView(radioButton, -1);
} else {
addView(radioButton, -1);
}
}
private void d() {
if (this.g == null) {
this.g = LayoutInflater.from(getContext());
}
CheckBox checkBox = (CheckBox) this.g.inflate(SYO.ojQ.abc_list_menu_item_checkbox, (ViewGroup) this, false);
this.b = checkBox;
LinearLayout linearLayout = this.d;
if (linearLayout != null) {
linearLayout.addView(checkBox, -1);
} else {
addView(checkBox, -1);
}
}
public void setGroupDividerEnabled(boolean z) {
ImageView imageView = this.h;
if (imageView != null) {
imageView.setVisibility((this.i || !z) ? 8 : 0);
}
}
@Override // android.widget.AbsListView.SelectionBoundsAdjuster
public void adjustListItemSelectionBounds(Rect rect) {
ImageView imageView = this.h;
if (imageView == null || imageView.getVisibility() != 0) {
return;
}
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.h.getLayoutParams();
rect.top += this.h.getHeight() + ((ViewGroup.MarginLayoutParams) layoutParams).topMargin + ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin;
}
public void setCheckable(boolean z) {
CompoundButton compoundButton;
View view;
if (!z && this.f6369o == null && this.b == null) {
return;
}
if ((this.e.a & 4) != 0) {
if (this.f6369o == null) {
c();
}
compoundButton = this.f6369o;
view = this.b;
} else {
if (this.b == null) {
d();
}
compoundButton = this.b;
view = this.f6369o;
}
if (z) {
compoundButton.setChecked(this.e.isChecked());
if (compoundButton.getVisibility() != 0) {
compoundButton.setVisibility(0);
}
if (view == null || view.getVisibility() == 8) {
return;
}
view.setVisibility(8);
return;
}
CheckBox checkBox = this.b;
if (checkBox != null) {
checkBox.setVisibility(8);
}
RadioButton radioButton = this.f6369o;
if (radioButton != null) {
radioButton.setVisibility(8);
}
}
public void setChecked(boolean z) {
CompoundButton compoundButton;
if ((this.e.a & 4) != 0) {
if (this.f6369o == null) {
c();
}
compoundButton = this.f6369o;
} else {
if (this.b == null) {
d();
}
compoundButton = this.b;
}
compoundButton.setChecked(z);
}
public void setForceShowIcon(boolean z) {
this.c = z;
this.j = z;
}
@Override // o.Sya.HBt
public final MenuItemImpl a() {
return this.e;
}
}