package X6FRs_4.KQgRr5e_0.LGe8pk_15;

import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.SeekBar;
/* compiled from: AppCompatSeekBarHelper.java */
/* loaded from: classes.dex */
public class XnFJ5_9 extends Xgtqvk_8 {
    public ColorStateList KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public PorterDuff.Mode f781KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Drawable f782KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final SeekBar f783KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public boolean f784KQgRr5e_0;
    public boolean QxJ9d_1;

    public XnFJ5_9(SeekBar seekBar) {
        super(seekBar);
        this.KQgRr5e_0 = null;
        this.f781KQgRr5e_0 = null;
        this.f784KQgRr5e_0 = false;
        this.QxJ9d_1 = false;
        this.f783KQgRr5e_0 = seekBar;
    }

    @Override // X6FRs_4.KQgRr5e_0.LGe8pk_15.Xgtqvk_8
    public void KQgRr5e_0(AttributeSet attributeSet, int i) {
        super.KQgRr5e_0(attributeSet, i);
        NzhupJ_29 KQgRr5e_0 = NzhupJ_29.KQgRr5e_0(this.f783KQgRr5e_0.getContext(), attributeSet, X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar, i, 0);
        Drawable QxJ9d_1 = KQgRr5e_0.QxJ9d_1(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_android_thumb);
        if (QxJ9d_1 != null) {
            this.f783KQgRr5e_0.setThumb(QxJ9d_1);
        }
        KQgRr5e_0(KQgRr5e_0.m416KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_tickMark));
        if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_tickMarkTintMode)) {
            this.f781KQgRr5e_0 = YghfZG_14.KQgRr5e_0(KQgRr5e_0.Mqv2r_3(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_tickMarkTintMode, -1), this.f781KQgRr5e_0);
            this.QxJ9d_1 = true;
        }
        if (KQgRr5e_0.m419KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_tickMarkTint)) {
            this.KQgRr5e_0 = KQgRr5e_0.KQgRr5e_0(X6FRs_4.KQgRr5e_0.XnFJ5_9.AppCompatSeekBar_tickMarkTint);
            this.f784KQgRr5e_0 = true;
        }
        KQgRr5e_0.KQgRr5e_0();
        KQgRr5e_0();
    }

    public void PGPF6hQ_2() {
        Drawable drawable = this.f782KQgRr5e_0;
        if (drawable != null) {
            drawable.jumpToCurrentState();
        }
    }

    public void QxJ9d_1() {
        Drawable drawable = this.f782KQgRr5e_0;
        if (drawable != null && drawable.isStateful() && drawable.setState(this.f783KQgRr5e_0.getDrawableState())) {
            this.f783KQgRr5e_0.invalidateDrawable(drawable);
        }
    }

    @Override // X6FRs_4.KQgRr5e_0.LGe8pk_15.Xgtqvk_8
    public void KQgRr5e_0(Drawable drawable) {
        Drawable drawable2 = this.f782KQgRr5e_0;
        if (drawable2 != null) {
            drawable2.setCallback(null);
        }
        this.f782KQgRr5e_0 = drawable;
        if (drawable != null) {
            drawable.setCallback(this.f783KQgRr5e_0);
            X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.m294KQgRr5e_0(drawable, X6FRs_4.IMuAHx_6.EuDEkJe_12.ZzDuCHW_20.Mqv2r_3((View) this.f783KQgRr5e_0));
            if (drawable.isStateful()) {
                drawable.setState(this.f783KQgRr5e_0.getDrawableState());
            }
            KQgRr5e_0();
        }
        this.f783KQgRr5e_0.invalidate();
    }

    @Override // X6FRs_4.KQgRr5e_0.LGe8pk_15.Xgtqvk_8
    public final void KQgRr5e_0() {
        if (this.f782KQgRr5e_0 != null) {
            if (this.f784KQgRr5e_0 || this.QxJ9d_1) {
                Drawable m295QxJ9d_1 = X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.m295QxJ9d_1(this.f782KQgRr5e_0.mutate());
                this.f782KQgRr5e_0 = m295QxJ9d_1;
                if (this.f784KQgRr5e_0) {
                    X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.KQgRr5e_0(m295QxJ9d_1, this.KQgRr5e_0);
                }
                if (this.QxJ9d_1) {
                    X6FRs_4.IMuAHx_6.IFxWkV_5.XnFJ5_9.KQgRr5e_0.KQgRr5e_0(this.f782KQgRr5e_0, this.f781KQgRr5e_0);
                }
                if (this.f782KQgRr5e_0.isStateful()) {
                    this.f782KQgRr5e_0.setState(this.f783KQgRr5e_0.getDrawableState());
                }
            }
        }
    }

    public void KQgRr5e_0(Canvas canvas) {
        if (this.f782KQgRr5e_0 != null) {
            int max = this.f783KQgRr5e_0.getMax();
            if (max > 1) {
                int intrinsicWidth = this.f782KQgRr5e_0.getIntrinsicWidth();
                int intrinsicHeight = this.f782KQgRr5e_0.getIntrinsicHeight();
                int i = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
                int i2 = intrinsicHeight >= 0 ? intrinsicHeight / 2 : 1;
                this.f782KQgRr5e_0.setBounds(-i, -i2, i, i2);
                float width = ((this.f783KQgRr5e_0.getWidth() - this.f783KQgRr5e_0.getPaddingLeft()) - this.f783KQgRr5e_0.getPaddingRight()) / max;
                int save = canvas.save();
                canvas.translate(this.f783KQgRr5e_0.getPaddingLeft(), this.f783KQgRr5e_0.getHeight() / 2);
                for (int i3 = 0; i3 <= max; i3++) {
                    this.f782KQgRr5e_0.draw(canvas);
                    canvas.translate(width, 0.0f);
                }
                canvas.restoreToCount(save);
            }
        }
    }
}
