what-the-bank/sources/com/google/android/material/timepicker/MaterialTimePicker.java

394 lines
16 KiB
Java

package com.google.android.material.timepicker;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.TextUtils;
import android.util.Base64;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.DialogFragment;
import com.google.android.material.button.MaterialButton;
import com.google.android.material.timepicker.MaterialTimePicker;
import com.google.android.material.timepicker.TimePickerView;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;
import o.C1156Wwv;
import o.C17052tZT;
import o.C4363bXv;
import o.TZc;
import o.VPp;
import o.kxR;
import o.nNq;
/* loaded from: classes2.dex */
public final class MaterialTimePicker extends DialogFragment implements TimePickerView.Sts {
private static int u = 1;
private static byte w = 6;
private static int x;
MaterialButton c;
public kxR d;
private int g;
private Button i;
private int j;
private CharSequence l;
private CharSequence m;
private C1156Wwv p;
private ViewStub q;
private nNq r;
private VPp s;
private TimePickerView t;
private CharSequence y;
final Set<View.OnClickListener> b = new LinkedHashSet();
final Set<View.OnClickListener> e = new LinkedHashSet();
private final Set<DialogInterface.OnCancelListener> f = new LinkedHashSet();
private final Set<DialogInterface.OnDismissListener> h = new LinkedHashSet();
private int v = 0;
private int k = 0;
/* renamed from: o, reason: collision with root package name */
private int f6488o = 0;
int a = 0;
private int n = 0;
private void z(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] ^ w);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
@Override // androidx.fragment.app.DialogFragment
public final Dialog onCreateDialog(Bundle bundle) {
Context requireContext = requireContext();
int i = this.n;
if (i == 0) {
Context requireContext2 = requireContext();
int i2 = C17052tZT.IeS.materialTimePickerTheme;
TypedValue typedValue = new TypedValue();
if (!requireContext2.getTheme().resolveAttribute(i2, typedValue, true)) {
typedValue = null;
}
i = typedValue == null ? 0 : typedValue.data;
}
Dialog dialog = new Dialog(requireContext, i);
Context context = dialog.getContext();
int i3 = TZc.Kt_(context, C17052tZT.IeS.colorSurface, MaterialTimePicker.class.getCanonicalName()).data;
C4363bXv c4363bXv = new C4363bXv(context, null, C17052tZT.IeS.materialTimePickerStyle, C17052tZT.NHB.Widget_MaterialComponents_TimePicker);
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(null, C17052tZT.jNh.MaterialTimePicker, C17052tZT.IeS.materialTimePickerStyle, C17052tZT.NHB.Widget_MaterialComponents_TimePicker);
this.j = obtainStyledAttributes.getResourceId(C17052tZT.jNh.MaterialTimePicker_clockIcon, 0);
this.g = obtainStyledAttributes.getResourceId(C17052tZT.jNh.MaterialTimePicker_keyboardIcon, 0);
obtainStyledAttributes.recycle();
c4363bXv.d(context);
ColorStateList valueOf = ColorStateList.valueOf(i3);
if (c4363bXv.B.d != valueOf) {
c4363bXv.B.d = valueOf;
c4363bXv.onStateChange(c4363bXv.getState());
}
Window window = dialog.getWindow();
window.setBackgroundDrawable(c4363bXv);
window.requestFeature(1);
window.setLayout(-2, -2);
c4363bXv.n(ViewCompat.i(window.getDecorView()));
return dialog;
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public final void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (bundle == null) {
bundle = getArguments();
}
if (bundle != null) {
VPp vPp = (VPp) bundle.getParcelable("TIME_PICKER_TIME_MODEL");
this.s = vPp;
if (vPp == null) {
this.s = new VPp();
}
this.a = bundle.getInt("TIME_PICKER_INPUT_MODE", this.s.e != 1 ? 0 : 1);
this.v = bundle.getInt("TIME_PICKER_TITLE_RES", 0);
this.y = bundle.getCharSequence("TIME_PICKER_TITLE_TEXT");
this.k = bundle.getInt("TIME_PICKER_POSITIVE_BUTTON_TEXT_RES", 0);
this.l = bundle.getCharSequence("TIME_PICKER_POSITIVE_BUTTON_TEXT");
this.f6488o = bundle.getInt("TIME_PICKER_NEGATIVE_BUTTON_TEXT_RES", 0);
this.m = bundle.getCharSequence("TIME_PICKER_NEGATIVE_BUTTON_TEXT");
this.n = bundle.getInt("TIME_PICKER_OVERRIDE_THEME_RES_ID", 0);
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public final void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putParcelable("TIME_PICKER_TIME_MODEL", this.s);
bundle.putInt("TIME_PICKER_INPUT_MODE", this.a);
bundle.putInt("TIME_PICKER_TITLE_RES", this.v);
bundle.putCharSequence("TIME_PICKER_TITLE_TEXT", this.y);
bundle.putInt("TIME_PICKER_POSITIVE_BUTTON_TEXT_RES", this.k);
bundle.putCharSequence("TIME_PICKER_POSITIVE_BUTTON_TEXT", this.l);
bundle.putInt("TIME_PICKER_NEGATIVE_BUTTON_TEXT_RES", this.f6488o);
bundle.putCharSequence("TIME_PICKER_NEGATIVE_BUTTON_TEXT", this.m);
bundle.putInt("TIME_PICKER_OVERRIDE_THEME_RES_ID", this.n);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r3v25, types: [android.text.SpannableString, android.text.Spannable] */
/* JADX WARN: Type inference failed for: r9v10, types: [android.text.SpannableString, android.text.Spannable] */
/* JADX WARN: Type inference failed for: r9v4, types: [android.text.SpannableString, android.text.Spannable] */
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
int i = 2 % 2;
ViewGroup viewGroup2 = (ViewGroup) layoutInflater.inflate(C17052tZT.tOB.material_timepicker_dialog, viewGroup);
TimePickerView timePickerView = (TimePickerView) viewGroup2.findViewById(C17052tZT.ZqN.material_timepicker_view);
this.t = timePickerView;
timePickerView.e = this;
this.q = (ViewStub) viewGroup2.findViewById(C17052tZT.ZqN.material_textinput_timepicker);
this.c = (MaterialButton) viewGroup2.findViewById(C17052tZT.ZqN.material_timepicker_mode_button);
TextView textView = (TextView) viewGroup2.findViewById(C17052tZT.ZqN.header_title);
int i2 = this.v;
if (i2 != 0) {
int i3 = u + 75;
x = i3 % 128;
int i4 = i3 % 2;
Context context = textView.getContext();
String string = context.getString(i2);
if (string.startsWith(",*,)")) {
int i5 = u + 11;
x = i5 % 128;
int i6 = i5 % 2;
Object[] objArr = new Object[1];
z(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
CharSequence text = context.getText(i2);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(string);
TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0);
string = spannableString;
}
}
textView.setText(string);
} else if (!TextUtils.isEmpty(this.y)) {
textView.setText(this.y);
}
a(this.c);
Button button = (Button) viewGroup2.findViewById(C17052tZT.ZqN.material_timepicker_ok_button);
button.setOnClickListener(new View.OnClickListener(this) { // from class: com.google.android.material.timepicker.MaterialTimePicker.1
private MaterialTimePicker e;
{
this.e = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
Iterator<View.OnClickListener> it = this.e.b.iterator();
while (it.hasNext()) {
it.next().onClick(view);
}
this.e.dismiss();
}
});
int i7 = this.k;
if (i7 != 0) {
Context context2 = button.getContext();
String string2 = context2.getString(i7);
if (string2.startsWith(",*,)")) {
Object[] objArr2 = new Object[1];
z(string2.substring(4), objArr2);
string2 = ((String) objArr2[0]).intern();
CharSequence text2 = context2.getText(i7);
if (text2 instanceof Spanned) {
?? spannableString2 = new SpannableString(string2);
TextUtils.copySpansFrom((SpannedString) text2, 0, string2.length(), Object.class, spannableString2, 0);
string2 = spannableString2;
}
}
button.setText(string2);
} else if (!TextUtils.isEmpty(this.l)) {
int i8 = u + 87;
x = i8 % 128;
if (i8 % 2 != 0) {
button.setText(this.l);
throw null;
}
button.setText(this.l);
}
Button button2 = (Button) viewGroup2.findViewById(C17052tZT.ZqN.material_timepicker_cancel_button);
this.i = button2;
button2.setOnClickListener(new View.OnClickListener(this) { // from class: com.google.android.material.timepicker.MaterialTimePicker.3
private MaterialTimePicker a;
{
this.a = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
Iterator<View.OnClickListener> it = this.a.e.iterator();
while (it.hasNext()) {
it.next().onClick(view);
}
this.a.dismiss();
}
});
int i9 = this.f6488o;
if (i9 != 0) {
Button button3 = this.i;
Context context3 = button3.getContext();
String string3 = context3.getString(i9);
if (!(!string3.startsWith(",*,)"))) {
int i10 = x + 109;
u = i10 % 128;
int i11 = i10 % 2;
Object[] objArr3 = new Object[1];
z(string3.substring(4), objArr3);
string3 = ((String) objArr3[0]).intern();
CharSequence text3 = context3.getText(i9);
if (text3 instanceof Spanned) {
?? spannableString3 = new SpannableString(string3);
TextUtils.copySpansFrom((SpannedString) text3, 0, string3.length(), Object.class, spannableString3, 0);
string3 = spannableString3;
}
}
button3.setText(string3);
} else if (!TextUtils.isEmpty(this.m)) {
this.i.setText(this.m);
}
Button button4 = this.i;
if (button4 != null) {
button4.setVisibility(isCancelable() ? 0 : 8);
}
this.c.setOnClickListener(new View.OnClickListener(this) { // from class: com.google.android.material.timepicker.MaterialTimePicker.2
private MaterialTimePicker a;
{
this.a = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
MaterialTimePicker materialTimePicker = this.a;
materialTimePicker.a = materialTimePicker.a == 0 ? 1 : 0;
MaterialTimePicker materialTimePicker2 = this.a;
materialTimePicker2.a(materialTimePicker2.c);
}
});
return viewGroup2;
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
if (this.d instanceof nNq) {
view.postDelayed(new Runnable(this) { // from class: o.iXD
private MaterialTimePicker a;
@Override // java.lang.Runnable
public final void run() {
kxR kxr = this.a.d;
if (kxr instanceof nNq) {
((nNq) kxr).a();
}
}
{
this.a = this;
}
}, 100L);
}
}
@Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment
public final void onDestroyView() {
super.onDestroyView();
this.d = null;
this.p = null;
this.r = null;
TimePickerView timePickerView = this.t;
if (timePickerView != null) {
timePickerView.e = null;
this.t = null;
}
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnCancelListener
public final void onCancel(DialogInterface dialogInterface) {
Iterator<DialogInterface.OnCancelListener> it = this.f.iterator();
while (it.hasNext()) {
it.next().onCancel(dialogInterface);
}
super.onCancel(dialogInterface);
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnDismissListener
public final void onDismiss(DialogInterface dialogInterface) {
Iterator<DialogInterface.OnDismissListener> it = this.h.iterator();
while (it.hasNext()) {
it.next().onDismiss(dialogInterface);
}
super.onDismiss(dialogInterface);
}
@Override // androidx.fragment.app.DialogFragment
public final void setCancelable(boolean z) {
super.setCancelable(z);
Button button = this.i;
if (button != null) {
button.setVisibility(isCancelable() ? 0 : 8);
}
}
@Override // com.google.android.material.timepicker.TimePickerView.Sts
public final void a() {
this.a = 1;
a(this.c);
this.r.a();
}
/* JADX WARN: Code restructure failed: missing block: B:21:0x0051, code lost:
if (r0 == null) goto L25;
*/
/* JADX WARN: Code restructure failed: missing block: B:22:0x005f, code lost:
r5.p = r0;
r0 = r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x0058, code lost:
r0 = new o.C1156Wwv(r2, r5.s);
*/
/* JADX WARN: Code restructure failed: missing block: B:37:0x0056, code lost:
if (r0 == null) goto L25;
*/
/* JADX WARN: Multi-variable type inference failed */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
final void a(com.google.android.material.button.MaterialButton r6) {
/*
Method dump skipped, instructions count: 260
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.timepicker.MaterialTimePicker.a(com.google.android.material.button.MaterialButton):void");
}
}