得物.apk(点击下载) / FirstRelateSpuView.java


package com.shizhuang.duapp.modules.productv2.trend.landing.view;

import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewCompat;
import cd.k;
import com.meituan.robust.ChangeQuickRedirect;
import com.meituan.robust.PatchProxy;
import com.meituan.robust.PatchProxyResult;
import com.shizhuang.duapp.R;
import com.shizhuang.duapp.common.component.module.IModuleExposureObserver;
import com.shizhuang.duapp.common.component.module.ModuleAdapterDelegateKt;
import com.shizhuang.duapp.common.exposure.DuExposureHelper;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.widget.font.FontText;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.productv2.trend.landing.model.FirstRelateSpuModel;
import com.shizhuang.duapp.modules.productv2.trend.landing.model.SpuInfo;
import i60.b;
import j60.z;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.jvm.JvmOverloads;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import yc.c;

@Metadata(bv = {}, d1 = {"\u0000$\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u0003B'\b\u0007\u0012\u0006\u0010\u0007\u001a\u00020\u0006\u0012\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\b\u0012\b\b\u0002\u0010\n\u001a\u00020\u0004¢\u0006\u0004\b\u000b\u0010\fJ\b\u0010\u0005\u001a\u00020\u0004H\u0016¨\u0006\r"}, d2 = {"Lcom/shizhuang/duapp/modules/productv2/trend/landing/view/FirstRelateSpuView;", "Lcom/shizhuang/duapp/modules/productv2/trend/landing/view/BaseLandingPageView;", "Lcom/shizhuang/duapp/modules/productv2/trend/landing/model/FirstRelateSpuModel;", "Lcom/shizhuang/duapp/common/component/module/IModuleExposureObserver;", "", "getLayoutId", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "du_product_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: FirstRelateSpuView.kt */
public final class FirstRelateSpuView extends BaseLandingPageView<FirstRelateSpuModel> implements IModuleExposureObserver {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: c  reason: collision with root package name */
    public HashMap f24247c;

    @JvmOverloads
    public FirstRelateSpuView(@NotNull Context context) {
        this(context, null, 0, 6);
    }

    @JvmOverloads
    public FirstRelateSpuView(@NotNull Context context, @Nullable AttributeSet attributeSet) {
        this(context, attributeSet, 0, 4);
    }

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

    public View _$_findCachedViewById(int i) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, this, changeQuickRedirect, false, 304528, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.f24247c == null) {
            this.f24247c = new HashMap();
        }
        View view = (View) this.f24247c.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.f24247c.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    @Override // com.shizhuang.duapp.common.component.module.AbsModuleView
    public int getLayoutId() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 304524, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.item_trend_landing_first_relate_spu;
    }

    @Override // com.shizhuang.duapp.common.component.module.AbsModuleView
    public void onChanged(Object obj) {
        FirstRelateSpuModel firstRelateSpuModel = (FirstRelateSpuModel) obj;
        if (!PatchProxy.proxy(new Object[]{firstRelateSpuModel}, this, changeQuickRedirect, false, 304525, new Class[]{FirstRelateSpuModel.class}, Void.TYPE).isSupported) {
            SpuInfo product = firstRelateSpuModel.getProduct();
            ((DuImageLoaderView) _$_findCachedViewById(R.id.ivProduct)).i(product != null ? product.getLogoUrl() : null).l0(c.e(c.f40324a, ViewCompat.MEASURED_STATE_MASK, i.f36333a, 0, null, null, 30)).d0(300).x();
            TextView textView = (TextView) _$_findCachedViewById(R.id.tvRecommendReason);
            String recommendReason = firstRelateSpuModel.getRecommendReason();
            textView.setVisibility(recommendReason == null || recommendReason.length() == 0 ? 4 : 0);
            ((TextView) _$_findCachedViewById(R.id.tvRecommendReason)).setText(firstRelateSpuModel.getRecommendReason());
            ((TextView) _$_findCachedViewById(R.id.tvName)).setText(product != null ? product.getTitle() : null);
            ((FontText) _$_findCachedViewById(R.id.fontTextPrice)).c(k.g(product != null ? Long.valueOf(product.getPrice()) : null, false, null, 3), 10, 14);
            ViewExtensionKt.j((LinearLayout) _$_findCachedViewById(R.id.layout), 0, new FirstRelateSpuView$onChanged$1(this, product), 1);
        }
    }

    @Override // com.shizhuang.duapp.common.component.module.IModuleExposureObserver
    public void onExposure(@Nullable DuExposureHelper.State state) {
        SpuInfo product;
        SpuInfo product2;
        if (!PatchProxy.proxy(new Object[]{state}, this, changeQuickRedirect, false, 304526, new Class[]{DuExposureHelper.State.class}, Void.TYPE).isSupported) {
            b bVar = b.f33293a;
            ArrayMap arrayMap = new ArrayMap(8);
            FirstRelateSpuModel firstRelateSpuModel = (FirstRelateSpuModel) getData();
            arrayMap.put("block_content_id", Long.valueOf((firstRelateSpuModel == null || (product2 = firstRelateSpuModel.getProduct()) == null) ? 0 : product2.getSpuId()));
            FirstRelateSpuModel firstRelateSpuModel2 = (FirstRelateSpuModel) getData();
            String title = (firstRelateSpuModel2 == null || (product = firstRelateSpuModel2.getProduct()) == null) ? null : product.getTitle();
            if (title == null) {
                title = "";
            }
            arrayMap.put("block_content_title", title);
            arrayMap.put("block_content_position", Integer.valueOf(ModuleAdapterDelegateKt.b(this) + 1));
            bVar.b("trade_channel_block_exposure", "964", "1795", arrayMap);
        }
    }

    @JvmOverloads
    public FirstRelateSpuView(@NotNull Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        int b = fi.b.b((float) 2);
        z.a aVar = z.b;
        aVar.a((ConstraintLayout) _$_findCachedViewById(R.id.content), b, 0);
        aVar.a((TextView) _$_findCachedViewById(R.id.tvRecommendReason), fi.b.b((float) 1), Integer.valueOf(Color.parseColor("#1a565656")));
        ((DuImageLoaderView) _$_findCachedViewById(R.id.ivBottomBg)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/du_product/trend_landing_product_bottom_bg.webp").c0(new ColorDrawable(-1)).p0(DuScaleType.FIT_XY).x();
    }
}