package com.google.android.material.bottomsheet;

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.SparseIntArray;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewConfiguration;
import ar.tvplayer.tv.R;
import defpackage.AbstractC0914;
import defpackage.C0871;
import defpackage.C1156;
import defpackage.C2445;
import defpackage.C2931;
import defpackage.C4879;
import defpackage.C5355;
import java.util.ArrayList;

/* loaded from: classes3.dex */
public class BottomSheetBehavior<V extends View> extends ʼٴ {

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final int f1032;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public final boolean f1033;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final boolean f1034;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public boolean f1035;

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final boolean f1036;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public boolean f1037;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final C4879 f1038;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final ValueAnimator f1039;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public final C2445 f1040;

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public int f1041;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public final ColorStateList f1042;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public int f1043;

    public BottomSheetBehavior() {
        this.f1034 = true;
        new C2931((BottomSheetBehavior) this);
        this.f1041 = 4;
        new ArrayList();
        new ArrayList();
        new SparseIntArray();
        new SparseIntArray();
        new SparseIntArray();
        new Rect();
    }

    public BottomSheetBehavior(Context context, AttributeSet attributeSet) throws Resources.NotFoundException {
        int i;
        this.f1034 = true;
        new C2931((BottomSheetBehavior) this);
        this.f1041 = 4;
        new ArrayList();
        new ArrayList();
        new SparseIntArray();
        new SparseIntArray();
        new SparseIntArray();
        new Rect();
        context.getResources().getDimensionPixelSize(R.dimen._11_res_0x7f07053b);
        TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, AbstractC0914.f4187);
        if (typedArrayObtainStyledAttributes.hasValue(3)) {
            this.f1042 = ˉˇʨ.ᵪʩ(context, typedArrayObtainStyledAttributes, 3);
        }
        if (typedArrayObtainStyledAttributes.hasValue(24)) {
            this.f1038 = C4879.m10320(context, attributeSet, R.attr._11_res_0x7f040095, R.style._11_res_0x7f140505).m9814();
        }
        C4879 c4879 = this.f1038;
        if (c4879 != null) {
            C2445 c2445 = new C2445(c4879);
            this.f1040 = c2445;
            c2445.f9549.f20066 = new C0871(context);
            c2445.m6252();
            ColorStateList colorStateList = this.f1042;
            if (colorStateList != null) {
                C2445 c24452 = this.f1040;
                C5355 c5355 = c24452.f9549;
                if (c5355.f20060 != colorStateList) {
                    c5355.f20060 = colorStateList;
                    c24452.onStateChange(c24452.getState());
                }
            } else {
                TypedValue typedValue = new TypedValue();
                context.getTheme().resolveAttribute(android.R.attr.colorBackground, typedValue, true);
                this.f1040.setTint(typedValue.data);
            }
        }
        ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
        this.f1039 = valueAnimatorOfFloat;
        valueAnimatorOfFloat.setDuration(500L);
        this.f1039.addUpdateListener(new C1156(0, this));
        typedArrayObtainStyledAttributes.getDimension(2, -1.0f);
        if (typedArrayObtainStyledAttributes.hasValue(0)) {
            typedArrayObtainStyledAttributes.getDimensionPixelSize(0, -1);
        }
        if (typedArrayObtainStyledAttributes.hasValue(1)) {
            typedArrayObtainStyledAttributes.getDimensionPixelSize(1, -1);
        }
        TypedValue typedValuePeekValue = typedArrayObtainStyledAttributes.peekValue(12);
        if (typedValuePeekValue == null || (i = typedValuePeekValue.data) != -1) {
            m814(typedArrayObtainStyledAttributes.getDimensionPixelSize(12, -1));
        } else {
            m814(i);
        }
        boolean z = typedArrayObtainStyledAttributes.getBoolean(10, false);
        if (this.f1036 != z) {
            this.f1036 = z;
            if (!z && this.f1041 == 5 && this.f1041 != 4) {
                this.f1041 = 4;
            }
        }
        typedArrayObtainStyledAttributes.getBoolean(16, false);
        boolean z2 = typedArrayObtainStyledAttributes.getBoolean(8, true);
        if (this.f1034 != z2) {
            this.f1034 = z2;
            int i2 = (z2 && this.f1041 == 6) ? 3 : this.f1041;
            if (this.f1041 != i2) {
                this.f1041 = i2;
            }
            m813(this.f1041);
        }
        typedArrayObtainStyledAttributes.getBoolean(15, false);
        typedArrayObtainStyledAttributes.getBoolean(5, true);
        typedArrayObtainStyledAttributes.getBoolean(6, true);
        typedArrayObtainStyledAttributes.getInt(13, 0);
        float f = typedArrayObtainStyledAttributes.getFloat(9, 0.5f);
        if (f <= 0.0f || f >= 1.0f) {
            ᵹˉᵞ.ˌᵜᵹᵩ("ratio must be a float value between 0 and 1");
            throw null;
        }
        TypedValue typedValuePeekValue2 = typedArrayObtainStyledAttributes.peekValue(7);
        if (typedValuePeekValue2 == null || typedValuePeekValue2.type != 16) {
            int dimensionPixelOffset = typedArrayObtainStyledAttributes.getDimensionPixelOffset(7, 0);
            if (dimensionPixelOffset < 0) {
                ᵹˉᵞ.ˌᵜᵹᵩ("offset must be greater than or equal to 0");
                throw null;
            }
            this.f1032 = dimensionPixelOffset;
            m813(this.f1041);
        } else {
            int i3 = typedValuePeekValue2.data;
            if (i3 < 0) {
                ᵹˉᵞ.ˌᵜᵹᵩ("offset must be greater than or equal to 0");
                throw null;
            }
            this.f1032 = i3;
            m813(this.f1041);
        }
        typedArrayObtainStyledAttributes.getInt(14, 500);
        typedArrayObtainStyledAttributes.getBoolean(11, false);
        typedArrayObtainStyledAttributes.getBoolean(4, true);
        typedArrayObtainStyledAttributes.getBoolean(20, false);
        typedArrayObtainStyledAttributes.getBoolean(21, false);
        typedArrayObtainStyledAttributes.getBoolean(22, false);
        typedArrayObtainStyledAttributes.getBoolean(23, true);
        typedArrayObtainStyledAttributes.getBoolean(17, false);
        typedArrayObtainStyledAttributes.getBoolean(18, false);
        typedArrayObtainStyledAttributes.getBoolean(19, false);
        this.f1033 = typedArrayObtainStyledAttributes.getBoolean(26, true);
        typedArrayObtainStyledAttributes.recycle();
        ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    }

    /* renamed from: ʾˋˊᵽ, reason: contains not printable characters */
    public final void m813(int i) {
        C2445 c2445;
        if (i == 2) {
            return;
        }
        boolean z = this.f1041 == 3 && this.f1033;
        if (this.f1037 == z || (c2445 = this.f1040) == null) {
            return;
        }
        this.f1037 = z;
        ValueAnimator valueAnimator = this.f1039;
        if (valueAnimator != null) {
            if (valueAnimator.isRunning()) {
                valueAnimator.reverse();
                return;
            } else {
                valueAnimator.setFloatValues(c2445.f9549.f20061, z ? 0.0f : 1.0f);
                valueAnimator.start();
                return;
            }
        }
        if (valueAnimator != null && valueAnimator.isRunning()) {
            valueAnimator.cancel();
        }
        float f = this.f1037 ? 0.0f : 1.0f;
        C5355 c5355 = c2445.f9549;
        if (c5355.f20061 != f) {
            c5355.f20061 = f;
            c2445.f9548 = true;
            c2445.f9531 = true;
            c2445.invalidateSelf();
        }
    }

    /* renamed from: ᵰʖʢ, reason: contains not printable characters */
    public final void m814(int i) {
        boolean z = this.f1035;
        if (i == -1) {
            if (z) {
                return;
            }
            this.f1035 = true;
        } else if (z || this.f1043 != i) {
            this.f1035 = false;
            this.f1043 = Math.max(0, i);
        }
    }
}
