package defpackage;

import android.R;
import android.animation.ValueAnimator;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;

/* renamed from: ʿᵾ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0485 extends AbstractC2003 {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public final RunnableC2802 f2558;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final int f2559;

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public float f2560;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public int f2561;

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

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final int f2563;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final StateListDrawable f2564;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final int f2566;

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public final RecyclerView f2567;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public int f2569;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public final ValueAnimator f2571;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final int f2572;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public int f2575;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public float f2576;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public int f2577;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final int f2578;

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

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public int f2581;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final Drawable f2582;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final Drawable f2583;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public static final int[] f2557 = {R.attr.state_pressed};

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public static final int[] f2556 = new int[0];

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public int f2568 = 0;

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

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public boolean f2574 = false;

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public boolean f2565 = false;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public int f2573 = 0;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public int f2570 = 0;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final int[] f2585 = new int[2];

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final int[] f2584 = new int[2];

    /* JADX WARN: Multi-variable type inference failed */
    public C0485(RecyclerView recyclerView, StateListDrawable stateListDrawable, Drawable drawable, StateListDrawable stateListDrawable2, Drawable drawable2, int i, int i2, int i3) {
        ValueAnimator valueAnimatorOfFloat = ValueAnimator.ofFloat(0.0f, 1.0f);
        this.f2571 = valueAnimatorOfFloat;
        this.f2569 = 0;
        RunnableC2802 runnableC2802 = new RunnableC2802(10, this);
        this.f2558 = runnableC2802;
        C3812 c3812 = new C3812(0 == true ? 1 : 0, this);
        this.f2564 = stateListDrawable;
        this.f2583 = drawable;
        this.f2562 = stateListDrawable2;
        this.f2582 = drawable2;
        this.f2559 = Math.max(i, stateListDrawable.getIntrinsicWidth());
        this.f2563 = Math.max(i, drawable.getIntrinsicWidth());
        this.f2566 = Math.max(i, stateListDrawable2.getIntrinsicWidth());
        this.f2579 = Math.max(i, drawable2.getIntrinsicWidth());
        this.f2572 = i2;
        this.f2578 = i3;
        stateListDrawable.setAlpha(255);
        drawable.setAlpha(255);
        valueAnimatorOfFloat.addListener(new ˋʘ(this));
        valueAnimatorOfFloat.addUpdateListener(new C1156(1, this));
        RecyclerView recyclerView2 = this.f2567;
        if (recyclerView2 == recyclerView) {
            return;
        }
        if (recyclerView2 != null) {
            ArrayList arrayList = recyclerView2.f860;
            AbstractC1935 abstractC1935 = recyclerView2.f919;
            if (abstractC1935 != null) {
                abstractC1935.mo510("Cannot remove item decoration during a scroll  or layout");
            }
            arrayList.remove(this);
            if (arrayList.isEmpty()) {
                recyclerView2.setWillNotDraw(recyclerView2.getOverScrollMode() == 2);
            }
            recyclerView2.m558();
            recyclerView2.requestLayout();
            RecyclerView recyclerView3 = this.f2567;
            recyclerView3.f927.remove(this);
            if (recyclerView3.f880 == this) {
                recyclerView3.f880 = null;
            }
            ArrayList arrayList2 = this.f2567.f912;
            if (arrayList2 != null) {
                arrayList2.remove(c3812);
            }
            this.f2567.removeCallbacks(runnableC2802);
        }
        this.f2567 = recyclerView;
        recyclerView.m596(this);
        this.f2567.f927.add(this);
        this.f2567.m569(c3812);
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static int m2107(float f, float f2, int[] iArr, int i, int i2, int i3) {
        int i4 = iArr[1] - iArr[0];
        if (i4 != 0) {
            int i5 = i - i3;
            int i6 = (int) (((f2 - f) / i4) * i5);
            int i7 = i2 + i6;
            if (i7 < i5 && i7 >= 0) {
                return i6;
            }
        }
        return 0;
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m2108() {
        int i = this.f2569;
        ValueAnimator valueAnimator = this.f2571;
        if (i != 0) {
            if (i != 3) {
                return;
            } else {
                valueAnimator.cancel();
            }
        }
        this.f2569 = 1;
        valueAnimator.setFloatValues(((Float) valueAnimator.getAnimatedValue()).floatValue(), 1.0f);
        valueAnimator.setDuration(500L);
        valueAnimator.setStartDelay(0L);
        valueAnimator.start();
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void m2109(int i) {
        RecyclerView recyclerView = this.f2567;
        RunnableC2802 runnableC2802 = this.f2558;
        StateListDrawable stateListDrawable = this.f2564;
        if (i == 2 && this.f2573 != 2) {
            stateListDrawable.setState(f2557);
            recyclerView.removeCallbacks(runnableC2802);
        }
        if (i == 0) {
            recyclerView.invalidate();
        } else {
            m2108();
        }
        if (this.f2573 == 2 && i != 2) {
            stateListDrawable.setState(f2556);
            recyclerView.removeCallbacks(runnableC2802);
            recyclerView.postDelayed(runnableC2802, 1200L);
        } else if (i == 1) {
            recyclerView.removeCallbacks(runnableC2802);
            recyclerView.postDelayed(runnableC2802, 1500L);
        }
        this.f2573 = i;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final boolean m2110(float f, float f2) {
        if (f2 < this.f2580 - this.f2566) {
            return false;
        }
        int i = this.f2577;
        int i2 = this.f2575;
        return f >= ((float) (i - (i2 / 2))) && f <= ((float) ((i2 / 2) + i));
    }

    @Override // defpackage.AbstractC2003
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void mo2111(Canvas canvas, RecyclerView recyclerView) {
        int i = this.f2568;
        RecyclerView recyclerView2 = this.f2567;
        if (i != recyclerView2.getWidth() || this.f2580 != recyclerView2.getHeight()) {
            this.f2568 = recyclerView2.getWidth();
            this.f2580 = recyclerView2.getHeight();
            m2109(0);
            return;
        }
        if (this.f2569 != 0) {
            if (this.f2574) {
                int i2 = this.f2568;
                int i3 = this.f2559;
                int i4 = i2 - i3;
                int i5 = this.f2561;
                int i6 = this.f2581;
                int i7 = i5 - (i6 / 2);
                StateListDrawable stateListDrawable = this.f2564;
                stateListDrawable.setBounds(0, 0, i3, i6);
                int i8 = this.f2563;
                int i9 = this.f2580;
                Drawable drawable = this.f2583;
                drawable.setBounds(0, 0, i8, i9);
                if (recyclerView2.getLayoutDirection() == 1) {
                    drawable.draw(canvas);
                    canvas.translate(i3, i7);
                    canvas.scale(-1.0f, 1.0f);
                    stateListDrawable.draw(canvas);
                    canvas.scale(-1.0f, 1.0f);
                    canvas.translate(-i3, -i7);
                } else {
                    canvas.translate(i4, 0.0f);
                    drawable.draw(canvas);
                    canvas.translate(0.0f, i7);
                    stateListDrawable.draw(canvas);
                    canvas.translate(-i4, -i7);
                }
            }
            if (this.f2565) {
                int i10 = this.f2580;
                int i11 = this.f2566;
                int i12 = i10 - i11;
                int i13 = this.f2577;
                int i14 = this.f2575;
                int i15 = i13 - (i14 / 2);
                StateListDrawable stateListDrawable2 = this.f2562;
                stateListDrawable2.setBounds(0, 0, i14, i11);
                int i16 = this.f2568;
                int i17 = this.f2579;
                Drawable drawable2 = this.f2582;
                drawable2.setBounds(0, 0, i16, i17);
                canvas.translate(0.0f, i12);
                drawable2.draw(canvas);
                canvas.translate(i15, 0.0f);
                stateListDrawable2.draw(canvas);
                canvas.translate(-i15, -i12);
            }
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final boolean m2112(float f, float f2) {
        int layoutDirection = this.f2567.getLayoutDirection();
        int i = this.f2559;
        if (layoutDirection == 1) {
            if (f > i) {
                return false;
            }
        } else if (f < this.f2568 - i) {
            return false;
        }
        int i2 = this.f2561;
        int i3 = this.f2581 / 2;
        return f2 >= ((float) (i2 - i3)) && f2 <= ((float) (i3 + i2));
    }
}
