package com.google.android.material.datepicker; import android.R; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.os.Build; 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.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.TextView; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.fragment.app.DialogFragment; import com.google.android.material.internal.CheckableImageButton; import java.nio.charset.StandardCharsets; import java.util.Calendar; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.TimeZone; import o.AbstractC13482fbE; import o.AbstractC16801rOL; import o.C16021kYS; import o.C16217mQa; import o.C17052tZT; import o.C4363bXv; import o.FOT; import o.JjA; import o.LbT; import o.OAR; import o.OnG; import o.Rez; import o.SIS; import o.TZc; import o.UJG; import o.hhb; /* loaded from: classes2.dex */ public final class MaterialDatePicker extends DialogFragment { private static byte B = 0; private static int G = 1; private static int I; private static Object f; private static Object i; private static Object j; private CharSequence A; private int C; private int D; CheckableImageButton a; Button b; OAR d; TextView e; private C4363bXv h; private FOT k; private MaterialCalendar l; private CharSequence m; private AbstractC16801rOL n; /* renamed from: o, reason: collision with root package name */ private boolean f6474o; private boolean p; private CharSequence q; private int r; private TextView s; private int t; private PickerFragment u; private CharSequence w; private int y; private CharSequence z; final LinkedHashSet> g = new LinkedHashSet<>(); final LinkedHashSet c = new LinkedHashSet<>(); private final LinkedHashSet v = new LinkedHashSet<>(); private final LinkedHashSet x = new LinkedHashSet<>(); private void E(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); } @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment public final void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putInt("OVERRIDE_THEME_RES_ID", this.y); bundle.putParcelable("DATE_SELECTOR_KEY", this.d); FOT.Sts sts = new FOT.Sts(this.k); MaterialCalendar materialCalendar = this.l; UJG ujg = null; UJG ujg2 = materialCalendar == null ? null : materialCalendar.a; if (ujg2 != null) { sts.c = Long.valueOf(ujg2.i); } Bundle bundle2 = new Bundle(); bundle2.putParcelable("DEEP_COPY_VALIDATOR_KEY", sts.e); long j2 = sts.b; Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.clear(); calendar.setTimeInMillis(j2); UJG ujg3 = new UJG(calendar); long j3 = sts.a; Calendar calendar2 = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar2.clear(); calendar2.setTimeInMillis(j3); UJG ujg4 = new UJG(calendar2); FOT.LWm lWm = (FOT.LWm) bundle2.getParcelable("DEEP_COPY_VALIDATOR_KEY"); Long l = sts.c; if (l != null) { long longValue = l.longValue(); Calendar calendar3 = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar3.clear(); calendar3.setTimeInMillis(longValue); ujg = new UJG(calendar3); } bundle.putParcelable("CALENDAR_CONSTRAINTS_KEY", new FOT(ujg3, ujg4, lWm, ujg, sts.d, (byte) 0)); bundle.putParcelable("DAY_VIEW_DECORATOR_KEY", this.n); bundle.putInt("TITLE_TEXT_RES_ID_KEY", this.C); bundle.putCharSequence("TITLE_TEXT_KEY", this.A); bundle.putInt("POSITIVE_BUTTON_TEXT_RES_ID_KEY", this.D); bundle.putCharSequence("POSITIVE_BUTTON_TEXT_KEY", this.w); bundle.putInt("NEGATIVE_BUTTON_TEXT_RES_ID_KEY", this.r); bundle.putCharSequence("NEGATIVE_BUTTON_TEXT_KEY", this.q); } @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment public final void onCreate(Bundle bundle) { int i2 = 2 % 2; super.onCreate(bundle); if (bundle == null) { int i3 = G + 123; I = i3 % 128; int i4 = i3 % 2; bundle = getArguments(); } this.y = bundle.getInt("OVERRIDE_THEME_RES_ID"); this.d = (OAR) bundle.getParcelable("DATE_SELECTOR_KEY"); this.k = (FOT) bundle.getParcelable("CALENDAR_CONSTRAINTS_KEY"); this.n = (AbstractC16801rOL) bundle.getParcelable("DAY_VIEW_DECORATOR_KEY"); this.C = bundle.getInt("TITLE_TEXT_RES_ID_KEY"); this.A = bundle.getCharSequence("TITLE_TEXT_KEY"); this.t = bundle.getInt("INPUT_MODE_KEY"); this.D = bundle.getInt("POSITIVE_BUTTON_TEXT_RES_ID_KEY"); this.w = bundle.getCharSequence("POSITIVE_BUTTON_TEXT_KEY"); this.r = bundle.getInt("NEGATIVE_BUTTON_TEXT_RES_ID_KEY"); this.q = bundle.getCharSequence("NEGATIVE_BUTTON_TEXT_KEY"); CharSequence charSequence = this.A; if (charSequence == null) { int i5 = I + 119; G = i5 % 128; int i6 = i5 % 2; Resources resources = requireContext().getResources(); int i7 = this.C; String string = resources.getString(i7); if (!(!string.startsWith(",*,)"))) { Object[] objArr = new Object[1]; E(string.substring(4), objArr); string = ((String) objArr[0]).intern(); CharSequence text = resources.getText(i7); if (text instanceof Spanned) { SpannableString spannableString = new SpannableString(string); TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0); charSequence = spannableString; } } charSequence = string; } this.m = charSequence; if (charSequence != null) { int i8 = G + 57; I = i8 % 128; int i9 = i8 % 2; CharSequence[] split = TextUtils.split(String.valueOf(charSequence), "\n"); if (split.length > 1) { int i10 = I + 15; G = i10 % 128; charSequence = i10 % 2 == 0 ? split[1] : split[0]; } } else { charSequence = null; } this.z = charSequence; } private int e() { int i2 = this.y; if (i2 != 0) { return i2; } if (this.d == null) { this.d = (OAR) getArguments().getParcelable("DATE_SELECTOR_KEY"); } return this.d.c(); } @Override // androidx.fragment.app.DialogFragment public final Dialog onCreateDialog(Bundle bundle) { Context requireContext = requireContext(); requireContext(); Dialog dialog = new Dialog(requireContext, e()); Context context = dialog.getContext(); this.p = e(context, R.attr.windowFullscreen); int i2 = TZc.Kt_(context, C17052tZT.IeS.colorSurface, MaterialDatePicker.class.getCanonicalName()).data; C4363bXv c4363bXv = new C4363bXv(context, null, C17052tZT.IeS.materialCalendarStyle, C17052tZT.NHB.Widget_MaterialComponents_MaterialCalendar); this.h = c4363bXv; c4363bXv.d(context); C4363bXv c4363bXv2 = this.h; ColorStateList valueOf = ColorStateList.valueOf(i2); if (c4363bXv2.B.d != valueOf) { c4363bXv2.B.d = valueOf; c4363bXv2.onStateChange(c4363bXv2.getState()); } this.h.n(ViewCompat.i(dialog.getWindow().getDecorView())); return dialog; } /* JADX WARN: Removed duplicated region for block: B:24:0x0195 */ /* JADX WARN: Removed duplicated region for block: B:29:0x019f */ @Override // androidx.fragment.app.Fragment /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final android.view.View onCreateView(android.view.LayoutInflater r18, android.view.ViewGroup r19, android.os.Bundle r20) { /* Method dump skipped, instructions count: 498 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.datepicker.MaterialDatePicker.onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle):android.view.View"); } @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment public final void onStart() { super.onStart(); Window window = requireDialog().getWindow(); if (this.p) { window.setLayout(-1, -1); window.setBackgroundDrawable(this.h); if (!this.f6474o) { View findViewById = requireView().findViewById(C17052tZT.ZqN.fullscreen_header); Integer valueOf = findViewById.getBackground() instanceof ColorDrawable ? Integer.valueOf(((ColorDrawable) findViewById.getBackground()).getColor()) : null; boolean z = false; boolean z2 = valueOf == null || valueOf.intValue() == 0; int d = C16021kYS.d(window.getContext(), R.attr.colorBackground, -16777216); if (z2) { valueOf = Integer.valueOf(d); } Integer valueOf2 = Integer.valueOf(d); C16217mQa.tt_(window, false); window.getContext(); int d2 = Build.VERSION.SDK_INT < 27 ? Rez.d(C16021kYS.d(window.getContext(), R.attr.navigationBarColor, -16777216), 128) : 0; window.setStatusBarColor(0); window.setNavigationBarColor(d2); int intValue = valueOf.intValue(); C16217mQa.ts_(window, window.getDecorView()).e(intValue != 0 && Rez.c(intValue) > 0.5d); int intValue2 = valueOf2.intValue(); boolean z3 = intValue2 != 0 && Rez.c(intValue2) > 0.5d; if ((d2 != 0 && Rez.c(d2) > 0.5d) || (d2 == 0 && z3)) { z = true; } C16217mQa.ts_(window, window.getDecorView()).d(z); ViewCompat.c(findViewById, new LbT(this, findViewById.getLayoutParams().height, findViewById, findViewById.getPaddingTop()) { // from class: com.google.android.material.datepicker.MaterialDatePicker.5 private View a; private int c; private MaterialDatePicker d; private int e; { this.d = this; this.c = r2; this.a = findViewById; this.e = r4; } @Override // o.LbT public final WindowInsetsCompat e(View view, WindowInsetsCompat windowInsetsCompat) { int i2 = windowInsetsCompat.c(WindowInsetsCompat.jbe.b()).b; if (this.c >= 0) { this.a.getLayoutParams().height = this.c + i2; View view2 = this.a; view2.setLayoutParams(view2.getLayoutParams()); } View view3 = this.a; view3.setPadding(view3.getPaddingLeft(), this.e + i2, this.a.getPaddingRight(), this.a.getPaddingBottom()); return windowInsetsCompat; } }); this.f6474o = true; } } else { window.setLayout(-2, -2); int dimensionPixelOffset = getResources().getDimensionPixelOffset(C17052tZT.HBt.mtrl_calendar_dialog_background_inset); Rect rect = new Rect(dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset); window.setBackgroundDrawable(new InsetDrawable((Drawable) this.h, dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset, dimensionPixelOffset)); window.getDecorView().setOnTouchListener(new JjA(requireDialog(), rect)); } c(); } @Override // androidx.fragment.app.DialogFragment, androidx.fragment.app.Fragment public final void onStop() { this.u.a(); super.onStop(); } @Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnCancelListener public final void onCancel(DialogInterface dialogInterface) { Iterator it = this.v.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 it = this.x.iterator(); while (it.hasNext()) { it.next().onDismiss(dialogInterface); } ViewGroup viewGroup = (ViewGroup) getView(); if (viewGroup != null) { viewGroup.removeAllViews(); } super.onDismiss(dialogInterface); } final String d() { if (this.d == null) { this.d = (OAR) getArguments().getParcelable("DATE_SELECTOR_KEY"); } OAR oar = this.d; requireContext(); return oar.j(); } final void c() { PickerFragment pickerFragment; requireContext(); int e = e(); if (this.d == null) { this.d = (OAR) getArguments().getParcelable("DATE_SELECTOR_KEY"); } OAR oar = this.d; FOT fot = this.k; AbstractC16801rOL abstractC16801rOL = this.n; MaterialCalendar materialCalendar = new MaterialCalendar<>(); Bundle bundle = new Bundle(); bundle.putInt("THEME_RES_ID_KEY", e); bundle.putParcelable("GRID_SELECTOR_KEY", oar); bundle.putParcelable("CALENDAR_CONSTRAINTS_KEY", fot); bundle.putParcelable("DAY_VIEW_DECORATOR_KEY", abstractC16801rOL); bundle.putParcelable("CURRENT_MONTH_KEY", fot.e); materialCalendar.setArguments(bundle); this.l = materialCalendar; boolean isChecked = this.a.isChecked(); if (!isChecked) { pickerFragment = this.l; } else { if (this.d == null) { this.d = (OAR) getArguments().getParcelable("DATE_SELECTOR_KEY"); } OAR oar2 = this.d; FOT fot2 = this.k; pickerFragment = new MaterialTextInputPicker<>(); Bundle bundle2 = new Bundle(); bundle2.putInt("THEME_RES_ID_KEY", e); bundle2.putParcelable("DATE_SELECTOR_KEY", oar2); bundle2.putParcelable("CALENDAR_CONSTRAINTS_KEY", fot2); pickerFragment.setArguments(bundle2); } this.u = pickerFragment; this.s.setText((isChecked && getResources().getConfiguration().orientation == 2) ? this.z : this.m); if (this.d == null) { this.d = (OAR) getArguments().getParcelable("DATE_SELECTOR_KEY"); } OAR oar3 = this.d; getContext(); String f2 = oar3.f(); this.e.setContentDescription(d()); this.e.setText(f2); AbstractC13482fbE a = getChildFragmentManager().a(); int i2 = C17052tZT.ZqN.mtrl_calendar_frame; PickerFragment pickerFragment2 = this.u; if (i2 == 0) { throw new IllegalArgumentException("Must use non-zero containerViewId"); } a.b(i2, pickerFragment2, null, 2); a.d(); this.u.b(new SIS(this) { // from class: com.google.android.material.datepicker.MaterialDatePicker.4 private MaterialDatePicker e; { this.e = this; } @Override // o.SIS public final void e(S s) { MaterialDatePicker materialDatePicker = this.e; if (materialDatePicker.d == null) { materialDatePicker.d = (OAR) materialDatePicker.getArguments().getParcelable("DATE_SELECTOR_KEY"); } OAR oar4 = materialDatePicker.d; materialDatePicker.getContext(); String f3 = oar4.f(); materialDatePicker.e.setContentDescription(materialDatePicker.d()); materialDatePicker.e.setText(f3); Button button = this.e.b; MaterialDatePicker materialDatePicker2 = this.e; if (materialDatePicker2.d == null) { materialDatePicker2.d = (OAR) materialDatePicker2.getArguments().getParcelable("DATE_SELECTOR_KEY"); } button.setEnabled(materialDatePicker2.d.i()); } }); } final void d(CheckableImageButton checkableImageButton) { String string; if (this.a.isChecked()) { string = checkableImageButton.getContext().getString(C17052tZT.ojQ.mtrl_picker_toggle_to_calendar_input_mode); } else { string = checkableImageButton.getContext().getString(C17052tZT.ojQ.mtrl_picker_toggle_to_text_input_mode); } this.a.setContentDescription(string); } public static boolean e(Context context, int i2) { TypedArray obtainStyledAttributes = context.obtainStyledAttributes(TZc.Kt_(context, C17052tZT.IeS.materialCalendarStyle, MaterialCalendar.class.getCanonicalName()).data, new int[]{i2}); boolean z = obtainStyledAttributes.getBoolean(0, false); obtainStyledAttributes.recycle(); return z; } private static int e(Context context) { Resources resources = context.getResources(); int dimensionPixelOffset = resources.getDimensionPixelOffset(C17052tZT.HBt.mtrl_calendar_content_padding); int i2 = new UJG(OnG.e()).e; return (dimensionPixelOffset << 1) + (resources.getDimensionPixelSize(C17052tZT.HBt.mtrl_calendar_day_width) * i2) + ((i2 - 1) * resources.getDimensionPixelOffset(C17052tZT.HBt.mtrl_calendar_month_horizontal_padding)); } static void a() { B = (byte) 6; } static { a(); j = "CONFIRM_BUTTON_TAG"; f = "CANCEL_BUTTON_TAG"; i = "TOGGLE_BUTTON_TAG"; } }