package ῲ.ῲ.ඓ.㳳;

import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Build;
import android.view.Display;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import androidx.appcompat.R$dimen;
import ῲ.ᨨ.ᨨ.C1729;
import ῲ.ῲ.ඓ.㳳.AbstractC1897;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ῲ.ඓ.㳳.䁗  reason: contains not printable characters */
/* compiled from: MenuPopupHelper */
public class C1933 implements AbstractC1910 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final boolean f6594;

    /* renamed from: ඓ  reason: contains not printable characters */
    public final int f6595;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public PopupWindow.OnDismissListener f6596;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public AbstractC1897.AbstractC1898 f6597;

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

    /* renamed from: ⁱ  reason: contains not printable characters */
    public int f6599 = 8388611;

    /* renamed from: K  reason: contains not printable characters */
    public final Context f6600;

    /* renamed from: 㑃  reason: contains not printable characters */
    public final PopupWindow.OnDismissListener f6601 = new C1934();

    /* renamed from: 㳳  reason: contains not printable characters */
    public AbstractC1916 f6602;

    /* renamed from: 㴹  reason: contains not printable characters */
    public View f6603;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final int f6604;

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f6605;

    /* renamed from: ῲ.ῲ.ඓ.㳳.䁗$K  reason: contains not printable characters */
    /* compiled from: MenuPopupHelper */
    public class C1934 implements PopupWindow.OnDismissListener {
        public C1934() {
        }

        public void onDismiss() {
            C1933.this.m5004();
        }
    }

    public C1933(Context context, C1912 r3, View view, boolean z, int i, int i2) {
        this.f6600 = context;
        this.f6598 = r3;
        this.f6603 = view;
        this.f6594 = z;
        this.f6604 = i;
        this.f6595 = i2;
    }

    public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener) {
        this.f6596 = onDismissListener;
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public boolean m4993() {
        AbstractC1916 r0 = this.f6602;
        return r0 != null && r0.m4925();
    }

    /* renamed from: ඓ  reason: contains not printable characters */
    public void m4994() {
        if (!m5003()) {
            throw new IllegalStateException("MenuPopupHelper cannot be used without an anchor");
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public AbstractC1916 m4995() {
        AbstractC1916 r0;
        if (this.f6602 == null) {
            Display defaultDisplay = ((WindowManager) this.f6600.getSystemService("window")).getDefaultDisplay();
            Point point = new Point();
            int i = Build.VERSION.SDK_INT;
            defaultDisplay.getRealSize(point);
            if (Math.min(point.x, point.y) >= this.f6600.getResources().getDimensionPixelSize(R$dimen.abc_cascading_menus_min_smallest_width)) {
                r0 = new View$OnKeyListenerC1925(this.f6600, this.f6603, this.f6604, this.f6595, this.f6594);
            } else {
                r0 = new View$OnKeyListenerC1919(this.f6600, this.f6598, this.f6603, this.f6604, this.f6595, this.f6594);
            }
            r0.m4951(this.f6598);
            r0.setOnDismissListener(this.f6601);
            r0.m4950(this.f6603);
            r0.setCallback(this.f6597);
            r0.m4952(this.f6605);
            r0.m4948(this.f6599);
            this.f6602 = r0;
        }
        return this.f6602;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m4999(View view) {
        this.f6603 = view;
    }

    /* renamed from: 㴹  reason: contains not printable characters */
    public boolean m5003() {
        if (m4993()) {
            return true;
        }
        if (this.f6603 == null) {
            return false;
        }
        m4998(0, 0, false, false);
        return true;
    }

    /* renamed from: 㸾  reason: contains not printable characters */
    public void m5004() {
        this.f6602 = null;
        PopupWindow.OnDismissListener onDismissListener = this.f6596;
        if (onDismissListener != null) {
            onDismissListener.onDismiss();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5001(boolean z) {
        this.f6605 = z;
        AbstractC1916 r0 = this.f6602;
        if (r0 != null) {
            r0.m4952(z);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m4997(int i) {
        this.f6599 = i;
    }

    /* renamed from: K  reason: contains not printable characters */
    public boolean m5002(int i, int i2) {
        if (m4993()) {
            return true;
        }
        if (this.f6603 == null) {
            return false;
        }
        m4998(i, i2, true, true);
        return true;
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m4998(int i, int i2, boolean z, boolean z2) {
        AbstractC1916 r0 = m4995();
        r0.m4946(z2);
        if (z) {
            if ((C2369.m6293(this.f6599, C1729.m4511(this.f6603)) & 7) == 5) {
                i -= this.f6603.getWidth();
            }
            r0.m4945(i);
            r0.m4944(i2);
            int i3 = (int) ((this.f6600.getResources().getDisplayMetrics().density * 48.0f) / 2.0f);
            r0.m4949(new Rect(i - i3, i2 - i3, i + i3, i2 + i3));
        }
        r0.show();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m4996() {
        if (m4993()) {
            this.f6602.dismiss();
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5000(AbstractC1897.AbstractC1898 k) {
        this.f6597 = k;
        AbstractC1916 r0 = this.f6602;
        if (r0 != null) {
            r0.setCallback(k);
        }
    }
}
