package ῲ.ῲ.㴹;

import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.SeekBar;
import androidx.appcompat.R$styleable;
import ῲ.ᨨ.ᨨ.C1729;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.ῲ.㴹.㳳  reason: contains not printable characters */
/* compiled from: AppCompatSeekBarHelper */
public class C2042 extends C2024 {

    /* renamed from: ඓ  reason: contains not printable characters */
    public Drawable f6944;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public boolean f6945 = false;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public PorterDuff.Mode f6946 = null;

    /* renamed from: 㴹  reason: contains not printable characters */
    public ColorStateList f6947 = null;

    /* renamed from: 㸾  reason: contains not printable characters */
    public final SeekBar f6948;

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f6949 = false;

    public C2042(SeekBar seekBar) {
        super(seekBar);
        this.f6948 = seekBar;
    }

    @Override // ῲ.ῲ.㴹.C2024
    /* renamed from: K  reason: contains not printable characters */
    public void m5308(AttributeSet attributeSet, int i) {
        super.m5247(attributeSet, i);
        C2019 r0 = C2019.m5223(this.f6948.getContext(), attributeSet, R$styleable.AppCompatSeekBar, i, 0);
        SeekBar seekBar = this.f6948;
        C1729.m4475(seekBar, seekBar.getContext(), R$styleable.AppCompatSeekBar, attributeSet, r0.f6846, i, 0);
        Drawable r9 = r0.m5225(R$styleable.AppCompatSeekBar_android_thumb);
        if (r9 != null) {
            this.f6948.setThumb(r9);
        }
        Drawable r92 = r0.m5229(R$styleable.AppCompatSeekBar_tickMark);
        Drawable drawable = this.f6944;
        if (drawable != null) {
            drawable.setCallback(null);
        }
        this.f6944 = r92;
        if (r92 != null) {
            r92.setCallback(this.f6948);
            C2369.m6340(r92, C1729.m4511(this.f6948));
            if (r92.isStateful()) {
                r92.setState(this.f6948.getDrawableState());
            }
            m5306();
        }
        this.f6948.invalidate();
        if (r0.m5237(R$styleable.AppCompatSeekBar_tickMarkTintMode)) {
            this.f6946 = C2021.m5242(r0.m5238(R$styleable.AppCompatSeekBar_tickMarkTintMode, -1), this.f6946);
            this.f6945 = true;
        }
        if (r0.m5237(R$styleable.AppCompatSeekBar_tickMarkTint)) {
            this.f6947 = r0.m5233(R$styleable.AppCompatSeekBar_tickMarkTint);
            this.f6949 = true;
        }
        r0.f6846.recycle();
        m5306();
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5306() {
        if (this.f6944 == null) {
            return;
        }
        if (this.f6949 || this.f6945) {
            this.f6944 = C2369.m6273(this.f6944.mutate());
            if (this.f6949) {
                Drawable drawable = this.f6944;
                ColorStateList colorStateList = this.f6947;
                int i = Build.VERSION.SDK_INT;
                drawable.setTintList(colorStateList);
            }
            if (this.f6945) {
                Drawable drawable2 = this.f6944;
                PorterDuff.Mode mode = this.f6946;
                int i2 = Build.VERSION.SDK_INT;
                drawable2.setTintMode(mode);
            }
            if (this.f6944.isStateful()) {
                this.f6944.setState(this.f6948.getDrawableState());
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5307(Canvas canvas) {
        if (this.f6944 != null) {
            int max = this.f6948.getMax();
            int i = 1;
            if (max > 1) {
                int intrinsicWidth = this.f6944.getIntrinsicWidth();
                int intrinsicHeight = this.f6944.getIntrinsicHeight();
                int i2 = intrinsicWidth >= 0 ? intrinsicWidth / 2 : 1;
                if (intrinsicHeight >= 0) {
                    i = intrinsicHeight / 2;
                }
                this.f6944.setBounds(-i2, -i, i2, i);
                float width = ((float) ((this.f6948.getWidth() - this.f6948.getPaddingLeft()) - this.f6948.getPaddingRight())) / ((float) max);
                int save = canvas.save();
                canvas.translate((float) this.f6948.getPaddingLeft(), (float) (this.f6948.getHeight() / 2));
                for (int i3 = 0; i3 <= max; i3++) {
                    this.f6944.draw(canvas);
                    canvas.translate(width, 0.0f);
                }
                canvas.restoreToCount(save);
            }
        }
    }
}
