package o;

import android.content.Context;
import android.view.View;
import android.view.Window;
import java.util.WeakHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Or, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0380Or extends AbstractC3054z implements InterfaceC2904xT {
    public final Window t;
    public final MV u;
    public boolean v;
    public boolean w;
    public boolean x;
    public boolean y;

    public C0380Or(Context context, Window window) {
        super(context);
        this.t = window;
        this.u = AbstractC0752ap.X(AbstractC0580Wj.a);
        WeakHashMap weakHashMap = Oj0.a;
        Gj0.l(this, this);
        Oj0.o(this, new R5(this, 1));
    }

    @Override // o.AbstractC3054z
    public final void a(int i, C0321Mk c0321Mk) {
        c0321Mk.X(1735448596);
        int i2 = (c0321Mk.h(this) ? 4 : 2) | i;
        if (c0321Mk.N(i2 & 1, (i2 & 3) != 2)) {
            ((SC) this.u.getValue()).f(c0321Mk, 0);
        } else {
            c0321Mk.Q();
        }
        L00 l00S = c0321Mk.s();
        if (l00S != null) {
            l00S.d = new C2959y(this, i, 5);
        }
    }

    @Override // o.AbstractC3054z
    public final void d(boolean z, int i, int i2, int i3, int i4) {
        View childAt = getChildAt(0);
        if (childAt == null) {
            return;
        }
        int paddingRight = getPaddingRight() + getPaddingLeft();
        int paddingBottom = getPaddingBottom() + getPaddingTop();
        int i5 = i3 - i;
        int i6 = i4 - i2;
        int measuredWidth = childAt.getMeasuredWidth();
        int measuredHeight = childAt.getMeasuredHeight();
        int paddingLeft = (((i5 - measuredWidth) - paddingRight) / 2) + getPaddingLeft();
        int paddingTop = (((i6 - measuredHeight) - paddingBottom) / 2) + getPaddingTop();
        childAt.layout(paddingLeft, paddingTop, measuredWidth + paddingLeft, measuredHeight + paddingTop);
    }

    @Override // o.AbstractC3054z
    public final void e(int i, int i2) {
        View childAt = getChildAt(0);
        if (childAt == null) {
            super.e(i, i2);
            return;
        }
        int size = View.MeasureSpec.getSize(i);
        int size2 = View.MeasureSpec.getSize(i2);
        int mode = View.MeasureSpec.getMode(i2);
        Window window = this.t;
        int i3 = (mode != Integer.MIN_VALUE || this.v || this.w || window.getAttributes().height != -2) ? size2 : size2 + 1;
        int paddingRight = getPaddingRight() + getPaddingLeft();
        int paddingBottom = getPaddingBottom() + getPaddingTop();
        int i4 = size - paddingRight;
        if (i4 < 0) {
            i4 = 0;
        }
        int i5 = i3 - paddingBottom;
        int i6 = i5 >= 0 ? i5 : 0;
        int mode2 = View.MeasureSpec.getMode(i);
        if (mode2 != 0) {
            i = View.MeasureSpec.makeMeasureSpec(i4, Integer.MIN_VALUE);
        }
        if (mode != 0) {
            i2 = View.MeasureSpec.makeMeasureSpec(i6, Integer.MIN_VALUE);
        }
        childAt.measure(i, i2);
        if (mode2 == Integer.MIN_VALUE) {
            size = Math.min(size, childAt.getMeasuredWidth() + paddingRight);
        } else if (mode2 != 1073741824) {
            size = childAt.getMeasuredWidth() + paddingRight;
        }
        setMeasuredDimension(size, mode != Integer.MIN_VALUE ? mode != 1073741824 ? childAt.getMeasuredHeight() + paddingBottom : size2 : Math.min(size2, childAt.getMeasuredHeight() + paddingBottom));
        if (this.w || childAt.getMeasuredHeight() + paddingBottom <= size2 || window.getAttributes().height != -2) {
            return;
        }
        window.addFlags(Integer.MIN_VALUE);
        if (this.v) {
            return;
        }
        window.setLayout(-1, -1);
    }

    @Override // o.AbstractC3054z
    public final boolean getShouldCreateCompositionOnAttachedToWindow() {
        return this.y;
    }

    @Override // o.InterfaceC2904xT
    public final Kl0 i(View view, Kl0 kl0) {
        if (!this.w) {
            View childAt = getChildAt(0);
            int iMax = Math.max(0, childAt.getLeft());
            int iMax2 = Math.max(0, childAt.getTop());
            int iMax3 = Math.max(0, getWidth() - childAt.getRight());
            int iMax4 = Math.max(0, getHeight() - childAt.getBottom());
            if (iMax != 0 || iMax2 != 0 || iMax3 != 0 || iMax4 != 0) {
                return kl0.a.n(iMax, iMax2, iMax3, iMax4);
            }
        }
        return kl0;
    }
}
