package androidx.appcompat.view.menu; import android.content.DialogInterface; import android.os.IBinder; import android.view.KeyEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import androidx.appcompat.app.DialogInterfaceC0089a; import androidx.appcompat.view.menu.InterfaceC0112i; import p007c.C0491g; /* renamed from: androidx.appcompat.view.menu.f */ /* loaded from: classes.dex */ public class DialogInterface$OnKeyListenerC0106f implements DialogInterface.OnKeyListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, InterfaceC0112i.InterfaceC0113a { /* renamed from: d */ public C0103e f334d; /* renamed from: e */ public DialogInterfaceC0089a f335e; /* renamed from: f */ public C0100c f336f; /* renamed from: g */ public InterfaceC0112i.InterfaceC0113a f337g; public DialogInterface$OnKeyListenerC0106f(C0103e c0103e) { this.f334d = c0103e; } @Override // androidx.appcompat.view.menu.InterfaceC0112i.InterfaceC0113a /* renamed from: a */ public void mo3381a(C0103e c0103e, boolean z) { if (z || c0103e == this.f334d) { m4865c(); } InterfaceC0112i.InterfaceC0113a interfaceC0113a = this.f337g; if (interfaceC0113a != null) { interfaceC0113a.mo3381a(c0103e, z); } } @Override // androidx.appcompat.view.menu.InterfaceC0112i.InterfaceC0113a /* renamed from: b */ public boolean mo3380b(C0103e c0103e) { InterfaceC0112i.InterfaceC0113a interfaceC0113a = this.f337g; if (interfaceC0113a != null) { return interfaceC0113a.mo3380b(c0103e); } return false; } /* renamed from: c */ public void m4865c() { DialogInterfaceC0089a dialogInterfaceC0089a = this.f335e; if (dialogInterfaceC0089a != null) { dialogInterfaceC0089a.dismiss(); } } /* renamed from: d */ public void m4864d(IBinder iBinder) { C0103e c0103e = this.f334d; DialogInterfaceC0089a.C0090a c0090a = new DialogInterfaceC0089a.C0090a(c0103e.m4871u()); C0100c c0100c = new C0100c(c0090a.m4948b(), C0491g.abc_list_menu_item_layout); this.f336f = c0100c; c0100c.mo4821h(this); this.f334d.m4889b(this.f336f); c0090a.m4947c(this.f336f.m4920b(), this); View m4867y = c0103e.m4867y(); if (m4867y != null) { c0090a.m4946d(m4867y); } else { c0090a.m4945e(c0103e.m4869w()).m4942h(c0103e.m4868x()); } c0090a.m4944f(this); DialogInterfaceC0089a m4949a = c0090a.m4949a(); this.f335e = m4949a; m4949a.setOnDismissListener(this); WindowManager.LayoutParams attributes = this.f335e.getWindow().getAttributes(); attributes.type = 1003; if (iBinder != null) { attributes.token = iBinder; } attributes.flags |= 131072; this.f335e.show(); } @Override // android.content.DialogInterface.OnClickListener public void onClick(DialogInterface dialogInterface, int i) { this.f334d.m4905L((C0107g) this.f336f.m4920b().getItem(i), 0); } @Override // android.content.DialogInterface.OnDismissListener public void onDismiss(DialogInterface dialogInterface) { this.f336f.mo4649a(this.f334d, true); } @Override // android.content.DialogInterface.OnKeyListener public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { Window window; View decorView; KeyEvent.DispatcherState keyDispatcherState; View decorView2; KeyEvent.DispatcherState keyDispatcherState2; if (i == 82 || i == 4) { if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) { Window window2 = this.f335e.getWindow(); if (window2 != null && (decorView2 = window2.getDecorView()) != null && (keyDispatcherState2 = decorView2.getKeyDispatcherState()) != null) { keyDispatcherState2.startTracking(keyEvent, this); return true; } } else if (keyEvent.getAction() == 1 && !keyEvent.isCanceled() && (window = this.f335e.getWindow()) != null && (decorView = window.getDecorView()) != null && (keyDispatcherState = decorView.getKeyDispatcherState()) != null && keyDispatcherState.isTracking(keyEvent)) { this.f334d.m4883e(true); dialogInterface.dismiss(); return true; } } return this.f334d.performShortcut(i, keyEvent, 0); } }