package androidx.appcompat.widget;

import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.widget.PopupWindow;

/* JADX INFO: compiled from: AppCompatPopupWindow.java */
/* JADX INFO: loaded from: classes.dex */
class l extends PopupWindow {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private static final boolean f623a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private boolean f624b;

    static {
        f623a = Build.VERSION.SDK_INT < 21;
    }

    public l(Context context, AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
        a(context, attributeSet, i, i2);
    }

    private void a(Context context, AttributeSet attributeSet, int i, int i2) {
        i0 i0VarS = i0.s(context, attributeSet, a.a.j.B1, i, i2);
        int i3 = a.a.j.D1;
        if (i0VarS.p(i3)) {
            b(i0VarS.a(i3, false));
        }
        setBackgroundDrawable(i0VarS.f(a.a.j.C1));
        i0VarS.t();
    }

    private void b(boolean z) {
        if (f623a) {
            this.f624b = z;
        } else {
            androidx.core.widget.g.a(this, z);
        }
    }

    @Override // android.widget.PopupWindow
    public void showAsDropDown(View view, int i, int i2) {
        if (f623a && this.f624b) {
            i2 -= view.getHeight();
        }
        super.showAsDropDown(view, i, i2);
    }

    @Override // android.widget.PopupWindow
    public void update(View view, int i, int i2, int i3, int i4) {
        if (f623a && this.f624b) {
            i2 -= view.getHeight();
        }
        super.update(view, i, i2, i3, i4);
    }

    @Override // android.widget.PopupWindow
    public void showAsDropDown(View view, int i, int i2, int i3) {
        if (f623a && this.f624b) {
            i2 -= view.getHeight();
        }
        super.showAsDropDown(view, i, i2, i3);
    }
}
