package D1;

import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import n4.u0;

/* JADX INFO: renamed from: D1.f, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class ViewOnLayoutChangeListenerC0081f implements View.OnLayoutChangeListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f1732a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f1733b;

    public /* synthetic */ ViewOnLayoutChangeListenerC0081f(int i, Object obj) {
        this.f1732a = i;
        this.f1733b = obj;
    }

    @Override // android.view.View.OnLayoutChangeListener
    public final void onLayoutChange(View view, int i, int i5, int i8, int i9, int i10, int i11, int i12, int i13) {
        int height;
        int height2;
        switch (this.f1732a) {
            case u0.f15495q /* 0 */:
                C0093s c0093s = (C0093s) this.f1733b;
                c0093s.getClass();
                int i14 = i9 - i5;
                int i15 = i13 - i11;
                if (i8 - i != i12 - i10 || i14 != i15) {
                    PopupWindow popupWindow = c0093s.f1763A;
                    if (popupWindow.isShowing()) {
                        c0093s.q();
                        int width = c0093s.getWidth() - popupWindow.getWidth();
                        int i16 = c0093s.f1765B;
                        popupWindow.update(view, width - i16, (-popupWindow.getHeight()) - i16, -1, -1);
                    }
                }
                break;
            default:
                x xVar = (x) this.f1733b;
                C0093s c0093s2 = xVar.f1845a;
                int width2 = (c0093s2.getWidth() - c0093s2.getPaddingLeft()) - c0093s2.getPaddingRight();
                int height3 = (c0093s2.getHeight() - c0093s2.getPaddingBottom()) - c0093s2.getPaddingTop();
                ViewGroup viewGroup = xVar.f1847c;
                int iC = x.c(viewGroup) - (viewGroup != null ? viewGroup.getPaddingRight() + viewGroup.getPaddingLeft() : 0);
                if (viewGroup == null) {
                    height = 0;
                } else {
                    height = viewGroup.getHeight();
                    ViewGroup.LayoutParams layoutParams = viewGroup.getLayoutParams();
                    if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
                        ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) layoutParams;
                        height += marginLayoutParams.topMargin + marginLayoutParams.bottomMargin;
                    }
                }
                int paddingBottom = height - (viewGroup != null ? viewGroup.getPaddingBottom() + viewGroup.getPaddingTop() : 0);
                int iMax = Math.max(iC, x.c(xVar.f1854k) + x.c(xVar.i));
                ViewGroup viewGroup2 = xVar.f1848d;
                if (viewGroup2 == null) {
                    height2 = 0;
                } else {
                    height2 = viewGroup2.getHeight();
                    ViewGroup.LayoutParams layoutParams2 = viewGroup2.getLayoutParams();
                    if (layoutParams2 instanceof ViewGroup.MarginLayoutParams) {
                        ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) layoutParams2;
                        height2 += marginLayoutParams2.topMargin + marginLayoutParams2.bottomMargin;
                    }
                }
                boolean z8 = width2 <= iMax || height3 <= (height2 * 2) + paddingBottom;
                if (xVar.f1842A != z8) {
                    xVar.f1842A = z8;
                    view.post(new t(xVar, 1));
                }
                boolean z9 = i8 - i != i12 - i10;
                if (!xVar.f1842A && z9) {
                    view.post(new t(xVar, 2));
                    break;
                }
                break;
        }
    }
}
