package u5;

import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;

/* loaded from: classes.dex */
public class l extends j0 {

    /* renamed from: b, reason: collision with root package name */
    private float f36888b = 3.0f;

    /* renamed from: c, reason: collision with root package name */
    private int f36889c = 80;

    /* JADX WARN: Code restructure failed: missing block: B:24:0x0017, code lost:
    
        r5 = 3;
     */
    /* JADX WARN: Code restructure failed: missing block: B:30:0x0026, code lost:
    
        if ((androidx.core.view.s0.z(r6) == 1) != false) goto L10;
     */
    /* JADX WARN: Code restructure failed: missing block: B:6:0x0013, code lost:
    
        if ((androidx.core.view.s0.z(r6) == 1) != false) goto L9;
     */
    /* JADX WARN: Code restructure failed: missing block: B:7:0x0015, code lost:
    
        r5 = 5;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    private int h(View view, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17) {
        int i18 = this.f36889c;
        if (i18 != 8388611) {
            if (i18 == 8388613) {
            }
        }
        if (i18 == 3) {
            return (i16 - i10) + Math.abs(i13 - i11);
        }
        if (i18 == 5) {
            return (i10 - i14) + Math.abs(i13 - i11);
        }
        if (i18 == 48) {
            return (i17 - i11) + Math.abs(i12 - i10);
        }
        if (i18 != 80) {
            return 0;
        }
        return (i11 - i15) + Math.abs(i12 - i10);
    }

    private int i(ViewGroup viewGroup) {
        int i10 = this.f36889c;
        return (i10 == 3 || i10 == 5 || i10 == 8388611 || i10 == 8388613) ? viewGroup.getWidth() : viewGroup.getHeight();
    }

    @Override // u5.q
    public long c(ViewGroup viewGroup, n nVar, t tVar, t tVar2) {
        int i10;
        int i11;
        int i12;
        t tVar3 = tVar;
        if (tVar3 == null && tVar2 == null) {
            return 0L;
        }
        Rect u10 = nVar.u();
        if (tVar2 == null || e(tVar3) == 0) {
            i10 = -1;
        } else {
            tVar3 = tVar2;
            i10 = 1;
        }
        int f10 = f(tVar3);
        int g10 = g(tVar3);
        int[] iArr = new int[2];
        viewGroup.getLocationOnScreen(iArr);
        int round = iArr[0] + Math.round(viewGroup.getTranslationX());
        int round2 = iArr[1] + Math.round(viewGroup.getTranslationY());
        int width = round + viewGroup.getWidth();
        int height = round2 + viewGroup.getHeight();
        if (u10 != null) {
            i11 = u10.centerX();
            i12 = u10.centerY();
        } else {
            i11 = (round + width) / 2;
            i12 = (round2 + height) / 2;
        }
        float h10 = h(viewGroup, f10, g10, i11, i12, round, round2, width, height) / i(viewGroup);
        long t10 = nVar.t();
        if (t10 < 0) {
            t10 = 300;
        }
        return Math.round((((float) (t10 * i10)) / this.f36888b) * h10);
    }

    public void j(int i10) {
        this.f36889c = i10;
    }
}
