package com.google.android.material.transformation;

import X.05s;
import X.1gt;
import X.C4796Qsz;
import X.C4825QtS;
import X.C4827QtU;
import X.Okc;
import android.animation.Animator;
import android.content.Context;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewGroup;
import com.bytedance.covode.number.Covode;
import java.util.List;

public abstract class FabTransformationBehavior extends ExpandableTransformationBehavior {
    public final Rect LIZJ = new Rect();
    public final RectF LIZLLL = new RectF();
    public final RectF LJ = new RectF();
    public final int[] LJFF = new int[2];

    static {
        Covode.recordClassIndex(44062);
    }

    public abstract C4825QtS LIZ(Context context, boolean z);

    public FabTransformationBehavior() {
    }

    private ViewGroup LIZ(View view) {
        if (view instanceof ViewGroup) {
            return (ViewGroup) view;
        }
        return null;
    }

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

    public FabTransformationBehavior(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
    }

    private void LIZ(View view, RectF rectF) {
        rectF.set(0.0f, 0.0f, (float) view.getWidth(), (float) view.getHeight());
        int[] iArr = this.LJFF;
        view.getLocationInWindow(iArr);
        rectF.offsetTo((float) iArr[0], (float) iArr[1]);
        rectF.offset((float) ((int) (-view.getTranslationX())), (float) ((int) (-view.getTranslationY())));
    }

    private float LIZ(C4825QtS qtS, Okc okc, float f) {
        long j = okc.LIZ;
        long j2 = okc.LIZIZ;
        Okc LIZ = qtS.LIZ.LIZ("expansion");
        return f + (okc.LIZ().getInterpolation(((float) (((LIZ.LIZ + LIZ.LIZIZ) + 17) - j)) / ((float) j2)) * (0.0f - f));
    }

    private float LIZIZ(View view, View view2, C4827QtU qtU) {
        float f;
        float f2;
        float f3;
        RectF rectF = this.LIZLLL;
        RectF rectF2 = this.LJ;
        LIZ(view, rectF);
        LIZ(view2, rectF2);
        int i = qtU.LIZ & 112;
        if (i != 16) {
            if (i == 48) {
                f = rectF2.top;
                f2 = rectF.top;
            } else if (i != 80) {
                f3 = 0.0f;
            } else {
                f = rectF2.bottom;
                f2 = rectF.bottom;
            }
            f3 = f - f2;
        } else {
            f = rectF2.centerY();
            f2 = rectF.centerY();
            f3 = f - f2;
        }
        return f3 + qtU.LIZJ;
    }

    public boolean layoutDependsOn(1gt r4, View view, View view2) {
        if (view.getVisibility() == 8) {
            throw new IllegalStateException("This behavior cannot be attached to a GONE view. Set the view to INVISIBLE instead.");
        } else if (!(view2 instanceof C4796Qsz)) {
            return false;
        } else {
            int expandedComponentIdHint = ((C4796Qsz) view2).getExpandedComponentIdHint();
            if (expandedComponentIdHint == 0 || expandedComponentIdHint == view.getId()) {
                return true;
            }
            return false;
        }
    }

    private float LIZ(View view, View view2, C4827QtU qtU) {
        float f;
        float f2;
        float f3;
        RectF rectF = this.LIZLLL;
        RectF rectF2 = this.LJ;
        LIZ(view, rectF);
        LIZ(view2, rectF2);
        int i = qtU.LIZ & 7;
        if (i != 1) {
            if (i == 3) {
                f = rectF2.left;
                f2 = rectF.left;
            } else if (i != 5) {
                f3 = 0.0f;
            } else {
                f = rectF2.right;
                f2 = rectF.right;
            }
            f3 = f - f2;
        } else {
            f = rectF2.centerX();
            f2 = rectF.centerX();
            f3 = f - f2;
        }
        return f3 + qtU.LIZIZ;
    }

    /* JADX WARNING: Removed duplicated region for block: B:21:0x0123  */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x016c  */
    /* JADX WARNING: Removed duplicated region for block: B:29:0x017e  */
    /* JADX WARNING: Removed duplicated region for block: B:35:0x01a6 A[ADDED_TO_REGION] */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x01ff A[LOOP:0: B:48:0x01fd->B:49:0x01ff, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:58:0x023a  */
    /* JADX WARNING: Removed duplicated region for block: B:59:0x0248  */
    /* JADX WARNING: Removed duplicated region for block: B:61:0x0253  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final android.animation.AnimatorSet LIZIZ(android.view.View r27, android.view.View r28, boolean r29, boolean r30) {
        /*
            r26 = this;
            r14 = r26
            r12 = r28
            android.content.Context r0 = r12.getContext()
            r11 = r29
            X.QtS r10 = r14.LIZ((android.content.Context) r0, (boolean) r11)
            java.util.ArrayList r9 = new java.util.ArrayList
            r9.<init>()
            java.util.ArrayList r17 = new java.util.ArrayList
            r17.<init>()
            float r3 = r12.getElevation()
            r13 = r27
            float r0 = r13.getElevation()
            float r3 = r3 - r0
            r4 = 0
            r7 = 1
            r16 = 0
            if (r11 == 0) goto L_0x0336
            if (r30 != 0) goto L_0x002f
            float r0 = -r3
            r12.setTranslationZ(r0)
        L_0x002f:
            android.util.Property r1 = android.view.View.TRANSLATION_Z
            float[] r0 = new float[r7]
            r0[r16] = r4
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofFloat(r12, r1, r0)
        L_0x0039:
            X.OhT r1 = r10.LIZ
            java.lang.String r0 = "elevation"
            X.Okc r0 = r1.LIZ(r0)
            r0.LIZ(r2)
            r9.add(r2)
            android.graphics.RectF r15 = r14.LIZLLL
            X.QtU r0 = r10.LIZIZ
            float r2 = r14.LIZ((android.view.View) r13, (android.view.View) r12, (X.C4827QtU) r0)
            X.QtU r0 = r10.LIZIZ
            float r1 = r14.LIZIZ(r13, r12, r0)
            int r0 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1))
            if (r0 == 0) goto L_0x005d
            int r0 = (r1 > r4 ? 1 : (r1 == r4 ? 0 : -1))
            if (r0 != 0) goto L_0x030a
        L_0x005d:
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationXLinear"
            X.Okc r8 = r3.LIZ(r0)
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationYLinear"
            X.Okc r6 = r3.LIZ(r0)
        L_0x006d:
            if (r11 == 0) goto L_0x02f2
            if (r30 != 0) goto L_0x0079
            float r0 = -r2
            r12.setTranslationX(r0)
            float r0 = -r1
            r12.setTranslationY(r0)
        L_0x0079:
            android.util.Property r3 = android.view.View.TRANSLATION_X
            float[] r0 = new float[r7]
            r0[r16] = r4
            android.animation.ObjectAnimator r5 = android.animation.ObjectAnimator.ofFloat(r12, r3, r0)
            android.util.Property r3 = android.view.View.TRANSLATION_Y
            float[] r0 = new float[r7]
            r0[r16] = r4
            android.animation.ObjectAnimator r4 = android.animation.ObjectAnimator.ofFloat(r12, r3, r0)
            float r2 = -r2
            float r0 = -r1
            float r3 = r14.LIZ((X.C4825QtS) r10, (X.Okc) r8, (float) r2)
            float r2 = r14.LIZ((X.C4825QtS) r10, (X.Okc) r6, (float) r0)
            android.graphics.Rect r0 = r14.LIZJ
            r12.getWindowVisibleDisplayFrame(r0)
            android.graphics.RectF r1 = r14.LIZLLL
            r1.set(r0)
            android.graphics.RectF r0 = r14.LJ
            r14.LIZ((android.view.View) r12, (android.graphics.RectF) r0)
            r0.offset(r3, r2)
            r0.intersect(r1)
            r15.set(r0)
        L_0x00af:
            r8.LIZ(r5)
            r6.LIZ(r4)
            r9.add(r5)
            r9.add(r4)
            float r0 = r15.width()
            float r1 = r15.height()
            boolean r8 = r12 instanceof X.C4816QtJ
            if (r8 == 0) goto L_0x00cb
            boolean r2 = r13 instanceof android.widget.ImageView
            if (r2 != 0) goto L_0x02a3
        L_0x00cb:
            if (r8 == 0) goto L_0x02a0
        L_0x00cd:
            r7 = r12
            X.QtJ r7 = (X.C4816QtJ) r7
            X.QtU r2 = r10.LIZIZ
            android.graphics.RectF r3 = r14.LIZLLL
            android.graphics.RectF r4 = r14.LJ
            r14.LIZ((android.view.View) r13, (android.graphics.RectF) r3)
            r14.LIZ((android.view.View) r12, (android.graphics.RectF) r4)
            float r2 = r14.LIZ((android.view.View) r13, (android.view.View) r12, (X.C4827QtU) r2)
            float r2 = -r2
            r6 = 0
            r4.offset(r2, r6)
            float r3 = r3.centerX()
            float r2 = r4.left
            float r3 = r3 - r2
            X.QtU r2 = r10.LIZIZ
            android.graphics.RectF r5 = r14.LIZLLL
            android.graphics.RectF r4 = r14.LJ
            r14.LIZ((android.view.View) r13, (android.graphics.RectF) r5)
            r14.LIZ((android.view.View) r12, (android.graphics.RectF) r4)
            float r2 = r14.LIZIZ(r13, r12, r2)
            float r2 = -r2
            r4.offset(r6, r2)
            float r2 = r5.centerY()
            float r4 = r4.top
            float r2 = r2 - r4
            r5 = r13
            X.Qsz r5 = (X.C4796Qsz) r5
            android.graphics.Rect r4 = r14.LIZJ
            r5.LIZ((android.graphics.Rect) r4)
            android.graphics.Rect r4 = r14.LIZJ
            int r4 = r4.width()
            float r6 = (float) r4
            r4 = 1073741824(0x40000000, float:2.0)
            float r6 = r6 / r4
            X.OhT r5 = r10.LIZ
            java.lang.String r4 = "expansion"
            X.Okc r5 = r5.LIZ(r4)
            if (r11 == 0) goto L_0x0253
            if (r30 != 0) goto L_0x024b
            X.QtO r4 = new X.QtO
            r4.<init>(r3, r2, r6)
            r7.setRevealInfo(r4)
        L_0x012d:
            float r0 = X.C4824QtR.LIZ(r3, r2, r0, r1)
            android.animation.Animator r4 = X.C4814QtH.LIZ(r7, r3, r2, r0)
            com.google.android.material.transformation.FabTransformationBehavior$4 r0 = new com.google.android.material.transformation.FabTransformationBehavior$4
            r0.<init>(r7)
            r4.addListener(r0)
            long r0 = r5.LIZ
            int r3 = (int) r3
            int r14 = (int) r2
            r18 = r26
            r19 = r12
            r2 = 1
            r22 = r3
            r23 = r14
            r24 = r6
            r25 = r9
            r20 = r0
            r18.LIZ(r19, r20, r22, r23, r24, r25)
        L_0x0153:
            r5.LIZ(r4)
            r9.add(r4)
            X.QtQ r1 = new X.QtQ
            r1.<init>(r7)
            r0 = r17
            r0.add(r1)
            r3 = r12
            X.QtJ r3 = (X.C4816QtJ) r3
            android.content.res.ColorStateList r2 = r13.getBackgroundTintList()
            if (r2 == 0) goto L_0x0248
            int[] r1 = r13.getDrawableState()
            int r0 = r2.getDefaultColor()
            int r5 = r2.getColorForState(r1, r0)
        L_0x0178:
            r4 = 16777215(0xffffff, float:2.3509886E-38)
            r4 = r4 & r5
            if (r11 == 0) goto L_0x023a
            if (r30 != 0) goto L_0x0183
            r3.setCircularRevealScrimColor(r5)
        L_0x0183:
            android.util.Property<X.QtJ, java.lang.Integer> r2 = X.C4815QtI.LIZ
            r0 = 1
            int[] r1 = new int[r0]
            r0 = 0
            r1[r0] = r4
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofInt(r3, r2, r1)
        L_0x018f:
            X.QjR r0 = X.C4204QjR.LIZ
            r2.setEvaluator(r0)
            X.OhT r1 = r10.LIZ
            java.lang.String r0 = "color"
            X.Okc r0 = r1.LIZ(r0)
            r0.LIZ(r2)
            r9.add(r2)
        L_0x01a2:
            boolean r0 = r12 instanceof android.view.ViewGroup
            if (r0 == 0) goto L_0x0237
            if (r8 == 0) goto L_0x01ac
            int r0 = X.C4818QtL.LIZ
            if (r0 == 0) goto L_0x0237
        L_0x01ac:
            r0 = 2131367736(0x7f0a1738, float:1.8355402E38)
            android.view.View r0 = r12.findViewById(r0)
            if (r0 == 0) goto L_0x021a
            r6 = 1
            r4 = r26
            android.view.ViewGroup r5 = r4.LIZ(r0)
        L_0x01bc:
            if (r5 == 0) goto L_0x01e7
            if (r11 == 0) goto L_0x020d
            if (r30 != 0) goto L_0x01cc
            android.util.Property r1 = X.O7L.LIZ
            r0 = 0
            java.lang.Float r0 = java.lang.Float.valueOf(r0)
            r1.set(r5, r0)
        L_0x01cc:
            android.util.Property r3 = X.O7L.LIZ
            float[] r2 = new float[r6]
            r1 = 1065353216(0x3f800000, float:1.0)
            r0 = 0
            r2[r0] = r1
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofFloat(r5, r3, r2)
        L_0x01d9:
            X.OhT r1 = r10.LIZ
            java.lang.String r0 = "contentFade"
            X.Okc r0 = r1.LIZ(r0)
            r0.LIZ(r2)
            r9.add(r2)
        L_0x01e7:
            android.animation.AnimatorSet r3 = new android.animation.AnimatorSet
            r3.<init>()
            X.OHq.LIZ(r3, r9)
            com.google.android.material.transformation.FabTransformationBehavior$1 r1 = new com.google.android.material.transformation.FabTransformationBehavior$1
            r0 = 0
            r1.<init>(r11, r12, r13)
            r3.addListener(r1)
            int r2 = r17.size()
            r1 = 0
        L_0x01fd:
            if (r1 >= r2) goto L_0x0343
            r0 = r17
            java.lang.Object r0 = r0.get(r1)
            android.animation.Animator$AnimatorListener r0 = (android.animation.Animator.AnimatorListener) r0
            r3.addListener(r0)
            int r1 = r1 + 1
            goto L_0x01fd
        L_0x020d:
            r3 = 0
            android.util.Property r2 = X.O7L.LIZ
            float[] r1 = new float[r6]
            r0 = 0
            r1[r3] = r0
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofFloat(r5, r2, r1)
            goto L_0x01d9
        L_0x021a:
            r6 = 1
            r4 = r26
            boolean r0 = r12 instanceof X.C4830QtX
            if (r0 != 0) goto L_0x0225
            boolean r0 = r12 instanceof X.C4829QtW
            if (r0 == 0) goto L_0x0232
        L_0x0225:
            r1 = r12
            android.view.ViewGroup r1 = (android.view.ViewGroup) r1
            r0 = 0
            android.view.View r0 = r1.getChildAt(r0)
            android.view.ViewGroup r5 = r4.LIZ(r0)
            goto L_0x01bc
        L_0x0232:
            android.view.ViewGroup r5 = r4.LIZ(r12)
            goto L_0x01bc
        L_0x0237:
            r4 = r26
            goto L_0x01e7
        L_0x023a:
            r0 = 1
            r2 = 0
            android.util.Property<X.QtJ, java.lang.Integer> r1 = X.C4815QtI.LIZ
            int[] r0 = new int[r0]
            r0[r2] = r5
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofInt(r3, r1, r0)
            goto L_0x018f
        L_0x0248:
            r5 = 0
            goto L_0x0178
        L_0x024b:
            X.QtO r4 = r7.getRevealInfo()
            float r6 = r4.LIZJ
            goto L_0x012d
        L_0x0253:
            r0 = 1
            X.QtO r0 = r7.getRevealInfo()
            float r14 = r0.LIZJ
            android.animation.Animator r4 = X.C4814QtH.LIZ(r7, r3, r2, r6)
            long r0 = r5.LIZ
            int r3 = (int) r3
            r22 = r3
            int r2 = (int) r2
            r16 = r2
            r18 = r26
            r19 = r12
            r22 = r22
            r23 = r16
            r24 = r14
            r25 = r9
            r20 = r0
            r18.LIZ(r19, r20, r22, r23, r24, r25)
            long r2 = r5.LIZ
            long r14 = r5.LIZIZ
            X.OhT r0 = r10.LIZ
            long r0 = r0.LIZ()
            long r2 = r2 + r14
            int r14 = (r2 > r0 ? 1 : (r2 == r0 ? 0 : -1))
            if (r14 >= 0) goto L_0x0153
            r18 = r12
            r19 = r22
            r20 = r16
            r21 = r6
            r22 = r6
            android.animation.Animator r6 = android.view.ViewAnimationUtils.createCircularReveal(r18, r19, r20, r21, r22)
            r6.setStartDelay(r2)
            long r0 = r0 - r2
            r6.setDuration(r0)
            r9.add(r6)
            goto L_0x0153
        L_0x02a0:
            r0 = 1
            goto L_0x01a2
        L_0x02a3:
            r5 = r12
            X.QtJ r5 = (X.C4816QtJ) r5
            r2 = r13
            android.widget.ImageView r2 = (android.widget.ImageView) r2
            android.graphics.drawable.Drawable r4 = r2.getDrawable()
            if (r4 == 0) goto L_0x00cb
            r4.mutate()
            r6 = 255(0xff, float:3.57E-43)
            if (r11 == 0) goto L_0x02e7
            if (r30 != 0) goto L_0x02bb
            r4.setAlpha(r6)
        L_0x02bb:
            android.util.Property r3 = X.Ofr.LIZ
            int[] r2 = new int[r7]
            r2[r16] = r16
            android.animation.ObjectAnimator r6 = android.animation.ObjectAnimator.ofInt(r4, r3, r2)
        L_0x02c5:
            com.google.android.material.transformation.FabTransformationBehavior$2 r2 = new com.google.android.material.transformation.FabTransformationBehavior$2
            r2.<init>(r12)
            r6.addUpdateListener(r2)
            X.OhT r3 = r10.LIZ
            java.lang.String r2 = "iconFade"
            X.Okc r2 = r3.LIZ(r2)
            r2.LIZ(r6)
            r9.add(r6)
            com.google.android.material.transformation.FabTransformationBehavior$3 r3 = new com.google.android.material.transformation.FabTransformationBehavior$3
            r3.<init>(r5, r4)
            r2 = r17
            r2.add(r3)
            goto L_0x00cd
        L_0x02e7:
            android.util.Property r3 = X.Ofr.LIZ
            int[] r2 = new int[r7]
            r2[r16] = r6
            android.animation.ObjectAnimator r6 = android.animation.ObjectAnimator.ofInt(r4, r3, r2)
            goto L_0x02c5
        L_0x02f2:
            android.util.Property r4 = android.view.View.TRANSLATION_X
            float[] r3 = new float[r7]
            float r0 = -r2
            r3[r16] = r0
            android.animation.ObjectAnimator r5 = android.animation.ObjectAnimator.ofFloat(r12, r4, r3)
            android.util.Property r3 = android.view.View.TRANSLATION_Y
            float[] r2 = new float[r7]
            float r0 = -r1
            r2[r16] = r0
            android.animation.ObjectAnimator r4 = android.animation.ObjectAnimator.ofFloat(r12, r3, r2)
            goto L_0x00af
        L_0x030a:
            if (r11 == 0) goto L_0x0322
            int r0 = (r1 > r4 ? 1 : (r1 == r4 ? 0 : -1))
            if (r0 < 0) goto L_0x0324
        L_0x0310:
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationXCurveDownwards"
            X.Okc r8 = r3.LIZ(r0)
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationYCurveDownwards"
            X.Okc r6 = r3.LIZ(r0)
            goto L_0x006d
        L_0x0322:
            if (r0 <= 0) goto L_0x0310
        L_0x0324:
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationXCurveUpwards"
            X.Okc r8 = r3.LIZ(r0)
            X.OhT r3 = r10.LIZ
            java.lang.String r0 = "translationYCurveUpwards"
            X.Okc r6 = r3.LIZ(r0)
            goto L_0x006d
        L_0x0336:
            android.util.Property r2 = android.view.View.TRANSLATION_Z
            float[] r1 = new float[r7]
            float r0 = -r3
            r1[r16] = r0
            android.animation.ObjectAnimator r2 = android.animation.ObjectAnimator.ofFloat(r12, r2, r1)
            goto L_0x0039
        L_0x0343:
            return r3
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.transformation.FabTransformationBehavior.LIZIZ(android.view.View, android.view.View, boolean, boolean):android.animation.AnimatorSet");
    }

    private void LIZ(View view, long j, int i, int i2, float f, List<Animator> list) {
        if (j > 0) {
            Animator createCircularReveal = ViewAnimationUtils.createCircularReveal(view, i, i2, f, f);
            createCircularReveal.setStartDelay(0);
            createCircularReveal.setDuration(j);
            list.add(createCircularReveal);
        }
    }
}
