534 lines
19 KiB
Java
534 lines
19 KiB
Java
package com.google.android.material.checkbox;
|
|
|
|
import android.R;
|
|
import android.content.Context;
|
|
import android.content.res.ColorStateList;
|
|
import android.content.res.Resources;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Color;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.AnimatedStateListDrawable;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.os.Build;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import android.text.SpannableString;
|
|
import android.text.Spanned;
|
|
import android.text.SpannedString;
|
|
import android.text.TextUtils;
|
|
import android.util.AttributeSet;
|
|
import android.util.Base64;
|
|
import android.util.TypedValue;
|
|
import android.view.View;
|
|
import android.view.accessibility.AccessibilityNodeInfo;
|
|
import android.view.autofill.AutofillManager;
|
|
import android.widget.CompoundButton;
|
|
import androidx.appcompat.widget.AppCompatCheckBox;
|
|
import androidx.core.view.ViewCompat;
|
|
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
|
|
import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat;
|
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import com.google.firebase.crashlytics.internal.common.AbstractSpiCall;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashSet;
|
|
import o.AgY;
|
|
import o.C16528pAJ;
|
|
import o.C17052tZT;
|
|
import o.NiE;
|
|
import o.Rez;
|
|
import o.TZc;
|
|
import o.Tlu;
|
|
import o.nMh;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class MaterialCheckBox extends AppCompatCheckBox {
|
|
private static int A = 1;
|
|
private static byte B;
|
|
private static int D;
|
|
private static final int[] a;
|
|
private static final int[][] b;
|
|
private static final int e;
|
|
private static final int[] f;
|
|
private static final int i;
|
|
ColorStateList c;
|
|
int[] d;
|
|
private Drawable g;
|
|
private boolean h;
|
|
private Drawable j;
|
|
private boolean k;
|
|
private ColorStateList l;
|
|
private PorterDuff.Mode m;
|
|
private CharSequence n;
|
|
|
|
/* renamed from: o, reason: collision with root package name */
|
|
private int f6471o;
|
|
private ColorStateList p;
|
|
private CharSequence q;
|
|
private boolean r;
|
|
private final LinkedHashSet<Sts> s;
|
|
private CompoundButton.OnCheckedChangeListener t;
|
|
private boolean u;
|
|
private final Animatable2Compat.AnimationCallback v;
|
|
private final AnimatedVectorDrawableCompat w;
|
|
private final LinkedHashSet<LWm> x;
|
|
private boolean y;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface LWm {
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface Sts {
|
|
}
|
|
|
|
private void z(String str, Object[] objArr) {
|
|
byte[] decode = Base64.decode(str, 0);
|
|
byte[] bArr = new byte[decode.length];
|
|
for (int i2 = 0; i2 < decode.length; i2++) {
|
|
bArr[i2] = (byte) (decode[(decode.length - i2) - 1] ^ B);
|
|
}
|
|
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
|
|
}
|
|
|
|
static {
|
|
c();
|
|
e = C17052tZT.NHB.Widget_MaterialComponents_CompoundButton_CheckBox;
|
|
f = new int[]{C17052tZT.IeS.state_indeterminate};
|
|
a = new int[]{C17052tZT.IeS.state_error};
|
|
b = new int[][]{new int[]{R.attr.state_enabled, C17052tZT.IeS.state_error}, new int[]{R.attr.state_enabled, R.attr.state_checked}, new int[]{R.attr.state_enabled, -16842912}, new int[]{-16842910, R.attr.state_checked}, new int[]{-16842910, -16842912}};
|
|
i = Resources.getSystem().getIdentifier("btn_check_material_anim", "drawable", AbstractSpiCall.ANDROID_CLIENT_TYPE);
|
|
}
|
|
|
|
public MaterialCheckBox(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
public MaterialCheckBox(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, C17052tZT.IeS.checkboxStyle);
|
|
}
|
|
|
|
/* JADX WARN: Illegal instructions before constructor call */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
public MaterialCheckBox(android.content.Context r11, android.util.AttributeSet r12, int r13) {
|
|
/*
|
|
Method dump skipped, instructions count: 266
|
|
To view this dump add '--comments-level debug' option
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.checkbox.MaterialCheckBox.<init>(android.content.Context, android.util.AttributeSet, int):void");
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
|
protected void onDraw(Canvas canvas) {
|
|
Drawable uY_;
|
|
if (this.k && TextUtils.isEmpty(getText()) && (uY_ = C16528pAJ.uY_(this)) != null) {
|
|
int width = ((getWidth() - uY_.getIntrinsicWidth()) / 2) * (ViewCompat.m(this) == 1 ? -1 : 1);
|
|
int save = canvas.save();
|
|
canvas.translate(width, BitmapDescriptorFactory.HUE_RED);
|
|
super.onDraw(canvas);
|
|
canvas.restoreToCount(save);
|
|
if (getBackground() != null) {
|
|
Rect bounds = uY_.getBounds();
|
|
Tlu.pC_(getBackground(), bounds.left + width, bounds.top, bounds.right + width, bounds.bottom);
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
super.onDraw(canvas);
|
|
}
|
|
|
|
@Override // android.widget.TextView, android.view.View
|
|
protected void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
if (this.u && this.c == null && this.l == null) {
|
|
setUseMaterialThemeColors(true);
|
|
}
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
|
protected int[] onCreateDrawableState(int i2) {
|
|
int[] onCreateDrawableState = super.onCreateDrawableState(i2 + 2);
|
|
if (this.f6471o == 2) {
|
|
mergeDrawableStates(onCreateDrawableState, f);
|
|
}
|
|
if (this.r) {
|
|
mergeDrawableStates(onCreateDrawableState, a);
|
|
}
|
|
this.d = NiE.c(onCreateDrawableState);
|
|
return onCreateDrawableState;
|
|
}
|
|
|
|
@Override // android.widget.TextView, android.view.View
|
|
public void setEnabled(boolean z) {
|
|
super.setEnabled(z);
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.Checkable
|
|
public void setChecked(boolean z) {
|
|
setCheckedState(z ? 1 : 0);
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.Checkable
|
|
public void toggle() {
|
|
setChecked(!isChecked());
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
|
|
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
|
|
if (accessibilityNodeInfo != null && this.r) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append((Object) accessibilityNodeInfo.getText());
|
|
sb.append(", ");
|
|
sb.append((Object) this.q);
|
|
accessibilityNodeInfo.setText(sb.toString());
|
|
}
|
|
}
|
|
|
|
public void setCheckedState(int i2) {
|
|
CompoundButton.OnCheckedChangeListener onCheckedChangeListener;
|
|
if (this.f6471o != i2) {
|
|
this.f6471o = i2;
|
|
super.setChecked(i2 == 1);
|
|
refreshDrawableState();
|
|
e();
|
|
if (this.h) {
|
|
return;
|
|
}
|
|
this.h = true;
|
|
LinkedHashSet<Sts> linkedHashSet = this.s;
|
|
if (linkedHashSet != null) {
|
|
Iterator<Sts> it = linkedHashSet.iterator();
|
|
while (it.hasNext()) {
|
|
it.next();
|
|
}
|
|
}
|
|
if (this.f6471o != 2 && (onCheckedChangeListener = this.t) != null) {
|
|
onCheckedChangeListener.onCheckedChanged(this, isChecked());
|
|
}
|
|
AutofillManager autofillManager = (AutofillManager) getContext().getSystemService(AutofillManager.class);
|
|
if (autofillManager != null) {
|
|
autofillManager.notifyValueChanged(this);
|
|
}
|
|
this.h = false;
|
|
}
|
|
}
|
|
|
|
public void setErrorShown(boolean z) {
|
|
if (this.r == z) {
|
|
return;
|
|
}
|
|
this.r = z;
|
|
refreshDrawableState();
|
|
Iterator<LWm> it = this.x.iterator();
|
|
while (it.hasNext()) {
|
|
it.next();
|
|
}
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v3, types: [android.text.SpannableString, android.text.Spannable] */
|
|
/* JADX WARN: Type inference failed for: r8v0, types: [com.google.android.material.checkbox.MaterialCheckBox, android.view.View] */
|
|
public void setErrorAccessibilityLabelResource(int i2) {
|
|
String str;
|
|
int i3 = 2 % 2;
|
|
int i4 = D;
|
|
int i5 = i4 + 51;
|
|
A = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
if (i2 != 0) {
|
|
int i7 = i4 + 25;
|
|
A = i7 % 128;
|
|
int i8 = i7 % 2;
|
|
Resources resources = getResources();
|
|
str = resources.getString(i2);
|
|
if (str.startsWith(",*,)")) {
|
|
Object[] objArr = new Object[1];
|
|
z(str.substring(4), objArr);
|
|
str = ((String) objArr[0]).intern();
|
|
CharSequence text = resources.getText(i2);
|
|
if (text instanceof Spanned) {
|
|
?? spannableString = new SpannableString(str);
|
|
TextUtils.copySpansFrom((SpannedString) text, 0, str.length(), Object.class, spannableString, 0);
|
|
str = spannableString;
|
|
}
|
|
}
|
|
} else {
|
|
str = null;
|
|
}
|
|
setErrorAccessibilityLabel(str);
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatCheckBox, android.widget.CompoundButton
|
|
public void setButtonDrawable(int i2) {
|
|
setButtonDrawable(AgY.dT_(getContext(), i2));
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatCheckBox, android.widget.CompoundButton
|
|
public void setButtonDrawable(Drawable drawable) {
|
|
this.g = drawable;
|
|
this.y = false;
|
|
d();
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton
|
|
public void setButtonTintList(ColorStateList colorStateList) {
|
|
if (this.c == colorStateList) {
|
|
return;
|
|
}
|
|
this.c = colorStateList;
|
|
d();
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton
|
|
public void setButtonTintMode(PorterDuff.Mode mode) {
|
|
setSupportButtonTintMode(mode);
|
|
d();
|
|
}
|
|
|
|
public void setButtonIconDrawableResource(int i2) {
|
|
setButtonIconDrawable(AgY.dT_(getContext(), i2));
|
|
}
|
|
|
|
public void setButtonIconDrawable(Drawable drawable) {
|
|
this.j = drawable;
|
|
d();
|
|
}
|
|
|
|
public void setButtonIconTintList(ColorStateList colorStateList) {
|
|
if (this.l == colorStateList) {
|
|
return;
|
|
}
|
|
this.l = colorStateList;
|
|
d();
|
|
}
|
|
|
|
public void setButtonIconTintMode(PorterDuff.Mode mode) {
|
|
if (this.m == mode) {
|
|
return;
|
|
}
|
|
this.m = mode;
|
|
d();
|
|
}
|
|
|
|
public void setUseMaterialThemeColors(boolean z) {
|
|
int i2;
|
|
int i3;
|
|
int i4;
|
|
int i5;
|
|
this.u = z;
|
|
if (z) {
|
|
if (this.p == null) {
|
|
int[][] iArr = b;
|
|
int[] iArr2 = new int[iArr.length];
|
|
int i6 = C17052tZT.IeS.colorControlActivated;
|
|
Context context = getContext();
|
|
TypedValue Kt_ = TZc.Kt_(getContext(), i6, getClass().getCanonicalName());
|
|
if (Kt_.resourceId != 0) {
|
|
i2 = nMh.getColor(context, Kt_.resourceId);
|
|
} else {
|
|
i2 = Kt_.data;
|
|
}
|
|
int i7 = C17052tZT.IeS.colorError;
|
|
Context context2 = getContext();
|
|
TypedValue Kt_2 = TZc.Kt_(getContext(), i7, getClass().getCanonicalName());
|
|
if (Kt_2.resourceId != 0) {
|
|
i3 = nMh.getColor(context2, Kt_2.resourceId);
|
|
} else {
|
|
i3 = Kt_2.data;
|
|
}
|
|
int i8 = C17052tZT.IeS.colorSurface;
|
|
Context context3 = getContext();
|
|
TypedValue Kt_3 = TZc.Kt_(getContext(), i8, getClass().getCanonicalName());
|
|
if (Kt_3.resourceId != 0) {
|
|
i4 = nMh.getColor(context3, Kt_3.resourceId);
|
|
} else {
|
|
i4 = Kt_3.data;
|
|
}
|
|
int i9 = C17052tZT.IeS.colorOnSurface;
|
|
Context context4 = getContext();
|
|
TypedValue Kt_4 = TZc.Kt_(getContext(), i9, getClass().getCanonicalName());
|
|
if (Kt_4.resourceId != 0) {
|
|
i5 = nMh.getColor(context4, Kt_4.resourceId);
|
|
} else {
|
|
i5 = Kt_4.data;
|
|
}
|
|
iArr2[0] = Rez.a(Rez.d(i3, Math.round(Color.alpha(i3))), i4);
|
|
iArr2[1] = Rez.a(Rez.d(i2, Math.round(Color.alpha(i2))), i4);
|
|
iArr2[2] = Rez.a(Rez.d(i5, Math.round(Color.alpha(i5) * 0.54f)), i4);
|
|
iArr2[3] = Rez.a(Rez.d(i5, Math.round(Color.alpha(i5) * 0.38f)), i4);
|
|
iArr2[4] = Rez.a(Rez.d(i5, Math.round(Color.alpha(i5) * 0.38f)), i4);
|
|
this.p = new ColorStateList(iArr, iArr2);
|
|
}
|
|
C16528pAJ.vb_(this, this.p);
|
|
return;
|
|
}
|
|
C16528pAJ.vb_(this, null);
|
|
}
|
|
|
|
private void d() {
|
|
this.g = NiE.IV_(this.g, this.c, C16528pAJ.va_(this));
|
|
this.j = NiE.IV_(this.j, this.l, this.m);
|
|
a();
|
|
f();
|
|
super.setButtonDrawable(NiE.IU_(this.g, this.j));
|
|
refreshDrawableState();
|
|
}
|
|
|
|
private void a() {
|
|
if (this.y) {
|
|
AnimatedVectorDrawableCompat animatedVectorDrawableCompat = this.w;
|
|
if (animatedVectorDrawableCompat != null) {
|
|
animatedVectorDrawableCompat.e(this.v);
|
|
this.w.a(this.v);
|
|
}
|
|
Drawable drawable = this.g;
|
|
if (!(drawable instanceof AnimatedStateListDrawable) || this.w == null) {
|
|
return;
|
|
}
|
|
((AnimatedStateListDrawable) drawable).addTransition(C17052tZT.ZqN.checked, C17052tZT.ZqN.unchecked, this.w, false);
|
|
((AnimatedStateListDrawable) this.g).addTransition(C17052tZT.ZqN.indeterminate, C17052tZT.ZqN.unchecked, this.w, false);
|
|
}
|
|
}
|
|
|
|
private void f() {
|
|
ColorStateList colorStateList;
|
|
ColorStateList colorStateList2;
|
|
Drawable drawable = this.g;
|
|
if (drawable != null && (colorStateList2 = this.c) != null) {
|
|
Tlu.pF_(drawable, colorStateList2);
|
|
}
|
|
Drawable drawable2 = this.j;
|
|
if (drawable2 == null || (colorStateList = this.l) == null) {
|
|
return;
|
|
}
|
|
Tlu.pF_(drawable2, colorStateList);
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.view.View
|
|
public void setStateDescription(CharSequence charSequence) {
|
|
this.n = charSequence;
|
|
if (charSequence == null) {
|
|
e();
|
|
} else {
|
|
super.setStateDescription(charSequence);
|
|
}
|
|
}
|
|
|
|
private void e() {
|
|
String string;
|
|
if (Build.VERSION.SDK_INT < 30 || this.n != null) {
|
|
return;
|
|
}
|
|
int i2 = this.f6471o;
|
|
if (i2 == 1) {
|
|
string = getResources().getString(C17052tZT.ojQ.mtrl_checkbox_state_description_checked);
|
|
} else if (i2 == 0) {
|
|
string = getResources().getString(C17052tZT.ojQ.mtrl_checkbox_state_description_unchecked);
|
|
} else {
|
|
string = getResources().getString(C17052tZT.ojQ.mtrl_checkbox_state_description_indeterminate);
|
|
}
|
|
super.setStateDescription(string);
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
|
public Parcelable onSaveInstanceState() {
|
|
HBt hBt = new HBt(super.onSaveInstanceState());
|
|
hBt.c = this.f6471o;
|
|
return hBt;
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.TextView, android.view.View
|
|
public void onRestoreInstanceState(Parcelable parcelable) {
|
|
if (!(parcelable instanceof HBt)) {
|
|
super.onRestoreInstanceState(parcelable);
|
|
return;
|
|
}
|
|
HBt hBt = (HBt) parcelable;
|
|
super.onRestoreInstanceState(hBt.getSuperState());
|
|
setCheckedState(hBt.c);
|
|
}
|
|
|
|
/* loaded from: classes2.dex */
|
|
static class HBt extends View.BaseSavedState {
|
|
public static final Parcelable.Creator<HBt> CREATOR = new Parcelable.Creator<HBt>() { // from class: com.google.android.material.checkbox.MaterialCheckBox.HBt.2
|
|
@Override // android.os.Parcelable.Creator
|
|
public final /* synthetic */ HBt createFromParcel(Parcel parcel) {
|
|
return new HBt(parcel, (byte) 0);
|
|
}
|
|
|
|
@Override // android.os.Parcelable.Creator
|
|
public final /* bridge */ /* synthetic */ HBt[] newArray(int i) {
|
|
return new HBt[i];
|
|
}
|
|
};
|
|
int c;
|
|
|
|
/* synthetic */ HBt(Parcel parcel, byte b) {
|
|
this(parcel);
|
|
}
|
|
|
|
HBt(Parcelable parcelable) {
|
|
super(parcelable);
|
|
}
|
|
|
|
private HBt(Parcel parcel) {
|
|
super(parcel);
|
|
this.c = ((Integer) parcel.readValue(getClass().getClassLoader())).intValue();
|
|
}
|
|
|
|
@Override // android.view.View.BaseSavedState, android.view.AbsSavedState, android.os.Parcelable
|
|
public final void writeToParcel(Parcel parcel, int i) {
|
|
super.writeToParcel(parcel, i);
|
|
parcel.writeValue(Integer.valueOf(this.c));
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder("MaterialCheckBox.SavedState{");
|
|
sb.append(Integer.toHexString(System.identityHashCode(this)));
|
|
sb.append(" CheckedState=");
|
|
int i = this.c;
|
|
sb.append(i != 1 ? i != 2 ? "unchecked" : "indeterminate" : "checked");
|
|
sb.append(UrlTreeKt.componentParamSuffix);
|
|
return sb.toString();
|
|
}
|
|
}
|
|
|
|
static void c() {
|
|
B = (byte) 6;
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton
|
|
public void setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
|
|
this.t = onCheckedChangeListener;
|
|
}
|
|
|
|
public void setErrorAccessibilityLabel(CharSequence charSequence) {
|
|
this.q = charSequence;
|
|
}
|
|
|
|
public void setCenterIfNoTextEnabled(boolean z) {
|
|
this.k = z;
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton, android.widget.Checkable
|
|
public boolean isChecked() {
|
|
return this.f6471o == 1;
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton
|
|
public ColorStateList getButtonTintList() {
|
|
return this.c;
|
|
}
|
|
|
|
@Override // android.widget.CompoundButton
|
|
public Drawable getButtonDrawable() {
|
|
return this.g;
|
|
}
|
|
}
|