小红书.apk(点击下载) / AlphaLiveClassCardViewV2.java


package com.xingin.alpha.goods.view.card;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.net.Uri;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import bj2.l;
import com.xingin.alpha.R$drawable;
import com.xingin.alpha.R$id;
import com.xingin.alpha.R$layout;
import com.xingin.alpha.R$string;
import com.xingin.alpha.bean.GoodsCardTagConfig;
import com.xingin.android.mixim.msg.bean.receive.AlphaImExplainCourseBean;
import com.xingin.ui.textview.XYTextView;
import com.xingin.widgets.XYImageView;
import el.g0;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import ln.d2;
import ms.g;
import sy.i0;
import sy.q1;
import sy.u;
import tm.e;
import y7.f;

@Metadata(bv = {}, d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\u0018\u00002\u00020\u0001B'\b\u0007\u0012\u0006\u0010\u0014\u001a\u00020\u0013\u0012\n\b\u0002\u0010\u0016\u001a\u0004\u0018\u00010\u0015\u0012\b\b\u0002\u0010\u0018\u001a\u00020\u0017¢\u0006\u0004\b\u0019\u0010\u001aJ\u0018\u0010\u0007\u001a\u00020\u00062\u0006\u0010\u0003\u001a\u00020\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004J\b\u0010\b\u001a\u00020\u0006H\u0016J\b\u0010\t\u001a\u00020\u0006H\u0016J\b\u0010\n\u001a\u00020\u0006H\u0016J\b\u0010\u000b\u001a\u00020\u0006H\u0002J\b\u0010\f\u001a\u00020\u0006H\u0002R\u0018\u0010\u000f\u001a\u0004\u0018\u00010\u00028\u0002@\u0002X‚\u000e¢\u0006\u0006\n\u0004\b\r\u0010\u000eR\u0018\u0010\u0012\u001a\u0004\u0018\u00010\u00048\u0002@\u0002X‚\u000e¢\u0006\u0006\n\u0004\b\u0010\u0010\u0011¨\u0006\u001b"}, d2 = {"Lcom/xingin/alpha/goods/view/card/AlphaLiveClassCardViewV2;", "Lcom/xingin/alpha/goods/view/card/AlphaAbsGoodsCard;", "Lcom/xingin/android/mixim/msg/bean/receive/AlphaImExplainCourseBean;", "courseBean", "Landroid/view/View;", "rootView", "", "A0", com.igexin.push.core.d.c.f25536c, "O", "z0", "y0", "B0", "e", "Lcom/xingin/android/mixim/msg/bean/receive/AlphaImExplainCourseBean;", "courseInfo", f.f156778k, "Landroid/view/View;", "rootViewGroup", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "alpha_library_release"}, k = 1, mv = {1, 6, 0})
/* compiled from: AlphaLiveClassCardViewV2.kt */
public final class AlphaLiveClassCardViewV2 extends AlphaAbsGoodsCard {

    /* renamed from: e  reason: collision with root package name */
    public AlphaImExplainCourseBean f43873e;

    /* renamed from: f  reason: collision with root package name */
    public View f43874f;

    /* renamed from: g  reason: collision with root package name */
    public Map<Integer, View> f43875g;

    @Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: AlphaLiveClassCardViewV2.kt */
    public static final class a extends Lambda implements Function0<Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ AlphaLiveClassCardViewV2 f43876a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public a(AlphaLiveClassCardViewV2 alphaLiveClassCardViewV2) {
            super(0);
            this.f43876a = alphaLiveClassCardViewV2;
        }

        @Override // kotlin.jvm.functions.Function0
        public final void invoke() {
            if (!d2.f102239a.Y0()) {
                this.f43876a.y0();
                this.f43876a.B0();
            }
        }
    }

    @Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: AlphaLiveClassCardViewV2.kt */
    public static final class b extends Lambda implements Function0<Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ AlphaLiveClassCardViewV2 f43877a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public b(AlphaLiveClassCardViewV2 alphaLiveClassCardViewV2) {
            super(0);
            this.f43877a = alphaLiveClassCardViewV2;
        }

        @Override // kotlin.jvm.functions.Function0
        public final void invoke() {
            this.f43877a.O();
        }
    }

    @Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "", "invoke"}, k = 3, mv = {1, 6, 0}, xi = 48)
    /* compiled from: AlphaLiveClassCardViewV2.kt */
    public static final class c extends Lambda implements Function0<Unit> {

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ AlphaLiveClassCardViewV2 f43878a;

        /* JADX INFO: super call moved to the top of the method (can break code semantics) */
        public c(AlphaLiveClassCardViewV2 alphaLiveClassCardViewV2) {
            super(0);
            this.f43878a = alphaLiveClassCardViewV2;
        }

        @Override // kotlin.jvm.functions.Function0
        public final void invoke() {
            l.b(this.f43878a);
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    @JvmOverloads
    public AlphaLiveClassCardViewV2(Context context, AttributeSet attributeSet, int i10) {
        super(context, attributeSet, i10);
        String str;
        Intrinsics.checkNotNullParameter(context, "context");
        this.f43875g = new LinkedHashMap();
        ViewGroup.inflate(context, R$layout.f40372alpha_view_live_class_card, this);
        Resources system = Resources.getSystem();
        Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
        setLayoutParams(new ConstraintLayout.LayoutParams((int) TypedValue.applyDimension(1, (float) 108, system.getDisplayMetrics()), -2));
        setBackgroundResource(R$drawable.alpha_bg_rectangle_white_4_corner);
        ((TextView) _$_findCachedViewById(R$id.cqf)).setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/REDNumber-Medium.ttf"));
        XYImageView xYImageView = (XYImageView) _$_findCachedViewById(R$id.ffb);
        GoodsCardTagConfig tagConfig = getTagConfig();
        xYImageView.o((tagConfig == null || (str = tagConfig.getClassTagUrl()) == null) ? "https://picasso-static.xiaohongshu.com/fe-platform/b1e5c5feb6ad25ae16405c5eeafb72bda6f722c4.png" : str, g0.f72750a.t());
        q1.S(this, 0, new a(this), 1, null);
        ImageView imageView = (ImageView) _$_findCachedViewById(R$id.closeBtn);
        Intrinsics.checkNotNullExpressionValue(imageView, "closeBtn");
        q1.S(imageView, 0, new b(this), 1, null);
    }

    public final void A0(AlphaImExplainCourseBean alphaImExplainCourseBean, View view) {
        Intrinsics.checkNotNullParameter(alphaImExplainCourseBean, "courseBean");
        l.q(this);
        d2.f102239a.a2(true);
        AlphaAbsGoodsCard.q0(this, this.f43874f, null, 2, null);
        AlphaAbsGoodsCard.s0(this, null, 1, null);
        this.f43873e = alphaImExplainCourseBean;
        this.f43874f = view;
        if (!(alphaImExplainCourseBean.getImages().length == 0)) {
            Resources system = Resources.getSystem();
            Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
            Resources system2 = Resources.getSystem();
            Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
            g9.c.h((XYImageView) _$_findCachedViewById(R$id.cpc), (String) ArraysKt___ArraysKt.first(alphaImExplainCourseBean.getImages()), (int) TypedValue.applyDimension(1, (float) 100, system.getDisplayMetrics()), (int) TypedValue.applyDimension(1, (float) 75, system2.getDisplayMetrics()), null, g0.f72750a.d(), null, 40, null);
        }
        ((XYTextView) _$_findCachedViewById(R$id.liveTitleView)).setText(alphaImExplainCourseBean.getTitle());
        String f14 = i0.f131674a.f(alphaImExplainCourseBean.getCoins());
        if (alphaImExplainCourseBean.getLessonNum() == 1) {
            ((TextView) _$_findCachedViewById(R$id.cqf)).setText(getContext().getString(R$string.a_4, f14, ""));
            return;
        }
        Context context = getContext();
        int i10 = R$string.a_4;
        ((TextView) _$_findCachedViewById(R$id.cqf)).setText(context.getString(i10, f14, "" + alphaImExplainCourseBean.getLessonNum()));
    }

    public final void B0() {
        String id3;
        AlphaImExplainCourseBean alphaImExplainCourseBean = this.f43873e;
        if (alphaImExplainCourseBean != null && (id3 = alphaImExplainCourseBean.getId()) != null) {
            e.f133999a.h(id3, e.a.LIVE_COURSE_EXPLAIN_CARD.getValue());
        }
    }

    @Override // ms.f
    public void O() {
        z0();
        View view = this.f43874f;
        View view2 = null;
        View findViewById = view != null ? view.findViewById(R$id.ben) : null;
        View view3 = this.f43874f;
        if (view3 != null) {
            view2 = view3.findViewById(R$id.liveClassView);
        }
        if (findViewById != null && view2 != null) {
            g.f107596a.b(view2, findViewById, new c(this));
        }
    }

    public View _$_findCachedViewById(int i10) {
        Map<Integer, View> map = this.f43875g;
        View view = map.get(Integer.valueOf(i10));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i10);
        if (findViewById == null) {
            return null;
        }
        map.put(Integer.valueOf(i10), findViewById);
        return findViewById;
    }

    @Override // ms.f
    public void p() {
        z0();
        l.b(this);
    }

    public final void y0() {
        AlphaImExplainCourseBean alphaImExplainCourseBean = this.f43873e;
        if (alphaImExplainCourseBean != null) {
            String str = null;
            String courseLink = alphaImExplainCourseBean != null ? alphaImExplainCourseBean.getCourseLink() : null;
            if (courseLink != null && courseLink.length() > 0) {
                AlphaImExplainCourseBean alphaImExplainCourseBean2 = this.f43873e;
                if (alphaImExplainCourseBean2 != null) {
                    str = alphaImExplainCourseBean2.getCourseLink();
                }
            } else {
                str = Uri.parse(u.f131753a.E()).buildUpon().appendQueryParameter("course_id", alphaImExplainCourseBean.getId()).appendQueryParameter("source", "live_explain_course_card").build().toString();
            }
            tx.a a14 = rx.a.f128101a.a(str);
            Context context = getContext();
            Intrinsics.checkNotNullExpressionValue(context, "context");
            a14.c(context);
        }
    }

    public void z0() {
        d2.f102239a.a2(false);
        ms.e.f107591a.h();
        v0();
        this.f43873e = null;
    }

    /* JADX INFO: this call moved to the top of the method (can break code semantics) */
    public /* synthetic */ AlphaLiveClassCardViewV2(Context context, AttributeSet attributeSet, int i10, int i14, DefaultConstructorMarker defaultConstructorMarker) {
        this(context, (i14 & 2) != 0 ? null : attributeSet, (i14 & 4) != 0 ? 0 : i10);
    }
}