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\t\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\b\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\u0019\u0010\u000e\u001a\u00020\n2\b\b\u0001\u0010\r\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\u000e\u0010\u000fJ!\u0010\u0012\u001a\u00020\n2\u0006\u0010\u0010\u001a\u00020\u00062\b\b\u0001\u0010\u0011\u001a\u00020\u0006H\u0002¢\u0006\u0004\b\u0012\u0010\u0013J\u0015\u0010\u0016\u001a\u00020\n2\u0006\u0010\u0015\u001a\u00020\u0014¢\u0006\u0004\b\u0016\u0010\u0017R\u0014\u0010\u001a\u001a\u00020\u00188\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0012\u0010\u0019R*\u0010\u0015\u001a\u00020\u00142\u0006\u0010\u001b\u001a\u00020\u00148\u0006@GX\u0086\u000e¢\u0006\u0012\n\u0004\b\u000e\u0010\u001c\u001a\u0004\b\u001d\u0010\u001e\"\u0004\b\u001f\u0010\u0017¨\u0006 "}, d2 = {"Lcom/vinfast/companion/main/ui/climate/seatventilation/SeatVentilationBigView;", "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, "c", "()V", "colorRes", "b", "(I)V", "level", "activeBarBackgroundRes", "a", "(II)V", "Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "state", "setState", "(Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;)V", "Lcom/vinfast/remotecontrols/databinding/ViewSeatVentilationBigBinding;", "Lcom/vinfast/remotecontrols/databinding/ViewSeatVentilationBigBinding;", "binding", "value", "Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "getState", "()Lcom/vinfast/companion/remotecontrolskit/persitent/model/seatventilation/SeatState;", "setCurrentState", "remoteControls_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
@kotlin.jvm.internal.SourceDebugExtension
public final class SeatVentilationBigView extends android.widget.LinearLayout {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private final com.vinfast.remotecontrols.databinding.ViewSeatVentilationBigBinding binding;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState state;

    /* 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 SeatVentilationBigView(@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 activeBarBackgroundRes) {
        int i = com.vinfast.remotecontrols.R.drawable.bg_white_op_20_radius_14;
        this.binding.e.setBackgroundResource(level >= 1 ? activeBarBackgroundRes : i);
        this.binding.f.setBackgroundResource(level >= 2 ? activeBarBackgroundRes : i);
        android.view.View view = this.binding.g;
        if (level < 3) {
            activeBarBackgroundRes = i;
        }
        view.setBackgroundResource(activeBarBackgroundRes);
    }

    private final void b(int colorRes) {
        int color = androidx.core.content.ContextCompat.getColor(getContext(), colorRes);
        android.graphics.drawable.Drawable background = this.binding.d.getBackground();
        if (background instanceof android.graphics.drawable.RippleDrawable) {
            background = ((android.graphics.drawable.RippleDrawable) background).findDrawableByLayerId(android.R.id.background);
        }
        android.graphics.drawable.GradientDrawable gradientDrawable = background instanceof android.graphics.drawable.GradientDrawable ? (android.graphics.drawable.GradientDrawable) background : null;
        if (gradientDrawable != null) {
            gradientDrawable.setStroke(getResources().getDimensionPixelSize(com.vinfast.remotecontrols.R.dimen.dimen1dp), color);
        }
    }

    /* JADX INFO: Thrown type has an unknown type hierarchy: kotlin.NoWhenBranchMatchedException */
    private final void c() throws kotlin.NoWhenBranchMatchedException {
        switch (com.vinfast.companion.main.ui.climate.seatventilation.SeatVentilationBigView.WhenMappings.a[this.state.ordinal()]) {
            case 1:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_big_heat_off);
                b(com.vinfast.remotecontrols.R.color.white_op_20);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_big_level_heat);
                return;
            case 2:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_big_cool_off);
                b(com.vinfast.remotecontrols.R.color.white_op_20);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_big_level_cool);
                return;
            case 3:
            case 4:
            case 5:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_big_heat_on);
                b(com.vinfast.remotecontrols.R.color.seat_ventilation_heat_50);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_big_level_heat);
                return;
            case 6:
            case 7:
            case 8:
                this.binding.b.setImageResource(com.vinfast.remotecontrols.R.drawable.ic_seat_ventilation_big_cool_on);
                b(com.vinfast.remotecontrols.R.color.seat_ventilation_cool);
                a(this.state.toSeatLevel(), com.vinfast.remotecontrols.R.drawable.bg_seat_ventilation_big_level_cool);
                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;
        c();
    }

    /* 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 SeatVentilationBigView(@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 SeatVentilationBigView(@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.ViewSeatVentilationBigBinding viewSeatVentilationBigBindingC = com.vinfast.remotecontrols.databinding.ViewSeatVentilationBigBinding.c(android.view.LayoutInflater.from(context), this, true);
        kotlin.jvm.internal.Intrinsics.k(viewSeatVentilationBigBindingC, "inflate(...)");
        this.binding = viewSeatVentilationBigBindingC;
        com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState seatState = com.vinfast.companion.remotecontrolskit.persitent.model.seatventilation.SeatState.HEAT_OFF;
        this.state = seatState;
        setOrientation(1);
        setGravity(17);
        if (attributeSet != null) {
            int[] iArr = com.vinfast.remotecontrols.R.styleable.SeatVentilationBigView;
            kotlin.jvm.internal.Intrinsics.k(iArr, "SeatVentilationBigView");
            android.content.res.TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, 0);
            int i2 = typedArrayObtainStyledAttributes.getInt(com.vinfast.remotecontrols.R.styleable.SeatVentilationBigView_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();
        }
        c();
    }

    public /* synthetic */ SeatVentilationBigView(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);
    }
}
