package com.google.android.material.floatingactionbutton;

import X.05p;
import X.05s;
import X.1gt;
import X.C4782Qsl;
import X.C4789Qss;
import X.C4796Qsz;
import X.JBF;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.google.android.material.bottomsheet.BottomSheetBehavior;

public class FloatingActionButton$BaseBehavior<T extends C4796Qsz> extends 05p<T> {
    public Rect LIZ;
    public C4789Qss LIZIZ;
    public boolean LIZJ;

    static {
        Covode.recordClassIndex(43946);
    }

    public FloatingActionButton$BaseBehavior() {
        this.LIZJ = true;
    }

    public void onAttachedToLayoutParams(05s r2) {
        if (r2.LJII == 0) {
            r2.LJII = 80;
        }
    }

    public static boolean LIZ(View view) {
        05s layoutParams = view.getLayoutParams();
        if (layoutParams instanceof 05s) {
            return layoutParams.LIZ instanceof BottomSheetBehavior;
        }
        return false;
    }

    public FloatingActionButton$BaseBehavior(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, new int[]{2130969074});
        this.LIZJ = obtainStyledAttributes.getBoolean(0, true);
        obtainStyledAttributes.recycle();
    }

    private boolean LIZIZ(View view, C4796Qsz qsz) {
        if (!LIZ(view, qsz)) {
            return false;
        }
        if (view.getTop() < (qsz.getHeight() / 2) + qsz.getLayoutParams().topMargin) {
            qsz.LIZIZ(this.LIZIZ);
            return true;
        }
        qsz.LIZ(this.LIZIZ);
        return true;
    }

    private boolean LIZ(View view, C4796Qsz qsz) {
        05s layoutParams = qsz.getLayoutParams();
        if (this.LIZJ && layoutParams.LJFF == view.getId() && qsz.getUserSetVisibility() == 0) {
            return true;
        }
        return false;
    }

    private boolean LIZ(1gt r3, C4782Qsl qsl, C4796Qsz qsz) {
        if (!LIZ(qsl, qsz)) {
            return false;
        }
        if (this.LIZ == null) {
            this.LIZ = new Rect();
        }
        Rect rect = this.LIZ;
        JBF.LIZ(r3, qsl, rect);
        if (rect.bottom <= qsl.getMinimumHeightForVisibleOverlappingContent()) {
            qsz.LIZIZ(this.LIZIZ);
            return true;
        }
        qsz.LIZ(this.LIZIZ);
        return true;
    }

    /* JADX WARNING: Removed duplicated region for block: B:21:0x005c  */
    /* JADX WARNING: Removed duplicated region for block: B:44:? A[RETURN, SYNTHETIC] */
    /* renamed from: LIZ */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public boolean onLayoutChild(X.1gt r7, X.C4796Qsz r8, int r9) {
        /*
            r6 = this;
            java.util.List r4 = r7.LIZIZ(r8)
            int r3 = r4.size()
            r0 = 0
            r2 = 0
        L_0x000a:
            if (r2 >= r3) goto L_0x001e
            java.lang.Object r1 = r4.get(r2)
            android.view.View r1 = (android.view.View) r1
            boolean r0 = r1 instanceof X.C4782Qsl
            if (r0 == 0) goto L_0x007b
            X.Qsl r1 = (X.C4782Qsl) r1
            boolean r0 = r6.LIZ((X.1gt) r7, (X.C4782Qsl) r1, (X.C4796Qsz) r8)
            if (r0 == 0) goto L_0x0087
        L_0x001e:
            r7.LIZ(r8, r9)
            android.graphics.Rect r4 = r8.LIZJ
            if (r4 == 0) goto L_0x005f
            int r0 = r4.centerX()
            if (r0 <= 0) goto L_0x005f
            int r0 = r4.centerY()
            if (r0 <= 0) goto L_0x005f
            android.view.ViewGroup$LayoutParams r5 = r8.getLayoutParams()
            X.05s r5 = (X.05s) r5
            int r2 = r8.getRight()
            int r1 = r7.getWidth()
            int r0 = r5.rightMargin
            int r1 = r1 - r0
            if (r2 < r1) goto L_0x006d
            int r3 = r4.right
        L_0x0046:
            int r2 = r8.getBottom()
            int r1 = r7.getHeight()
            int r0 = r5.bottomMargin
            int r1 = r1 - r0
            if (r2 < r1) goto L_0x0061
            int r0 = r4.bottom
        L_0x0055:
            if (r0 == 0) goto L_0x005a
            androidx.core.g.t.LIZIZ(r8, r0)
        L_0x005a:
            if (r3 == 0) goto L_0x005f
            androidx.core.g.t.LIZJ(r8, r3)
        L_0x005f:
            r0 = 1
            return r0
        L_0x0061:
            int r1 = r8.getTop()
            int r0 = r5.topMargin
            if (r1 > r0) goto L_0x005a
            int r0 = r4.top
            int r0 = -r0
            goto L_0x0055
        L_0x006d:
            int r1 = r8.getLeft()
            int r0 = r5.leftMargin
            if (r1 > r0) goto L_0x0079
            int r0 = r4.left
            int r3 = -r0
            goto L_0x0046
        L_0x0079:
            r3 = 0
            goto L_0x0046
        L_0x007b:
            boolean r0 = LIZ(r1)
            if (r0 == 0) goto L_0x0087
            boolean r0 = r6.LIZIZ(r1, r8)
            if (r0 != 0) goto L_0x001e
        L_0x0087:
            int r2 = r2 + 1
            goto L_0x000a
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.floatingactionbutton.FloatingActionButton$BaseBehavior.onLayoutChild(X.1gt, X.Qsz, int):boolean");
    }

    /* renamed from: LIZ */
    public boolean getInsetDodgeRect(1gt r7, C4796Qsz qsz, Rect rect) {
        Rect rect2 = qsz.LIZJ;
        rect.set(qsz.getLeft() + rect2.left, qsz.getTop() + rect2.top, qsz.getRight() - rect2.right, qsz.getBottom() - rect2.bottom);
        return true;
    }

    /* renamed from: LIZ */
    public boolean onDependentViewChanged(1gt r2, C4796Qsz qsz, View view) {
        if (view instanceof C4782Qsl) {
            LIZ(r2, (C4782Qsl) view, qsz);
            return false;
        } else if (!LIZ(view)) {
            return false;
        } else {
            LIZIZ(view, qsz);
            return false;
        }
    }
}
