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 = {"\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\u0007\n\u0002\u0010\u0002\n\u0002\b\n\u0018\u00002\u00020\u0001B\u0013\b\u0016\u0012\b\u0010\u0003\u001a\u0004\u0018\u00010\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\b\u0010\u0003\u001a\u0004\u0018\u00010\u0002\u0012\b\u0010\u0007\u001a\u0004\u0018\u00010\u0006\u0012\u0006\u0010\n\u001a\u00020\t¢\u0006\u0004\b\u0004\u0010\u000bJ\u0015\u0010\r\u001a\u00020\t2\u0006\u0010\f\u001a\u00020\t¢\u0006\u0004\b\r\u0010\u000eJ\u001f\u0010\u0012\u001a\u00020\u00112\u0006\u0010\u000f\u001a\u00020\t2\u0006\u0010\u0010\u001a\u00020\tH\u0014¢\u0006\u0004\b\u0012\u0010\u0013J\u0015\u0010\u0015\u001a\u00020\u00112\u0006\u0010\u0014\u001a\u00020\t¢\u0006\u0004\b\u0015\u0010\u0016J\u0015\u0010\u0018\u001a\u00020\u00112\u0006\u0010\u0017\u001a\u00020\t¢\u0006\u0004\b\u0018\u0010\u0016R\u0016\u0010\u0014\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\r\u0010\u0019R\u0016\u0010\u0017\u001a\u00020\t8\u0002@\u0002X\u0082\u000e¢\u0006\u0006\n\u0004\b\u001a\u0010\u0019¨\u0006\u001b"}, d2 = {"Lcom/vinfast/companion/core/base/ui/widget/MaxHeightLinearLayout;", "Landroid/widget/LinearLayout;", "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", "dp", "a", "(I)I", "widthMeasureSpec", "heightMeasureSpec", "", "onMeasure", "(II)V", "maxHeightDp", "setMaxHeightDp", "(I)V", "maxHeightPx", "setMaxHeightPx", "I", "b", "core_release"}, k = 1, mv = {2, 2, 0}, xi = 48)
public final class MaxHeightLinearLayout extends android.widget.LinearLayout {

    /* JADX INFO: renamed from: a, reason: from kotlin metadata */
    private int maxHeightDp;

    /* JADX INFO: renamed from: b, reason: from kotlin metadata */
    private int maxHeightPx;

    public MaxHeightLinearLayout(@org.jetbrains.annotations.Nullable android.content.Context context) {
        super(context);
    }

    public final int a(int dp) {
        android.content.res.Resources resources;
        android.content.Context context = getContext();
        android.util.DisplayMetrics displayMetrics = (context == null || (resources = context.getResources()) == null) ? null : resources.getDisplayMetrics();
        if (displayMetrics != null) {
            return kotlin.math.MathKt.d(dp * (displayMetrics.xdpi / 160));
        }
        return 0;
    }

    @Override // android.widget.LinearLayout, android.view.View
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int i = this.maxHeightDp;
        super.onMeasure(widthMeasureSpec, android.view.View.MeasureSpec.makeMeasureSpec(i > 0 ? a(i) : this.maxHeightPx, Integer.MIN_VALUE));
    }

    public final void setMaxHeightDp(int maxHeightDp) {
        this.maxHeightDp = maxHeightDp;
        invalidate();
    }

    public final void setMaxHeightPx(int maxHeightPx) {
        this.maxHeightPx = maxHeightPx;
        invalidate();
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public MaxHeightLinearLayout(@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");
        android.content.res.TypedArray typedArrayObtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, com.vinfast.companion.core.R.styleable.MaxHeightLayout, 0, 0);
        kotlin.jvm.internal.Intrinsics.k(typedArrayObtainStyledAttributes, "obtainStyledAttributes(...)");
        try {
            this.maxHeightDp = typedArrayObtainStyledAttributes.getInteger(com.vinfast.companion.core.R.styleable.MaxHeightLayout_maxHeightDp, 0);
            this.maxHeightPx = typedArrayObtainStyledAttributes.getInteger(com.vinfast.companion.core.R.styleable.MaxHeightLayout_maxHeightPx, 0);
        } finally {
            typedArrayObtainStyledAttributes.recycle();
        }
    }

    public MaxHeightLinearLayout(@org.jetbrains.annotations.Nullable android.content.Context context, @org.jetbrains.annotations.Nullable android.util.AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
    }
}
