package com.vinfast.companion.core.base.ui.widget;

/* JADX INFO: compiled from: r8-map-id-ae6aab8d9a1033945587ffdd1bc6222159522c1d66e66a2c4cecb065134dd0a6 */
/* JADX INFO: loaded from: E:\ios\vf_dex\classes15.dex */
@kotlin.Metadata(d1 = {"\u00000\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\u0004\n\u0002\u0010\u0002\n\u0002\b\t\n\u0002\u0018\u0002\n\u0002\b\u0006\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\u000bB+\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\u0012\u0006\u0010\f\u001a\u00020\t¢\u0006\u0004\b\u0004\u0010\rJ1\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0003\u001a\u00020\u00022\b\u0010\u0007\u001a\u0004\u0018\u00010\u00062\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\tH\u0002¢\u0006\u0004\b\u000f\u0010\rJ\u000f\u0010\u0010\u001a\u00020\u000eH\u0002¢\u0006\u0004\b\u0010\u0010\u0011J\u000f\u0010\u0012\u001a\u00020\u000eH\u0002¢\u0006\u0004\b\u0012\u0010\u0011R\u0016\u0010\u0015\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0013\u0010\u0014R\u0016\u0010\u0017\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0016\u0010\u0014R\u0018\u0010\u001a\u001a\u0004\u0018\u00010\u00188\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0012\u0010\u0019R\u0018\u0010\u001c\u001a\u0004\u0018\u00010\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u0010\u0010\u001bR\u0016\u0010\u001d\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u000f\u0010\u0014¨\u0006\u001e"}, d2 = {"Lcom/vinfast/companion/core/base/ui/widget/ShimmerView;", "Lcom/facebook/shimmer/ShimmerFrameLayout;", "Landroid/content/Context;", "context", "<init>", "(Landroid/content/Context;)V", "Landroid/util/AttributeSet;", "attrs", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "", "defStyleAttr", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "defStyleRes", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "", "h", "g", "()V", "f", "d", "I", "itemLayout", "e", "itemCount", "Landroid/graphics/drawable/Drawable;", "Landroid/graphics/drawable/Drawable;", "itemDividerDrawable", "Ljava/lang/Integer;", "itemDividerColor", "itemDividerHeight", "core_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class ShimmerView extends com.facebook.shimmer.ShimmerFrameLayout {

    /* JADX INFO: renamed from: d, reason: from kotlin metadata */
    private int itemLayout;

    /* JADX INFO: renamed from: e, reason: from kotlin metadata */
    private int itemCount;

    /* JADX INFO: renamed from: f, reason: from kotlin metadata */
    private android.graphics.drawable.Drawable itemDividerDrawable;

    /* JADX INFO: renamed from: g, reason: from kotlin metadata */
    private java.lang.Integer itemDividerColor;

    /* JADX INFO: renamed from: h, reason: from kotlin metadata */
    private int itemDividerHeight;

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public ShimmerView(@org.jetbrains.annotations.NotNull android.content.Context context) {
        this(context, null);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
    }

    /* JADX WARN: Multi-variable type inference failed */
    private final void f() {
        if (this.itemLayout == 0 || this.itemCount == 0) {
            return;
        }
        android.view.LayoutInflater layoutInflaterFrom = android.view.LayoutInflater.from(getContext());
        android.widget.LinearLayout linearLayout = new android.widget.LinearLayout(getContext());
        linearLayout.setOrientation(1);
        android.widget.LinearLayout.LayoutParams layoutParams = new android.widget.LinearLayout.LayoutParams(-1, this.itemDividerHeight);
        int i = this.itemCount;
        for (int i2 = 0; i2 < i; i2++) {
            linearLayout.addView(layoutInflaterFrom.inflate(this.itemLayout, (android.view.ViewGroup) this, false));
            if (i2 < this.itemCount - 1) {
                android.graphics.drawable.Drawable drawable = this.itemDividerDrawable;
                if (drawable != null && this.itemDividerHeight > 0) {
                    android.view.View view = new android.view.View(getContext());
                    view.setBackground(this.itemDividerDrawable);
                    linearLayout.addView(view, layoutParams);
                } else if (this.itemDividerColor != null && this.itemDividerHeight > 0) {
                    android.view.View view2 = new android.view.View(getContext());
                    java.lang.Integer num = this.itemDividerColor;
                    kotlin.jvm.internal.Intrinsics.i(num);
                    view2.setBackgroundColor(num.intValue());
                    linearLayout.addView(view2, layoutParams);
                } else if (drawable == null && this.itemDividerHeight > 0) {
                    linearLayout.addView(new android.widget.Space(getContext()), layoutParams);
                }
            }
        }
        addView(linearLayout);
    }

    private final void g() {
        f();
    }

    private final void h(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes) {
        android.content.res.TypedArray typedArrayObtainStyledAttributes = context.obtainStyledAttributes(attrs, com.vinfast.companion.core.R.styleable.ShimmerView, defStyleAttr, defStyleRes);
        kotlin.jvm.internal.Intrinsics.k(typedArrayObtainStyledAttributes, "obtainStyledAttributes(...)");
        this.itemLayout = typedArrayObtainStyledAttributes.getResourceId(com.vinfast.companion.core.R.styleable.ShimmerView_SV_itemLayout, this.itemLayout);
        int integer = typedArrayObtainStyledAttributes.getInteger(com.vinfast.companion.core.R.styleable.ShimmerView_SV_itemCount, this.itemCount);
        this.itemCount = integer;
        this.itemDividerColor = java.lang.Integer.valueOf(typedArrayObtainStyledAttributes.getColor(com.vinfast.companion.core.R.styleable.ShimmerView_SV_itemDividerColor, integer));
        this.itemDividerDrawable = typedArrayObtainStyledAttributes.getDrawable(com.vinfast.companion.core.R.styleable.ShimmerView_SV_itemDividerDrawable);
        this.itemDividerHeight = typedArrayObtainStyledAttributes.getDimensionPixelSize(com.vinfast.companion.core.R.styleable.ShimmerView_SV_itemDividerHeight, this.itemDividerHeight);
        typedArrayObtainStyledAttributes.recycle();
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public ShimmerView(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet) {
        this(context, attributeSet, 0);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
    }

    /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */
    public ShimmerView(@org.jetbrains.annotations.NotNull android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet, int i) {
        this(context, attributeSet, i, 0);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ShimmerView(android.content.Context context, android.util.AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
        kotlin.jvm.internal.Intrinsics.l(context, "context");
        h(context, attributeSet, i, i2);
        g();
    }
}
