package ῲ.ῲ.ඓ.㳳;

import android.content.DialogInterface;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import ῲ.ῲ.ඓ.㳳.AbstractC1897;
import ῲ.ῲ.K.DialogInterfaceC1958;

/* renamed from: ῲ.ῲ.ඓ.㳳.㿎  reason: contains not printable characters */
/* compiled from: MenuDialogHelper */
public class DialogInterface$OnKeyListenerC1931 implements DialogInterface.OnKeyListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, AbstractC1897.AbstractC1898 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public DialogInterfaceC1958 f6589;

    /* renamed from: ඓ  reason: contains not printable characters */
    public AbstractC1897.AbstractC1898 f6590;

    /* renamed from: ῲ  reason: contains not printable characters */
    public C1912 f6591;

    /* renamed from: 㸾  reason: contains not printable characters */
    public C1901 f6592;

    public DialogInterface$OnKeyListenerC1931(C1912 r1) {
        this.f6591 = r1;
    }

    public void onClick(DialogInterface dialogInterface, int i) {
        this.f6591.performItemAction((C1922) this.f6592.m4923().getItem(i), 0);
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897.AbstractC1898
    public void onCloseMenu(C1912 r2, boolean z) {
        DialogInterfaceC1958 r0;
        if ((z || r2 == this.f6591) && (r0 = this.f6589) != null) {
            r0.dismiss();
        }
        AbstractC1897.AbstractC1898 k = this.f6590;
        if (k != null) {
            k.onCloseMenu(r2, z);
        }
    }

    public void onDismiss(DialogInterface dialogInterface) {
        this.f6592.onCloseMenu(this.f6591, true);
    }

    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.f6589.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.f6589.getWindow()) != null && (decorView = window.getDecorView()) != null && (keyDispatcherState = decorView.getKeyDispatcherState()) != null && keyDispatcherState.isTracking(keyEvent)) {
                this.f6591.close(true);
                dialogInterface.dismiss();
                return true;
            }
        }
        return this.f6591.performShortcut(i, keyEvent, 0);
    }

    @Override // ῲ.ῲ.ඓ.㳳.AbstractC1897.AbstractC1898
    /* renamed from: K  reason: contains not printable characters */
    public boolean m4992(C1912 r2) {
        AbstractC1897.AbstractC1898 k = this.f6590;
        if (k != null) {
            return k.m4922(r2);
        }
        return false;
    }
}
