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


package com.xingin.alpha.goods.theme.viewholder;

import android.content.Context;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import bj2.l;
import com.google.android.gms.common.GoogleApiAvailabilityLight;
import com.igexin.push.core.d.c;
import com.tencent.smtt.sdk.TbsListener;
import com.xingin.alpha.R$drawable;
import com.xingin.alpha.R$id;
import com.xingin.alpha.R$string;
import com.xingin.alpha.bean.GoodsCouponBean;
import com.xingin.alpha.goods.adapter.GoodsOfMatchAdapter;
import com.xingin.alpha.goods.theme.bean.SelectGoodsThemeBean;
import com.xingin.alpha.goods.theme.view.NestedRecyclerView;
import com.xingin.alpha.ui.widget.AlphaSimpleDecoration;
import com.xingin.foundation.framework.v2.recyclerview.KotlinViewHolder;
import com.xingin.ui.round.SelectRoundButton;
import com.xingin.ui.round.SelectRoundLinearLayout;
import com.xingin.ui.round.SelectRoundTextView;
import com.xingin.widgets.XYImageView;
import com.xingin.xhstheme.R$color;
import el.g0;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import ks.e;
import ln.d2;
import nu2.f;
import sy.q1;
import sy.y;
import t10.k;

@Metadata(bv = {}, d1 = {"\u0000T\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0011\u0018\u00002\u00020\u0001B\u000f\u0012\u0006\u0010\b\u001a\u00020\u0005¢\u0006\u0004\b)\u0010*JJ\u0010\r\u001a\u00020\u000b2\u0006\u0010\u0003\u001a\u00020\u00022:\b\u0002\u0010\f\u001a4\u0012\u0013\u0012\u00110\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\t¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0004\u0012\u00020\u000b\u0018\u00010\u0004J\u0016\u0010\u0012\u001a\u00020\u000b2\u0006\u0010\u000f\u001a\u00020\u000e2\u0006\u0010\u0011\u001a\u00020\u0010Jd\u0010\u0018\u001a\u00020\u000b2\u0006\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u00152\u0006\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0017\u001a\u00020\u00102:\b\u0002\u0010\f\u001a4\u0012\u0013\u0012\u00110\u0005¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\b\u0012\u0013\u0012\u00110\t¢\u0006\f\b\u0006\u0012\b\b\u0007\u0012\u0004\b\b(\n\u0012\u0004\u0012\u00020\u000b\u0018\u00010\u0004H\u0002J\u0018\u0010\u001c\u001a\u00020\u000b2\u000e\u0010\u001b\u001a\n\u0012\u0004\u0012\u00020\u001a\u0018\u00010\u0019H\u0002R\u0017\u0010\b\u001a\u00020\u00058\u0006¢\u0006\f\n\u0004\b\u001d\u0010\u001e\u001a\u0004\b\u001f\u0010 R\u001b\u0010%\u001a\u00020\u00158BX‚„\u0002¢\u0006\f\n\u0004\b!\u0010\"\u001a\u0004\b#\u0010$R\u001b\u0010(\u001a\u00020\u00158BX‚„\u0002¢\u0006\f\n\u0004\b&\u0010\"\u001a\u0004\b'\u0010$¨\u0006+"}, d2 = {"Lcom/xingin/alpha/goods/theme/viewholder/GoodsMatchSelectedViewHolder;", "Lcom/xingin/foundation/framework/v2/recyclerview/KotlinViewHolder;", "Landroidx/recyclerview/widget/RecyclerView$RecycledViewPool;", "viewPool", "Lkotlin/Function2;", "Landroid/view/View;", "Lkotlin/ParameterName;", "name", qo2.a.COPY_LINK_TYPE_VIEW, "", "position", "", "itemClickCallback", "v", "Lcom/xingin/alpha/goods/theme/bean/SelectGoodsThemeBean;", "data", "", "isManager", GoogleApiAvailabilityLight.TRACKING_SOURCE_NOTIFICATION, "Landroidx/recyclerview/widget/RecyclerView;", "recyclerView", "Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;", "goodsAdapter", "isVertical", "s", "", "Lcom/xingin/alpha/bean/GoodsCouponBean;", "couponList", "w", "b", "Landroid/view/View;", "getView", "()Landroid/view/View;", "c", "Lkotlin/Lazy;", c.f25536c, "()Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;", "horizonAdapter", "d", "r", "verticalAdapter", "<init>", "(Landroid/view/View;)V", "alpha_library_release"}, k = 1, mv = {1, 6, 0})
/* compiled from: GoodsMatchSelectedViewHolder.kt */
public final class GoodsMatchSelectedViewHolder extends KotlinViewHolder {

    /* renamed from: b  reason: collision with root package name */
    public final View f43574b;

    /* renamed from: c  reason: collision with root package name */
    public final Lazy f43575c;

    /* renamed from: d  reason: collision with root package name */
    public final Lazy f43576d;

    /* renamed from: e  reason: collision with root package name */
    public Map<Integer, View> f43577e = new LinkedHashMap();

    @Metadata(bv = {}, d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0001\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;", "a", "()Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;"}, k = 3, mv = {1, 6, 0})
    /* compiled from: GoodsMatchSelectedViewHolder.kt */
    public static final class a extends Lambda implements Function0<GoodsOfMatchAdapter> {

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

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

        /* renamed from: a */
        public final GoodsOfMatchAdapter invoke() {
            Context context = this.f43578a.getView().getContext();
            Intrinsics.checkNotNullExpressionValue(context, "view.context");
            return new GoodsOfMatchAdapter(context, false);
        }
    }

    @Metadata(bv = {}, d1 = {"\u0000\b\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0001\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0001\u0010\u0002"}, d2 = {"Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;", "a", "()Lcom/xingin/alpha/goods/adapter/GoodsOfMatchAdapter;"}, k = 3, mv = {1, 6, 0})
    /* compiled from: GoodsMatchSelectedViewHolder.kt */
    public static final class b extends Lambda implements Function0<GoodsOfMatchAdapter> {

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

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

        /* renamed from: a */
        public final GoodsOfMatchAdapter invoke() {
            Context context = this.f43579a.getView().getContext();
            Intrinsics.checkNotNullExpressionValue(context, "view.context");
            return new GoodsOfMatchAdapter(context, true);
        }
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public GoodsMatchSelectedViewHolder(View view) {
        super(view);
        Intrinsics.checkNotNullParameter(view, qo2.a.COPY_LINK_TYPE_VIEW);
        this.f43574b = view;
        this.f43575c = LazyKt__LazyJVMKt.lazy(new a(this));
        this.f43576d = LazyKt__LazyJVMKt.lazy(new b(this));
    }

    public final View getView() {
        return this.f43574b;
    }

    public View m(int i10) {
        View findViewById;
        Map<Integer, View> map = this.f43577e;
        View view = map.get(Integer.valueOf(i10));
        if (view != null) {
            return view;
        }
        View i14 = i();
        if (i14 == null || (findViewById = i14.findViewById(i10)) == null) {
            return null;
        }
        map.put(Integer.valueOf(i10), findViewById);
        return findViewById;
    }

    public final void n(SelectGoodsThemeBean selectGoodsThemeBean, boolean z14) {
        int i10;
        int i14;
        String str;
        int i15;
        Intrinsics.checkNotNullParameter(selectGoodsThemeBean, "data");
        View i16 = i();
        boolean z15 = true;
        GoodsOfMatchAdapter goodsOfMatchAdapter = null;
        if (z14) {
            l.b((SelectRoundButton) i16.findViewById(R$id.f39793btnBuy));
            l.b((TextView) i16.findViewById(R$id.e6i));
            int i17 = R$id.b4k;
            l.q((SelectRoundTextView) i16.findViewById(i17));
            l.b((TextView) i16.findViewById(R$id.elu));
            if (selectGoodsThemeBean.isExplaining()) {
                SelectRoundTextView selectRoundTextView = (SelectRoundTextView) i16.findViewById(i17);
                selectRoundTextView.setText(selectRoundTextView.getContext().getString(R$string.a3g));
                if (gu2.a.k()) {
                    i15 = f.e(R$color.xhsTheme_colorBlack);
                } else {
                    i15 = f.e(R$color.xhsTheme_colorWhitePatch1);
                }
                selectRoundTextView.setTextColor(i15);
                selectRoundTextView.setBackground(f.h(R$drawable.alpha_bg_single_theme_goods_buy));
                l.q((LinearLayout) i16.findViewById(R$id.b4l));
                ImageView imageView = (ImageView) i16.findViewById(R$id.b4o);
                Intrinsics.checkNotNullExpressionValue(imageView, "explainImageView");
                e.D(imageView, true);
            } else {
                SelectRoundTextView selectRoundTextView2 = (SelectRoundTextView) i16.findViewById(i17);
                selectRoundTextView2.setText(selectRoundTextView2.getContext().getString(R$string.a1y));
                selectRoundTextView2.setTextColor(f.e(R$color.xhsTheme_colorBlack));
                selectRoundTextView2.setBackground(f.h(R$drawable.alpha_bg_rectangle_yellow_middle));
                l.b((LinearLayout) i16.findViewById(R$id.b4l));
                ImageView imageView2 = (ImageView) i16.findViewById(R$id.b4o);
                Intrinsics.checkNotNullExpressionValue(imageView2, "explainImageView");
                e.K(imageView2);
            }
        } else {
            l.b((SelectRoundTextView) i16.findViewById(R$id.b4k));
            int i18 = R$id.b4l;
            l.b((LinearLayout) i16.findViewById(i18));
            l.q((SelectRoundButton) i16.findViewById(R$id.f39793btnBuy));
            boolean b14 = y.f131790a.b(selectGoodsThemeBean.getGoodsItemId());
            if (selectGoodsThemeBean.isExplaining()) {
                l.b((TextView) i16.findViewById(R$id.elu));
                l.q((LinearLayout) i16.findViewById(i18));
                l.b((TextView) i16.findViewById(R$id.e6i));
                ImageView imageView3 = (ImageView) i16.findViewById(R$id.b4o);
                Intrinsics.checkNotNullExpressionValue(imageView3, "explainImageView");
                e.D(imageView3, true);
            } else if (selectGoodsThemeBean.getHasPlayBack()) {
                l.q((TextView) i16.findViewById(R$id.e6i));
                l.b((TextView) i16.findViewById(R$id.elu));
                l.b((LinearLayout) i16.findViewById(i18));
                ImageView imageView4 = (ImageView) i16.findViewById(R$id.b4o);
                Intrinsics.checkNotNullExpressionValue(imageView4, "explainImageView");
                e.K(imageView4);
            } else {
                l.b((TextView) i16.findViewById(R$id.e6i));
                l.b((LinearLayout) i16.findViewById(i18));
                int i19 = R$id.elu;
                TextView textView = (TextView) i16.findViewById(i19);
                Intrinsics.checkNotNullExpressionValue(textView, "requestExplainView");
                q1.Q(textView, d2.f102239a.w0(), false, 2, null);
                ImageView imageView5 = (ImageView) i16.findViewById(R$id.b4o);
                Intrinsics.checkNotNullExpressionValue(imageView5, "explainImageView");
                e.K(imageView5);
                if (selectGoodsThemeBean.checkStock() || b14) {
                    TextView textView2 = (TextView) i16.findViewById(i19);
                    Intrinsics.checkNotNullExpressionValue(textView2, "requestExplainView");
                    q1.J(textView2, R$drawable.alpha_ic_goods_item_request_explain);
                    TextView textView3 = (TextView) i16.findViewById(i19);
                    if (b14) {
                        i14 = f.e(com.xingin.alpha.R$color.xhsTheme_colorGrayLevel3);
                    } else {
                        i14 = f.e(com.xingin.alpha.R$color.xhsTheme_colorGrayLevel1);
                    }
                    textView3.setTextColor(i14);
                    TextView textView4 = (TextView) i16.findViewById(i19);
                    if (b14) {
                        str = i16.getContext().getString(R$string.a39);
                    } else {
                        str = i16.getContext().getString(R$string.a38);
                    }
                    textView4.setText(str);
                } else {
                    ((TextView) i16.findViewById(i19)).setText(i16.getContext().getString(R$string.a38));
                    ((TextView) i16.findViewById(i19)).setTextColor(f.e(com.xingin.alpha.R$color.xhsTheme_colorGrayLevel4));
                    TextView textView5 = (TextView) i16.findViewById(i19);
                    Intrinsics.checkNotNullExpressionValue(textView5, "requestExplainView");
                    q1.J(textView5, R$drawable.alpha_ic_goods_request_explain_disable);
                }
            }
        }
        ((TextView) i16.findViewById(R$id.gle)).setText(selectGoodsThemeBean.getTitle());
        XYImageView xYImageView = (XYImageView) i16.findViewById(R$id.clo);
        String str2 = gu2.a.k() ? "https://fe-video-qc.xhscdn.com/picasso-editor/12e349b562be737c9861f6379a30651dcd981e53.png" : "https://fe-video-qc.xhscdn.com/picasso-editor/a04e48d04657d1d1deb082f2e5cd329f488a9b6d.png";
        g0 g0Var = g0.f72750a;
        xYImageView.o(str2, g0Var.P());
        w(selectGoodsThemeBean.getCoupon());
        String picUrl = selectGoodsThemeBean.getPicUrl();
        if (picUrl == null || picUrl.length() <= 0) {
            z15 = false;
        }
        View findViewById = i16.findViewById(R$id.flt);
        Intrinsics.checkNotNullExpressionValue(findViewById, "themePictureView");
        q1.Q(findViewById, z15, false, 2, null);
        int i24 = R$id.efn;
        RecyclerView recyclerView = (RecyclerView) i16.findViewById(i24);
        Intrinsics.checkNotNullExpressionValue(recyclerView, "rcvMatchGoods");
        if (z15) {
            l.b(recyclerView);
        } else {
            l.q(recyclerView);
        }
        if (z15) {
            int i25 = R$id.efr;
            RecyclerView.Adapter adapter = ((NestedRecyclerView) i16.findViewById(i25)).getAdapter();
            if (adapter instanceof GoodsOfMatchAdapter) {
                goodsOfMatchAdapter = (GoodsOfMatchAdapter) adapter;
            }
            if (goodsOfMatchAdapter != null) {
                goodsOfMatchAdapter.h(selectGoodsThemeBean.getItemGoods());
            }
            ((XYImageView) i16.findViewById(R$id.fls)).o(selectGoodsThemeBean.getPicUrl(), g0Var.R());
            ((NestedRecyclerView) i16.findViewById(i25)).setNestedScrollingEnabled(false);
        } else {
            RecyclerView.Adapter adapter2 = ((RecyclerView) i16.findViewById(i24)).getAdapter();
            if (adapter2 instanceof GoodsOfMatchAdapter) {
                goodsOfMatchAdapter = (GoodsOfMatchAdapter) adapter2;
            }
            if (goodsOfMatchAdapter != null) {
                goodsOfMatchAdapter.h(selectGoodsThemeBean.getItemGoods());
            }
        }
        int i26 = R$id.f39793btnBuy;
        ((SelectRoundButton) i16.findViewById(i26)).setText(i16.getContext().getString(R$string.a2j));
        ((SelectRoundButton) i16.findViewById(i26)).setBackgroundResource(R$drawable.alpha_bg_rectangle_yellow_middle);
        ((SelectRoundButton) i16.findViewById(i26)).setTextColor(f.e(com.xingin.alpha.R$color.xhsTheme_colorBlack));
        ((SelectRoundLinearLayout) i16.findViewById(R$id.a7k)).setBackground(f.h(gu2.a.k() ? R$drawable.alpha_bg_rectangle_white_10_corner : R$drawable.alpha_bg_rectangle_white_10_corner_night));
        View findViewById2 = i16.findViewById(R$id.f39759bgYellowView);
        if (gu2.a.k()) {
            i10 = ContextCompat.getColor(i16.getContext(), com.xingin.alpha.R$color.alpha_single_theme_text_bg);
        } else {
            i10 = ContextCompat.getColor(i16.getContext(), com.xingin.alpha.R$color.alpha_single_theme_text_bg_dark);
        }
        findViewById2.setBackgroundColor(i10);
    }

    public final GoodsOfMatchAdapter p() {
        return (GoodsOfMatchAdapter) this.f43575c.getValue();
    }

    public final GoodsOfMatchAdapter r() {
        return (GoodsOfMatchAdapter) this.f43576d.getValue();
    }

    public final void s(RecyclerView recyclerView, GoodsOfMatchAdapter goodsOfMatchAdapter, RecyclerView.RecycledViewPool recycledViewPool, boolean z14, Function2<? super View, ? super Integer, Unit> function2) {
        recyclerView.setRecycledViewPool(recycledViewPool);
        recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), z14 ? 1 : 0, false));
        Context context = recyclerView.getContext();
        Intrinsics.checkNotNullExpressionValue(context, "context");
        recyclerView.addItemDecoration(new AlphaSimpleDecoration(context, q1.n(7), 0, 0, 0, 0, null, false, TbsListener.ErrorCode.EXCEED_INCR_UPDATE, null));
        goodsOfMatchAdapter.g(function2);
        recyclerView.setAdapter(goodsOfMatchAdapter);
    }

    public final void v(RecyclerView.RecycledViewPool recycledViewPool, Function2<? super View, ? super Integer, Unit> function2) {
        Intrinsics.checkNotNullParameter(recycledViewPool, "viewPool");
        RecyclerView recyclerView = (RecyclerView) i().findViewById(R$id.efn);
        Intrinsics.checkNotNullExpressionValue(recyclerView, "containerView.rcvMatchGoods");
        s(recyclerView, p(), recycledViewPool, false, function2);
        View i10 = i();
        int i14 = R$id.efr;
        NestedRecyclerView nestedRecyclerView = (NestedRecyclerView) i10.findViewById(i14);
        Intrinsics.checkNotNullExpressionValue(nestedRecyclerView, "containerView.rcvVerticalMatchGoods");
        s(nestedRecyclerView, r(), recycledViewPool, true, function2);
        k kVar = k.f132112a;
        Context context = i().getContext();
        Intrinsics.checkNotNullExpressionValue(context, "containerView.context");
        int f14 = kVar.f(context);
        Resources system = Resources.getSystem();
        Intrinsics.checkExpressionValueIsNotNull(system, "Resources.getSystem()");
        Resources system2 = Resources.getSystem();
        Intrinsics.checkExpressionValueIsNotNull(system2, "Resources.getSystem()");
        Resources system3 = Resources.getSystem();
        Intrinsics.checkExpressionValueIsNotNull(system3, "Resources.getSystem()");
        int applyDimension = ((f14 - ((int) TypedValue.applyDimension(1, (float) 62, system.getDisplayMetrics()))) - ((int) TypedValue.applyDimension(1, (float) 66, system2.getDisplayMetrics()))) - ((int) TypedValue.applyDimension(1, (float) 10, system3.getDisplayMetrics()));
        XYImageView xYImageView = (XYImageView) i().findViewById(R$id.fls);
        Intrinsics.checkNotNullExpressionValue(xYImageView, "containerView.themeMainImage");
        ViewGroup.LayoutParams layoutParams = xYImageView.getLayoutParams();
        if (layoutParams != null) {
            layoutParams.width = applyDimension;
            layoutParams.height = applyDimension;
            xYImageView.setLayoutParams(layoutParams);
            NestedRecyclerView nestedRecyclerView2 = (NestedRecyclerView) i().findViewById(i14);
            Intrinsics.checkNotNullExpressionValue(nestedRecyclerView2, "containerView.rcvVerticalMatchGoods");
            ViewGroup.LayoutParams layoutParams2 = nestedRecyclerView2.getLayoutParams();
            if (layoutParams2 != null) {
                layoutParams2.height = applyDimension;
                nestedRecyclerView2.setLayoutParams(layoutParams2);
                return;
            }
            throw new TypeCastException("null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
        }
        throw new TypeCastException("null cannot be cast to non-null type android.view.ViewGroup.LayoutParams");
    }

    public final void w(List<GoodsCouponBean> list) {
        View i10 = i();
        if (list == null || list.isEmpty()) {
            ((LinearLayout) i10.findViewById(R$id.f39840couponContainer)).setVisibility(8);
            return;
        }
        ((LinearLayout) i10.findViewById(R$id.f39840couponContainer)).setVisibility(0);
        ((TextView) i10.findViewById(R$id.fwd)).setText(list.get(0).getCouponRemark());
        if (list.size() >= 2) {
            int i14 = R$id.fwe;
            ((TextView) i10.findViewById(i14)).setVisibility(0);
            ((TextView) i10.findViewById(i14)).setText(list.get(1).getCouponRemark());
        } else {
            ((TextView) i10.findViewById(R$id.fwe)).setVisibility(8);
        }
        if (list.size() >= 3) {
            int i15 = R$id.fwf;
            ((TextView) i10.findViewById(i15)).setVisibility(0);
            ((TextView) i10.findViewById(i15)).setText(list.get(2).getCouponRemark());
            return;
        }
        ((TextView) i10.findViewById(R$id.fwf)).setVisibility(8);
    }
}