package com.vinfast.companion.main.ui.widget;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u0000@\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0010\u000b\n\u0002\b\n\u0018\u00002\u00020\u0001B\u0011\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005B\u001b\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006¢\u0006\u0004\b\u0004\u0010\bB#\b\u0016\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006\u0012\u0006\u0010\n\u001a\u00020\t¢\u0006\u0004\b\u0004\u0010\u000bJ\u000f\u0010\r\u001a\u00020\fH\u0002¢\u0006\u0004\b\r\u0010\u000eJ\u000f\u0010\u0010\u001a\u00020\u000fH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u0017\u0010\u0014\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u0012H\u0002¢\u0006\u0004\b\u0014\u0010\u0015J\u0017\u0010\u0016\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u0012H\u0002¢\u0006\u0004\b\u0016\u0010\u0015J\u0017\u0010\u0017\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u0012H\u0002¢\u0006\u0004\b\u0017\u0010\u0015J\u0017\u0010\u0018\u001a\u00020\f2\u0006\u0010\u0013\u001a\u00020\u0012H\u0014¢\u0006\u0004\b\u0018\u0010\u0015J\u0017\u0010\u0019\u001a\u00020\f2\b\b\u0001\u0010\r\u001a\u00020\t¢\u0006\u0004\b\u0019\u0010\u001aJ\u0017\u0010\u001b\u001a\u00020\f2\b\b\u0001\u0010\r\u001a\u00020\t¢\u0006\u0004\b\u001b\u0010\u001aJ\u0019\u0010\u001c\u001a\u00020\f2\n\b\u0001\u0010\r\u001a\u0004\u0018\u00010\t¢\u0006\u0004\b\u001c\u0010\u001dJ\r\u0010\u001e\u001a\u00020\u000f¢\u0006\u0004\b\u001e\u0010\u0011R\u0016\u0010!\u001a\u00020\u001f8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0016\u0010 R\u0016\u0010#\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0017\u0010\"R\u0016\u0010$\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\r\u0010\"R\u0016\u0010&\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b%\u0010\"R\u0016\u0010(\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b'\u0010\"¨\u0006)"}, d2 = {"Lcom/vinfast/companion/main/ui/widget/ClimateSeekBar;", "Landroidx/appcompat/widget/AppCompatSeekBar;", "Landroid/content/Context;", "context", "<init>", "(Landroid/content/Context;)V", "Landroid/util/AttributeSet;", "attrs", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "defStyleAttr", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "d", "()V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "getCenterPointX", "()F", "Landroid/graphics/Canvas;", "canvas", "a", "(Landroid/graphics/Canvas;)V", "b", "c", "onDraw", "setBackgroundProgressActive", "(I)V", "setBackgroundProgressDefault", "setTickMark", "(Ljava/lang/Integer;)V", "getThumbCenterX", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "Z", "isShowTickMark", "I", "tickMarkDrawable", "backgroundProgressActive", "e", "backgroundProgressDefault", "f", "dimen10", "remoteControls_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class ClimateSeekBar extends androidx.appcompat.widget.AppCompatSeekBar {

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private boolean isShowTickMark;

    /* JADX INFO: renamed from: c, reason: from kotlin metadata */
    private int tickMarkDrawable;

    /* JADX INFO: renamed from: d, reason: from kotlin metadata */
    private int backgroundProgressActive;

    /* JADX INFO: renamed from: e, reason: from kotlin metadata */
    private int backgroundProgressDefault;

    /* JADX INFO: renamed from: f, reason: from kotlin metadata */
    private int dimen10;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ClimateSeekBar(@org.jetbrains.annotations.NotNull android.content.Context context) {
        super(context);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        this.isShowTickMark = true;
        this.tickMarkDrawable = com.vinfast.remotecontrols.R.drawable.seekbar_tick_mark;
        this.backgroundProgressActive = com.vinfast.remotecontrols.R.drawable.bg_gradient_seekbar;
        this.backgroundProgressDefault = com.vinfast.remotecontrols.R.drawable.bg_seekbar_not_available;
        this.dimen10 = kotlin.math.MathKt.d(com.vinfast.companion.core.utils.DimensionUtils.a.a(10.0f));
        d();
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void a(android.graphics.Canvas canvas) {
        int paddingLeft = getPaddingLeft() - getThumbOffset();
        int centerPointX = (int) getCenterPointX();
        float height = getHeight() / 2.0f;
        int i = this.dimen10;
        float f = height - (i / 2);
        float f2 = i + f;
        androidx.vectordrawable.graphics.drawable.VectorDrawableCompat vectorDrawableCompatB = androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.b(getContext().getResources(), this.backgroundProgressActive, (android.content.res.Resources.Theme) null);
        if (vectorDrawableCompatB != null) {
            vectorDrawableCompatB.setBounds(paddingLeft, (int) f, centerPointX, (int) f2);
        }
        if (vectorDrawableCompatB != null) {
            vectorDrawableCompatB.draw(canvas);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void b(android.graphics.Canvas canvas) {
        if (getProgress() == getMax()) {
            return;
        }
        int centerPointX = (int) getCenterPointX();
        int width = getWidth() - (getPaddingRight() - getThumbOffset());
        float height = getHeight() / 2.0f;
        int i = this.dimen10;
        float f = height - (i / 2);
        float f2 = i + f;
        androidx.vectordrawable.graphics.drawable.VectorDrawableCompat vectorDrawableCompatB = androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.b(getContext().getResources(), this.backgroundProgressDefault, (android.content.res.Resources.Theme) null);
        if (vectorDrawableCompatB != null) {
            vectorDrawableCompatB.setBounds(centerPointX, (int) f, width, (int) f2);
        }
        if (vectorDrawableCompatB != null) {
            vectorDrawableCompatB.draw(canvas);
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void c(android.graphics.Canvas canvas) {
        androidx.vectordrawable.graphics.drawable.VectorDrawableCompat vectorDrawableCompatB;
        if (!this.isShowTickMark || (vectorDrawableCompatB = androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.b(getContext().getResources(), this.tickMarkDrawable, (android.content.res.Resources.Theme) null)) == null) {
            return;
        }
        int paddingLeft = getPaddingLeft() - getThumbOffset();
        int width = (getWidth() - paddingLeft) - (getPaddingRight() - getThumbOffset());
        float height = (getHeight() / 2.0f) - (vectorDrawableCompatB.getIntrinsicHeight() / 2);
        float intrinsicHeight = vectorDrawableCompatB.getIntrinsicHeight() + height;
        int max = getMax();
        if (max < 0) {
            return;
        }
        int i = 0;
        while (true) {
            float max2 = i / getMax();
            float fWidth = (max2 * width) + paddingLeft + (getThumb().getBounds().width() * (0.5f - max2));
            float intrinsicWidth = vectorDrawableCompatB.getIntrinsicWidth() / 2;
            vectorDrawableCompatB.setBounds((int) (fWidth - intrinsicWidth), (int) height, (int) (fWidth + intrinsicWidth), (int) intrinsicHeight);
            vectorDrawableCompatB.draw(canvas);
            if (i == max) {
                return;
            } else {
                i++;
            }
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void d() {
        setProgressDrawable(androidx.appcompat.content.res.AppCompatResources.b(getContext(), com.vinfast.remotecontrols.R.drawable.progress_drawable_seekbar_transparent));
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final float getCenterPointX() {
        int paddingLeft = getPaddingLeft() - getThumbOffset();
        int width = (getWidth() - paddingLeft) - (getPaddingRight() - getThumbOffset());
        float progress = getProgress() / getMax();
        return (progress * width) + paddingLeft + (getThumb().getBounds().width() * (0.5f - progress));
    }

    public final float getThumbCenterX() {
        return getCenterPointX();
    }

    protected void onDraw(android.graphics.Canvas canvas) {
        kotlin.jvm.internal.Intrinsics.l(canvas, "canvas");
        a(canvas);
        b(canvas);
        c(canvas);
        super.onDraw(canvas);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void setBackgroundProgressActive(@androidx.annotation.DrawableRes int d) {
        this.backgroundProgressActive = d;
        postInvalidate();
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void setBackgroundProgressDefault(@androidx.annotation.DrawableRes int d) {
        this.backgroundProgressDefault = d;
        postInvalidate();
    }

    /* JADX WARN: Multi-variable type inference failed */
    public final void setTickMark(@androidx.annotation.DrawableRes @org.jetbrains.annotations.Nullable java.lang.Integer d) {
        if (d == null) {
            this.isShowTickMark = false;
        } else {
            this.isShowTickMark = true;
            this.tickMarkDrawable = d.intValue();
        }
        postInvalidate();
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ClimateSeekBar(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet) {
        super(context, attributeSet);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        this.isShowTickMark = true;
        this.tickMarkDrawable = com.vinfast.remotecontrols.R.drawable.seekbar_tick_mark;
        this.backgroundProgressActive = com.vinfast.remotecontrols.R.drawable.bg_gradient_seekbar;
        this.backgroundProgressDefault = com.vinfast.remotecontrols.R.drawable.bg_seekbar_not_available;
        this.dimen10 = kotlin.math.MathKt.d(com.vinfast.companion.core.utils.DimensionUtils.a.a(10.0f));
        d();
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ClimateSeekBar(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        this.isShowTickMark = true;
        this.tickMarkDrawable = com.vinfast.remotecontrols.R.drawable.seekbar_tick_mark;
        this.backgroundProgressActive = com.vinfast.remotecontrols.R.drawable.bg_gradient_seekbar;
        this.backgroundProgressDefault = com.vinfast.remotecontrols.R.drawable.bg_seekbar_not_available;
        this.dimen10 = kotlin.math.MathKt.d(com.vinfast.companion.core.utils.DimensionUtils.a.a(10.0f));
        d();
    }
}
