package o; import android.content.res.ColorStateList; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.FrameLayout; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.ViewCompat; import androidx.core.view.WindowInsetsCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import com.google.android.material.bottomsheet.BottomSheetBehavior; import o.C17052tZT; import org.bouncycastle.asn1.cmp.PKIFailureInfo; /* loaded from: classes2.dex */ public final class ZsP extends JRt { boolean a; FrameLayout b; boolean c; public BottomSheetBehavior d; boolean e; private CoordinatorLayout f; private FrameLayout g; public boolean h; Sts i; private BottomSheetBehavior.LWm j; private boolean l; @Override // o.JRt, o.HBt, android.app.Dialog public final void setContentView(int i) { super.setContentView(Ij_(i, null, null)); } @Override // o.JRt, o.HBt, android.app.Dialog public final void onCreate(Bundle bundle) { super.onCreate(bundle); Window window = getWindow(); if (window != null) { window.setStatusBarColor(0); window.addFlags(PKIFailureInfo.systemUnavail); window.setLayout(-1, -1); } } @Override // o.JRt, o.HBt, android.app.Dialog public final void setContentView(View view) { super.setContentView(Ij_(0, view, null)); } @Override // o.JRt, o.HBt, android.app.Dialog public final void setContentView(View view, ViewGroup.LayoutParams layoutParams) { super.setContentView(Ij_(0, view, layoutParams)); } @Override // android.app.Dialog public final void setCancelable(boolean z) { super.setCancelable(z); if (this.c != z) { this.c = z; BottomSheetBehavior bottomSheetBehavior = this.d; if (bottomSheetBehavior != null) { bottomSheetBehavior.a(z); } } } @Override // o.HBt, android.app.Dialog public final void onStart() { super.onStart(); BottomSheetBehavior bottomSheetBehavior = this.d; if (bottomSheetBehavior == null || bottomSheetBehavior.y != 5) { return; } this.d.a(4); } @Override // android.app.Dialog, android.view.Window.Callback public final void onAttachedToWindow() { super.onAttachedToWindow(); Window window = getWindow(); if (window != null) { boolean z = this.l && Color.alpha(window.getNavigationBarColor()) < 255; FrameLayout frameLayout = this.g; if (frameLayout != null) { frameLayout.setFitsSystemWindows(!z); } CoordinatorLayout coordinatorLayout = this.f; if (coordinatorLayout != null) { coordinatorLayout.setFitsSystemWindows(!z); } C16217mQa.tt_(window, !z); Sts sts = this.i; if (sts != null) { sts.Ik_(window); } } } @Override // android.app.Dialog, android.view.Window.Callback public final void onDetachedFromWindow() { Sts sts = this.i; if (sts != null) { sts.Ik_(null); } } @Override // android.app.Dialog, android.content.DialogInterface public final void cancel() { if (this.d == null) { Ii_(); } super.cancel(); } @Override // android.app.Dialog public final void setCanceledOnTouchOutside(boolean z) { super.setCanceledOnTouchOutside(z); if (z && !this.c) { this.c = true; } this.a = z; this.e = true; } public final FrameLayout Ii_() { if (this.g == null) { FrameLayout frameLayout = (FrameLayout) View.inflate(getContext(), C17052tZT.tOB.design_bottom_sheet_dialog, null); this.g = frameLayout; this.f = (CoordinatorLayout) frameLayout.findViewById(C17052tZT.ZqN.coordinator); FrameLayout frameLayout2 = (FrameLayout) this.g.findViewById(C17052tZT.ZqN.design_bottom_sheet); this.b = frameLayout2; BottomSheetBehavior b = BottomSheetBehavior.b(frameLayout2); this.d = b; BottomSheetBehavior.LWm lWm = this.j; if (!b.b.contains(lWm)) { b.b.add(lWm); } this.d.a(this.c); } return this.g; } private View Ij_(int i, View view, ViewGroup.LayoutParams layoutParams) { Ii_(); CoordinatorLayout coordinatorLayout = (CoordinatorLayout) this.g.findViewById(C17052tZT.ZqN.coordinator); if (i != 0 && view == null) { view = getLayoutInflater().inflate(i, (ViewGroup) coordinatorLayout, false); } if (this.l) { ViewCompat.c(this.b, new LbT(this) { // from class: o.ZsP.4 private ZsP d; { this.d = this; } @Override // o.LbT public final WindowInsetsCompat e(View view2, WindowInsetsCompat windowInsetsCompat) { if (this.d.i != null) { BottomSheetBehavior bottomSheetBehavior = this.d.d; bottomSheetBehavior.b.remove(this.d.i); } if (windowInsetsCompat != null) { ZsP zsP = this.d; zsP.i = new Sts(zsP.b, windowInsetsCompat, (byte) 0); this.d.i.Ik_(this.d.getWindow()); BottomSheetBehavior bottomSheetBehavior2 = this.d.d; Sts sts = this.d.i; if (!bottomSheetBehavior2.b.contains(sts)) { bottomSheetBehavior2.b.add(sts); } } return windowInsetsCompat; } }); } this.b.removeAllViews(); if (layoutParams == null) { this.b.addView(view); } else { this.b.addView(view, layoutParams); } coordinatorLayout.findViewById(C17052tZT.ZqN.touch_outside).setOnClickListener(new View.OnClickListener(this) { // from class: o.ZsP.1 private ZsP c; { this.c = this; } @Override // android.view.View.OnClickListener public final void onClick(View view2) { if (this.c.c && this.c.isShowing()) { ZsP zsP = this.c; if (!zsP.e) { TypedArray obtainStyledAttributes = zsP.getContext().obtainStyledAttributes(new int[]{android.R.attr.windowCloseOnTouchOutside}); zsP.a = obtainStyledAttributes.getBoolean(0, true); obtainStyledAttributes.recycle(); zsP.e = true; } if (zsP.a) { this.c.cancel(); } } } }); ViewCompat.e(this.b, new yZt(this) { // from class: o.ZsP.2 private ZsP d; { this.d = this; } @Override // o.yZt public final void onInitializeAccessibilityNodeInfo(View view2, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { super.onInitializeAccessibilityNodeInfo(view2, accessibilityNodeInfoCompat); if (this.d.c) { accessibilityNodeInfoCompat.d(PKIFailureInfo.badCertTemplate); accessibilityNodeInfoCompat.i(true); } else { accessibilityNodeInfoCompat.i(false); } } @Override // o.yZt public final boolean performAccessibilityAction(View view2, int i2, Bundle bundle) { if (i2 == 1048576 && this.d.c) { this.d.cancel(); return true; } return super.performAccessibilityAction(view2, i2, bundle); } }); this.b.setOnTouchListener(new View.OnTouchListener(this) { // from class: o.ZsP.5 private ZsP e; @Override // android.view.View.OnTouchListener public final boolean onTouch(View view2, MotionEvent motionEvent) { return true; } { this.e = this; } }); return this.g; } /* loaded from: classes2.dex */ static class Sts extends BottomSheetBehavior.LWm { private Window b; private final WindowInsetsCompat c; private final Boolean d; private boolean e; /* synthetic */ Sts(View view, WindowInsetsCompat windowInsetsCompat, byte b) { this(view, windowInsetsCompat); } private Sts(View view, WindowInsetsCompat windowInsetsCompat) { ColorStateList sh_; this.c = windowInsetsCompat; C4363bXv c4363bXv = BottomSheetBehavior.b(view).f6468o; if (c4363bXv == null) { sh_ = ViewCompat.sh_(view); } else { sh_ = c4363bXv.B.d; } if (sh_ != null) { int defaultColor = sh_.getDefaultColor(); this.d = Boolean.valueOf(defaultColor != 0 && Rez.c(defaultColor) > 0.5d); } else if (!(view.getBackground() instanceof ColorDrawable)) { this.d = null; } else { int color = ((ColorDrawable) view.getBackground()).getColor(); this.d = Boolean.valueOf(color != 0 && Rez.c(color) > 0.5d); } } @Override // com.google.android.material.bottomsheet.BottomSheetBehavior.LWm public final void a(View view, int i) { e(view); } @Override // com.google.android.material.bottomsheet.BottomSheetBehavior.LWm public final void d(View view) { e(view); } @Override // com.google.android.material.bottomsheet.BottomSheetBehavior.LWm public final void b(View view) { e(view); } final void Ik_(Window window) { if (this.b == window) { return; } this.b = window; if (window != null) { this.e = C16217mQa.ts_(window, window.getDecorView()).a(); } } private void e(View view) { if (view.getTop() < this.c.i()) { Window window = this.b; if (window != null) { Boolean bool = this.d; C16217mQa.ts_(window, window.getDecorView()).e(bool == null ? this.e : bool.booleanValue()); } view.setPadding(view.getPaddingLeft(), this.c.i() - view.getTop(), view.getPaddingRight(), view.getPaddingBottom()); return; } if (view.getTop() != 0) { Window window2 = this.b; if (window2 != null) { C16217mQa.ts_(window2, window2.getDecorView()).e(this.e); } view.setPadding(view.getPaddingLeft(), 0, view.getPaddingRight(), view.getPaddingBottom()); } } } /* 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 ZsP(android.content.Context r4, int r5) { /* r3 = this; r0 = 1 if (r5 != 0) goto L19 android.util.TypedValue r5 = new android.util.TypedValue r5.() android.content.res.Resources$Theme r1 = r4.getTheme() int r2 = o.C17052tZT.IeS.bottomSheetDialogTheme boolean r1 = r1.resolveAttribute(r2, r5, r0) if (r1 == 0) goto L17 int r5 = r5.resourceId goto L19 L17: int r5 = o.C17052tZT.NHB.Theme_Design_Light_BottomSheetDialog L19: r3.(r4, r5) r3.c = r0 r3.a = r0 o.ZsP$3 r4 = new o.ZsP$3 r4.(r3) r3.j = r4 r3.b(r0) android.content.Context r4 = r3.getContext() android.content.res.Resources$Theme r4 = r4.getTheme() int r5 = o.C17052tZT.IeS.enableEdgeToEdge int[] r5 = new int[]{r5} android.content.res.TypedArray r4 = r4.obtainStyledAttributes(r5) r5 = 0 boolean r4 = r4.getBoolean(r5, r5) r3.l = r4 return */ throw new UnsupportedOperationException("Method not decompiled: o.ZsP.(android.content.Context, int):void"); } }