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

792 lines
22 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package androidx.appcompat.view.menu;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.Base64;
import android.view.ActionProvider;
import android.view.ContextMenu;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewDebug;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import java.nio.charset.StandardCharsets;
import o.AgY;
import o.NoP;
import o.SYO;
import o.SubMenuC16744qqn;
import o.Tlu;
import o.hbU;
import o.tkI;
/* loaded from: classes.dex */
public final class MenuItemImpl implements tkI {
private static int E = 1;
private static int F = 0;
private static byte H = 6;
private CharSequence A;
private CharSequence C;
private CharSequence D;
public final int c;
public hbU d;
public NoP e;
char f;
char g;
public SubMenuC16744qqn h;
public int i;
private View j;
private MenuItem.OnMenuItemClickListener k;
private final int l;
private CharSequence m;
private final int mId;
/* renamed from: o, reason: collision with root package name */
private final int f6370o;
private Drawable s;
private Intent u;
private Runnable v;
private MenuItem.OnActionExpandListener w;
private ContextMenu.ContextMenuInfo x;
private int z = 4096;
private int B = 4096;
private int t = 0;
private ColorStateList q = null;
private PorterDuff.Mode p = null;
private boolean n = false;
private boolean r = false;
private boolean y = false;
public int a = 16;
public boolean b = false;
private void G(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ H);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
@Override // o.tkI, android.view.MenuItem
public final /* synthetic */ MenuItem setActionView(int i) {
Context context = this.e.d;
setActionView(LayoutInflater.from(context).inflate(i, (ViewGroup) new LinearLayout(context), false));
return this;
}
@Override // o.tkI, android.view.MenuItem
public final /* synthetic */ MenuItem setContentDescription(CharSequence charSequence) {
this.m = charSequence;
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final /* synthetic */ MenuItem setTooltipText(CharSequence charSequence) {
this.D = charSequence;
this.e.c(false);
return this;
}
public MenuItemImpl(NoP noP, int i, int i2, int i3, int i4, CharSequence charSequence, int i5) {
this.e = noP;
this.mId = i2;
this.l = i;
this.f6370o = i3;
this.c = i4;
this.A = charSequence;
this.i = i5;
}
public final boolean a() {
MenuItem.OnMenuItemClickListener onMenuItemClickListener = this.k;
if (onMenuItemClickListener != null && onMenuItemClickListener.onMenuItemClick(this)) {
return true;
}
NoP noP = this.e;
if (noP.fe_(noP, this)) {
return true;
}
if (this.u != null) {
try {
this.e.d.startActivity(this.u);
return true;
} catch (ActivityNotFoundException unused) {
}
}
hbU hbu = this.d;
return hbu != null && hbu.e();
}
@Override // android.view.MenuItem
public final MenuItem setEnabled(boolean z) {
this.a = z ? this.a | 16 : this.a & (-17);
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setAlphabeticShortcut(char c) {
if (this.f == c) {
return this;
}
this.f = Character.toLowerCase(c);
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final MenuItem setAlphabeticShortcut(char c, int i) {
if (this.f == c && this.B == i) {
return this;
}
this.f = Character.toLowerCase(c);
this.B = KeyEvent.normalizeMetaState(i);
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setNumericShortcut(char c) {
if (this.g == c) {
return this;
}
this.g = c;
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final MenuItem setNumericShortcut(char c, int i) {
if (this.g == c && this.z == i) {
return this;
}
this.g = c;
this.z = KeyEvent.normalizeMetaState(i);
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setShortcut(char c, char c2) {
this.g = c;
this.f = Character.toLowerCase(c2);
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final MenuItem setShortcut(char c, char c2, int i, int i2) {
this.g = c;
this.z = KeyEvent.normalizeMetaState(i);
this.f = Character.toLowerCase(c2);
this.B = KeyEvent.normalizeMetaState(i2);
this.e.c(false);
return this;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final String c() {
char c;
int i = 2 % 2;
Object obj = null;
if (this.e.g()) {
int i2 = F + 123;
E = i2 % 128;
if (i2 % 2 == 0) {
obj.hashCode();
throw null;
}
c = this.f;
} else {
c = this.g;
}
if (c == 0) {
return "";
}
Resources resources = this.e.d.getResources();
StringBuilder sb = new StringBuilder();
if (ViewConfiguration.get(this.e.d).hasPermanentMenuKey()) {
sb.append(resources.getString(SYO.tOB.abc_prepend_shortcut_label));
}
int i3 = this.e.g() ^ true ? this.z : this.B;
String string = resources.getString(SYO.tOB.abc_menu_meta_shortcut_label);
if (string.startsWith(",*,)")) {
Object[] objArr = new Object[1];
G(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
}
if ((i3 & 65536) == 65536) {
int i4 = F + 117;
E = i4 % 128;
if (i4 % 2 == 0) {
sb.append(string);
obj.hashCode();
throw null;
}
sb.append(string);
}
String string2 = resources.getString(SYO.tOB.abc_menu_ctrl_shortcut_label);
if (string2.startsWith(",*,)")) {
int i5 = E + 15;
F = i5 % 128;
if (i5 % 2 != 0) {
Object[] objArr2 = new Object[1];
G(string2.substring(4), objArr2);
string2 = ((String) objArr2[0]).intern();
int i6 = 49 / 0;
} else {
Object[] objArr3 = new Object[1];
G(string2.substring(4), objArr3);
string2 = ((String) objArr3[0]).intern();
}
}
if ((i3 & 4096) == 4096) {
int i7 = E + 117;
F = i7 % 128;
if (i7 % 2 != 0) {
sb.append(string2);
obj.hashCode();
throw null;
}
sb.append(string2);
}
String string3 = resources.getString(SYO.tOB.abc_menu_alt_shortcut_label);
if (string3.startsWith(",*,)")) {
int i8 = F + 51;
E = i8 % 128;
int i9 = i8 % 2;
Object[] objArr4 = new Object[1];
G(string3.substring(4), objArr4);
string3 = ((String) objArr4[0]).intern();
}
if ((i3 & 2) == 2) {
sb.append(string3);
}
String string4 = resources.getString(SYO.tOB.abc_menu_shift_shortcut_label);
if (string4.startsWith(",*,)")) {
Object[] objArr5 = new Object[1];
G(string4.substring(4), objArr5);
string4 = ((String) objArr5[0]).intern();
}
if ((i3 & 1) == 1) {
sb.append(string4);
}
String string5 = resources.getString(SYO.tOB.abc_menu_sym_shortcut_label);
if (string5.startsWith(",*,)")) {
int i10 = E + 5;
F = i10 % 128;
if (i10 % 2 != 0) {
Object[] objArr6 = new Object[1];
G(string5.substring(4), objArr6);
((String) objArr6[0]).intern();
throw null;
}
String substring = string5.substring(4);
Object[] objArr7 = new Object[1];
G(substring, objArr7);
string5 = ((String) objArr7[0]).intern();
}
if ((i3 & 4) == 4) {
sb.append(string5);
}
String string6 = resources.getString(SYO.tOB.abc_menu_function_shortcut_label);
if (string6.startsWith(",*,)")) {
int i11 = F + 121;
E = i11 % 128;
int i12 = i11 % 2;
Object[] objArr8 = new Object[1];
G(string6.substring(4), objArr8);
string6 = ((String) objArr8[0]).intern();
int i13 = F + 85;
E = i13 % 128;
int i14 = i13 % 2;
}
if ((i3 & 8) == 8) {
int i15 = E + 121;
F = i15 % 128;
int i16 = i15 % 2;
sb.append(string6);
}
if (c == '\b') {
sb.append(resources.getString(SYO.tOB.abc_menu_delete_shortcut_label));
} else if (c == '\n') {
sb.append(resources.getString(SYO.tOB.abc_menu_enter_shortcut_label));
} else if (c != ' ') {
sb.append(c);
} else {
sb.append(resources.getString(SYO.tOB.abc_menu_space_shortcut_label));
}
return sb.toString();
}
@Override // android.view.MenuItem
public final MenuItem setTitle(CharSequence charSequence) {
this.A = charSequence;
this.e.c(false);
SubMenuC16744qqn subMenuC16744qqn = this.h;
if (subMenuC16744qqn != null) {
subMenuC16744qqn.setHeaderTitle(charSequence);
}
return this;
}
@Override // android.view.MenuItem
public final MenuItem setTitle(int i) {
int i2 = 2 % 2;
int i3 = E + 27;
F = i3 % 128;
int i4 = i3 % 2;
String string = this.e.d.getString(i);
if (string.startsWith(",*,)")) {
int i5 = F + 61;
E = i5 % 128;
int i6 = i5 % 2;
String substring = string.substring(4);
if (i6 == 0) {
Object[] objArr = new Object[1];
G(substring, objArr);
((String) objArr[0]).intern();
throw null;
}
Object[] objArr2 = new Object[1];
G(substring, objArr2);
string = ((String) objArr2[0]).intern();
}
return setTitle(string);
}
@Override // android.view.MenuItem
public final MenuItem setTitleCondensed(CharSequence charSequence) {
this.C = charSequence;
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final Drawable getIcon() {
Drawable drawable = this.s;
if (drawable != null) {
return eR_(drawable);
}
if (this.t == 0) {
return null;
}
Drawable dT_ = AgY.dT_(this.e.d, this.t);
this.t = 0;
this.s = dT_;
return eR_(dT_);
}
@Override // android.view.MenuItem
public final MenuItem setIcon(Drawable drawable) {
this.t = 0;
this.s = drawable;
this.y = true;
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setIcon(int i) {
this.s = null;
this.t = i;
this.y = true;
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final MenuItem setIconTintList(ColorStateList colorStateList) {
this.q = colorStateList;
this.n = true;
this.y = true;
this.e.c(false);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final MenuItem setIconTintMode(PorterDuff.Mode mode) {
this.p = mode;
this.r = true;
this.y = true;
this.e.c(false);
return this;
}
private Drawable eR_(Drawable drawable) {
if (drawable != null && this.y && (this.n || this.r)) {
drawable = Tlu.pI_(drawable).mutate();
if (this.n) {
Tlu.pF_(drawable, this.q);
}
if (this.r) {
Tlu.pG_(drawable, this.p);
}
this.y = false;
}
return drawable;
}
@Override // android.view.MenuItem
public final MenuItem setCheckable(boolean z) {
int i = this.a;
int i2 = (z ? 1 : 0) | (i & (-2));
this.a = i2;
if (i != i2) {
this.e.c(false);
}
return this;
}
private void d(boolean z) {
int i = this.a;
int i2 = (z ? 2 : 0) | (i & (-3));
this.a = i2;
if (i != i2) {
this.e.c(false);
}
}
@Override // android.view.MenuItem
public final boolean isVisible() {
hbU hbu = this.d;
return (hbu == null || !hbu.c()) ? (this.a & 8) == 0 : (this.a & 8) == 0 && this.d.d();
}
@Override // android.view.MenuItem
public final MenuItem setVisible(boolean z) {
if (e(z)) {
NoP noP = this.e;
noP.g = true;
noP.c(true);
}
return this;
}
public final String toString() {
CharSequence charSequence = this.A;
if (charSequence != null) {
return charSequence.toString();
}
return null;
}
@Override // o.tkI, android.view.MenuItem
public final void setShowAsAction(int i) {
int i2 = i & 3;
if (i2 != 0 && i2 != 1 && i2 != 2) {
throw new IllegalArgumentException("SHOW_AS_ACTION_ALWAYS, SHOW_AS_ACTION_IF_ROOM, and SHOW_AS_ACTION_NEVER are mutually exclusive.");
}
this.i = i;
NoP noP = this.e;
noP.f = true;
noP.c(true);
}
/* JADX INFO: Access modifiers changed from: private */
@Override // o.tkI, android.view.MenuItem
/* renamed from: a, reason: merged with bridge method [inline-methods] */
public tkI setActionView(View view) {
int i;
this.j = view;
this.d = null;
if (view != null && view.getId() == -1 && (i = this.mId) > 0) {
view.setId(i);
}
NoP noP = this.e;
noP.f = true;
noP.c(true);
return this;
}
@Override // o.tkI, android.view.MenuItem
public final View getActionView() {
View view = this.j;
if (view != null) {
return view;
}
hbU hbu = this.d;
if (hbu == null) {
return null;
}
View qQ_ = hbu.qQ_(this);
this.j = qQ_;
return qQ_;
}
@Override // android.view.MenuItem
public final MenuItem setActionProvider(ActionProvider actionProvider) {
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.setActionProvider()");
}
@Override // android.view.MenuItem
public final ActionProvider getActionProvider() {
throw new UnsupportedOperationException("This is not supported, use MenuItemCompat.getActionProvider()");
}
@Override // o.tkI
public final tkI c(hbU hbu) {
hbU hbu2 = this.d;
if (hbu2 != null) {
hbu2.h();
}
this.j = null;
this.d = hbu;
this.e.c(true);
hbU hbu3 = this.d;
if (hbu3 != null) {
hbu3.d(new hbU.Sts(this) { // from class: androidx.appcompat.view.menu.MenuItemImpl.5
final MenuItemImpl c;
{
this.c = this;
}
@Override // o.hbU.Sts
public final void e() {
NoP noP = this.c.e;
noP.g = true;
noP.c(true);
}
});
}
return this;
}
@Override // o.tkI, android.view.MenuItem
public final boolean expandActionView() {
if (!b()) {
return false;
}
MenuItem.OnActionExpandListener onActionExpandListener = this.w;
if (onActionExpandListener == null || onActionExpandListener.onMenuItemActionExpand(this)) {
return this.e.e(this);
}
return false;
}
@Override // o.tkI, android.view.MenuItem
public final boolean collapseActionView() {
if ((this.i & 8) == 0) {
return false;
}
if (this.j == null) {
return true;
}
MenuItem.OnActionExpandListener onActionExpandListener = this.w;
if (onActionExpandListener == null || onActionExpandListener.onMenuItemActionCollapse(this)) {
return this.e.c(this);
}
return false;
}
public final boolean b() {
hbU hbu;
if ((this.i & 8) == 0) {
return false;
}
if (this.j == null && (hbu = this.d) != null) {
this.j = hbu.qQ_(this);
}
return this.j != null;
}
@Override // o.tkI
/* renamed from: a */
public final tkI setContentDescription(CharSequence charSequence) {
this.m = charSequence;
this.e.c(false);
return this;
}
@Override // o.tkI
/* renamed from: c */
public final tkI setTooltipText(CharSequence charSequence) {
this.D = charSequence;
this.e.c(false);
return this;
}
@Override // android.view.MenuItem
public final MenuItem setChecked(boolean z) {
if ((this.a & 4) == 0) {
d(z);
} else {
NoP noP = this.e;
int groupId = getGroupId();
int size = noP.l.size();
if (!noP.t) {
noP.t = true;
noP.n = false;
noP.p = false;
}
for (int i = 0; i < size; i++) {
MenuItemImpl menuItemImpl = noP.l.get(i);
if (menuItemImpl.getGroupId() == groupId && (menuItemImpl.a & 4) != 0 && menuItemImpl.isCheckable()) {
menuItemImpl.d(menuItemImpl == this);
}
}
noP.t = false;
if (noP.n) {
noP.n = false;
noP.c(noP.p);
}
}
return this;
}
@Override // o.tkI, android.view.MenuItem
public final /* synthetic */ MenuItem setShowAsActionFlags(int i) {
setShowAsAction(i);
return this;
}
public final boolean e(boolean z) {
int i = this.a;
int i2 = (z ? 0 : 8) | (i & (-9));
this.a = i2;
return i != i2;
}
@Override // android.view.MenuItem
public final MenuItem setOnMenuItemClickListener(MenuItem.OnMenuItemClickListener onMenuItemClickListener) {
this.k = onMenuItemClickListener;
return this;
}
@Override // android.view.MenuItem
public final MenuItem setOnActionExpandListener(MenuItem.OnActionExpandListener onActionExpandListener) {
this.w = onActionExpandListener;
return this;
}
@Override // android.view.MenuItem
public final MenuItem setIntent(Intent intent) {
this.u = intent;
return this;
}
@Override // android.view.MenuItem
public final boolean isEnabled() {
return (this.a & 16) != 0;
}
@Override // android.view.MenuItem
public final boolean isChecked() {
return (this.a & 2) == 2;
}
@Override // android.view.MenuItem
public final boolean isCheckable() {
return (this.a & 1) == 1;
}
@Override // o.tkI, android.view.MenuItem
public final boolean isActionViewExpanded() {
return this.b;
}
@Override // android.view.MenuItem
public final boolean hasSubMenu() {
return this.h != null;
}
@Override // o.tkI, android.view.MenuItem
public final CharSequence getTooltipText() {
return this.D;
}
@Override // android.view.MenuItem
public final CharSequence getTitleCondensed() {
CharSequence charSequence = this.C;
return charSequence == null ? this.A : charSequence;
}
@Override // android.view.MenuItem
@ViewDebug.CapturedViewProperty
public final CharSequence getTitle() {
return this.A;
}
@Override // o.tkI
public final hbU e() {
return this.d;
}
@Override // android.view.MenuItem
public final SubMenu getSubMenu() {
return this.h;
}
@Override // android.view.MenuItem
public final int getOrder() {
return this.f6370o;
}
@Override // android.view.MenuItem
public final char getNumericShortcut() {
return this.g;
}
@Override // o.tkI, android.view.MenuItem
public final int getNumericModifiers() {
return this.z;
}
@Override // android.view.MenuItem
public final ContextMenu.ContextMenuInfo getMenuInfo() {
return this.x;
}
@Override // android.view.MenuItem
@ViewDebug.CapturedViewProperty
public final int getItemId() {
return this.mId;
}
@Override // android.view.MenuItem
public final Intent getIntent() {
return this.u;
}
@Override // o.tkI, android.view.MenuItem
public final PorterDuff.Mode getIconTintMode() {
return this.p;
}
@Override // o.tkI, android.view.MenuItem
public final ColorStateList getIconTintList() {
return this.q;
}
@Override // android.view.MenuItem
public final int getGroupId() {
return this.l;
}
@Override // o.tkI, android.view.MenuItem
public final CharSequence getContentDescription() {
return this.m;
}
@Override // android.view.MenuItem
public final char getAlphabeticShortcut() {
return this.f;
}
@Override // o.tkI, android.view.MenuItem
public final int getAlphabeticModifiers() {
return this.B;
}
}