package com.vinfast.companion.main.ui.climate.seatventilation;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes3.dex */
@kotlin.Metadata(d1 = {"\u00004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u000f\u0018\u00002\u00020\u0001B'\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002\u0012\n\b\u0002\u0010\u0005\u001a\u0004\u0018\u00010\u0004\u0012\b\b\u0002\u0010\u0007\u001a\u00020\u0006¢\u0006\u0004\b\b\u0010\tJ\u000f\u0010\u000b\u001a\u00020\nH\u0002¢\u0006\u0004\b\u000b\u0010\fJ)\u0010\u0010\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\u00062\b\b\u0001\u0010\u000e\u001a\u00020\u00062\u0006\u0010\u000f\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u0015\u0010\u0014\u001a\u00020\n2\u0006\u0010\u0013\u001a\u00020\u0012¢\u0006\u0004\b\u0014\u0010\u0015R\u0014\u0010\u0018\u001a\u00020\u00168\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0010\u0010\u0017R*\u0010\u0013\u001a\u00020\u00122\u0006\u0010\u0019\u001a\u00020\u00128\u0006@GX\u0086\u000e¢\u0006\u0012\n\u0004\b\u000b\u0010\u001a\u001a\u0004\b\u001b\u0010\u001c\"\u0004\b\u001d\u0010\u0015R\u0016\u0010 \u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u001e\u0010\u001fR\u0016\u0010\"\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b!\u0010\u001fR\u0016\u0010$\u001a\u00020\u00068\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b#\u0010\u001f¨\u0006%"}, d2 = {"Lcom/vinfast/companion/main/ui/climate/seatventilation/SeatVentilationSmallView;", "Landroid/widget/LinearLayout;", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", okhttp3.HttpUrl.FRAGMENT_ENCODE_SET, "b", "()V", "level", "barBackgroundRes", "barColor", "a", "(III)V", "Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "state", "setState", "(Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;)V", "Lcom/vinfast/remotecontrols/databinding/ViewSeatVentilationSmallBinding;", "Lcom/vinfast/remotecontrols/databinding/ViewSeatVentilationSmallBinding;", "binding", "value", "Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "getState", "()Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "setCurrentState", "c", "I", "offColor", "d", "coolColor", "e", "heatColor", "remoteControls_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class SeatVentilationSmallView extends android.widget.LinearLayout {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final com.vinfast.remotecontrols.databinding.ViewSeatVentilationSmallBinding binding;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState state;

    /* JADX INFO: renamed from: c, reason: from kotlin metadata */
    private int offColor;

    /* JADX INFO: renamed from: d, reason: from kotlin metadata */
    private int coolColor;

    /* JADX INFO: renamed from: e, reason: from kotlin metadata */
    private int heatColor;

    /* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
    @kotlin.Metadata(k = 3, mv = {2, 2, 0}, xi = 48)
    public static final /* synthetic */ class WhenMappings {
        public static final /* synthetic */ int[] a;

        static {
            int[] iArr = new int[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.values().length];
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_OFF.ordinal()] = 1;
            } catch (java.lang.NoSuchFieldError unused) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.COOL_OFF.ordinal()] = 2;
            } catch (java.lang.NoSuchFieldError unused2) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_LEVEL_1.ordinal()] = 3;
            } catch (java.lang.NoSuchFieldError unused3) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_LEVEL_2.ordinal()] = 4;
            } catch (java.lang.NoSuchFieldError unused4) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_LEVEL_3.ordinal()] = 5;
            } catch (java.lang.NoSuchFieldError unused5) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.COOL_LEVEL_1.ordinal()] = 6;
            } catch (java.lang.NoSuchFieldError unused6) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.COOL_LEVEL_2.ordinal()] = 7;
            } catch (java.lang.NoSuchFieldError unused7) {
            }
            try {
                iArr[com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.COOL_LEVEL_3.ordinal()] = 8;
            } catch (java.lang.NoSuchFieldError unused8) {
            }
            a = iArr;
        }
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    @kotlin.jvm.JvmOverloads
    public SeatVentilationSmallView(@org.jetbrains.annotations.NotNull android.content.Context context) {
        this(context, null, 0, 6, null);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
    }

    private final void a(int level, int barBackgroundRes, int barColor) {
        android.view.View view = this.binding.d;
        view.setVisibility(level >= 1 ? 0 : 4);
        view.setBackgroundResource(barBackgroundRes);
        view.setBackgroundTintList(android.content.res.ColorStateList.valueOf(barColor));
        android.view.View view2 = this.binding.e;
        view2.setVisibility(level >= 2 ? 0 : 4);
        view2.setBackgroundResource(barBackgroundRes);
        view2.setBackgroundTintList(android.content.res.ColorStateList.valueOf(barColor));
        android.view.View view3 = this.binding.f;
        view3.setVisibility(level >= 3 ? 0 : 4);
        view3.setBackgroundResource(barBackgroundRes);
        view3.setBackgroundTintList(android.content.res.ColorStateList.valueOf(barColor));
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    private final void b() throws kotlin.NoWhenBranchMatchedException {
        switch (com.vinfast.companion.main.ui.climate.seatventilation.SeatVentilationSmallView.WhenMappings.a[this.state.ordinal()]) {
            case 1:
            case 2:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_small_off);
                androidx.core.widget.ImageViewCompat.c(this.binding.b, android.content.res.ColorStateList.valueOf(this.offColor));
                this.binding.c.setVisibility(4);
                return;
            case 3:
            case 4:
            case 5:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_small_heat);
                androidx.core.widget.ImageViewCompat.c(this.binding.b, android.content.res.ColorStateList.valueOf(this.heatColor));
                this.binding.c.setVisibility(0);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_small_level_heat, this.heatColor);
                return;
            case 6:
            case 7:
            case 8:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_small_cool);
                androidx.core.widget.ImageViewCompat.c(this.binding.b, android.content.res.ColorStateList.valueOf(this.coolColor));
                this.binding.c.setVisibility(0);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_small_level_cool, this.coolColor);
                return;
            default:
                throw new kotlin.NoWhenBranchMatchedException();
        }
    }

    @org.jetbrains.annotations.NotNull
    public final com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState getState() {
        return this.state;
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    @kotlin.jvm.JvmName
    public final void setCurrentState(@org.jetbrains.annotations.NotNull com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState seatState) throws kotlin.NoWhenBranchMatchedException {
        kotlin.jvm.internal.Intrinsics.l(seatState, "value");
        this.state = seatState;
        b();
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    public final void setState(@org.jetbrains.annotations.NotNull com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState state) throws kotlin.NoWhenBranchMatchedException {
        kotlin.jvm.internal.Intrinsics.l(state, "state");
        setCurrentState(state);
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    @kotlin.jvm.JvmOverloads
    public SeatVentilationSmallView(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet) {
        this(context, attributeSet, 0, 4, null);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    @kotlin.jvm.JvmOverloads
    public SeatVentilationSmallView(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet, int i) throws kotlin.NoWhenBranchMatchedException {
        super(context, attributeSet, i);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        com.vinfast.remotecontrols.databinding.ViewSeatVentilationSmallBinding viewSeatVentilationSmallBindingC = com.vinfast.remotecontrols.databinding.ViewSeatVentilationSmallBinding.c(android.view.LayoutInflater.from(context), this, true);
        kotlin.jvm.internal.Intrinsics.k(viewSeatVentilationSmallBindingC, "inflate(...)");
        this.binding = viewSeatVentilationSmallBindingC;
        com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState seatState = com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_OFF;
        this.state = seatState;
        this.offColor = androidx.core.content.ContextCompat.getColor(context, com.vinfast.remotecontrols.R.color.white_op_60);
        this.coolColor = androidx.core.content.ContextCompat.getColor(context, com.vinfast.remotecontrols.R.color.seat_ventilation_cool);
        this.heatColor = androidx.core.content.ContextCompat.getColor(context, com.vinfast.remotecontrols.R.color.seat_ventilation_heat);
        setOrientation(1);
        setGravity(8388627);
        if (attributeSet != null) {
            int[] iArr = com.vinfast.remotecontrols.R.styleable.SeatVentilationSmallView;
            kotlin.jvm.internal.Intrinsics.k(iArr, "SeatVentilationSmallView");
            android.content.res.TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, 0);
            this.offColor = typedArrayObtainStyledAttributes.getColor(com.vinfast.remotecontrols.R.styleable.SeatVentilationSmallView_seatVentilationOffColor, this.offColor);
            this.coolColor = typedArrayObtainStyledAttributes.getColor(com.vinfast.remotecontrols.R.styleable.SeatVentilationSmallView_seatVentilationCoolColor, this.coolColor);
            this.heatColor = typedArrayObtainStyledAttributes.getColor(com.vinfast.remotecontrols.R.styleable.SeatVentilationSmallView_seatVentilationHeatColor, this.heatColor);
            int i2 = typedArrayObtainStyledAttributes.getInt(com.vinfast.remotecontrols.R.styleable.SeatVentilationSmallView_seatVentilationState, seatState.ordinal());
            com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState[] seatStateArr = (com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState[]) com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.getEntries().toArray(new com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState[0]);
            if (i2 >= 0 && i2 < seatStateArr.length) {
                seatState = seatStateArr[i2];
            }
            setCurrentState(seatState);
            typedArrayObtainStyledAttributes.recycle();
            return;
        }
        b();
    }

    public /* synthetic */ SeatVentilationSmallView(android.content.Context context, android.util.AttributeSet attributeSet, int i, int i2, kotlin.jvm.internal.DefaultConstructorMarker defaultConstructorMarker) {
        this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
    }
}
