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


package com.shizhuang.duapp.modules.product_detail.exhibition.detail.views;

import android.content.Context;
import android.text.SpannableStringBuilder;
import android.text.SpannedString;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import cd.g;
import cd.k;
import co.c;
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.extension.DrawableScale;
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.du_mall_common.extension.ViewExtensionKt;
import com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver;
import com.shizhuang.duapp.modules.du_mall_common.widget.DuIconsTextView;
import com.shizhuang.duapp.modules.product_detail.exhibition.detail.model.ExbBasicModel;
import com.shizhuang.duapp.modules.product_detail.exhibition.detail.model.ExbCouponDiscountModel;
import com.shizhuang.duapp.modules.product_detail.exhibition.detail.model.component.ExbHeaderModel;
import com.shizhuang.duapp.modules.product_detail.exhibition.detail.model.component.ExbPriceInfo;
import fi.b;
import j50.o;
import j60.l0;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.JvmOverloads;
import kotlin.text.StringsKt__StringsJVMKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@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/product_detail/exhibition/detail/views/ExbHeaderView;", "Lcom/shizhuang/duapp/modules/product_detail/exhibition/detail/views/ExbBaseView;", "Lcom/shizhuang/duapp/modules/product_detail/exhibition/detail/model/component/ExbHeaderModel;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/callback/IMallViewExposureObserver;", "", "getLayoutId", "Landroid/content/Context;", "context", "Landroid/util/AttributeSet;", "attrs", "defStyleAttr", "<init>", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "du_product_detail_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: ExbHeaderView.kt */
public final class ExbHeaderView extends ExbBaseView<ExbHeaderModel> implements IMallViewExposureObserver {
    public static ChangeQuickRedirect changeQuickRedirect;

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

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

    @JvmOverloads
    public ExbHeaderView(@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 */ ExbHeaderView(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, 277074, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.f22701c == null) {
            this.f22701c = new HashMap();
        }
        View view = (View) this.f22701c.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View findViewById = findViewById(i);
        this.f22701c.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, 277069, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.layout_exb_header_view;
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    /* JADX WARNING: Removed duplicated region for block: B:105:0x0273  */
    /* JADX WARNING: Removed duplicated region for block: B:106:0x0275  */
    /* JADX WARNING: Removed duplicated region for block: B:109:0x02a8  */
    /* JADX WARNING: Removed duplicated region for block: B:110:0x02aa  */
    /* JADX WARNING: Removed duplicated region for block: B:112:0x02ae  */
    /* JADX WARNING: Removed duplicated region for block: B:25:0x0108  */
    /* JADX WARNING: Removed duplicated region for block: B:26:0x010a  */
    /* JADX WARNING: Removed duplicated region for block: B:93:0x0230  */
    /* JADX WARNING: Removed duplicated region for block: B:94:0x0232  */
    /* JADX WARNING: Removed duplicated region for block: B:97:0x0263  */
    @Override // com.shizhuang.duapp.modules.product_detail.exhibition.detail.views.ExbBaseView, com.shizhuang.duapp.common.component.module.AbsModuleView
    public void onChanged(ExbHeaderModel exbHeaderModel) {
        boolean z;
        String detailAddress;
        boolean z4;
        boolean z5;
        ExbHeaderModel exbHeaderModel2 = exbHeaderModel;
        int i = 0;
        if (!PatchProxy.proxy(new Object[]{exbHeaderModel2}, this, changeQuickRedirect, false, 277070, new Class[]{ExbHeaderModel.class}, Void.TYPE).isSupported) {
            ExbBasicModel basic = exbHeaderModel2.getBasic();
            ((DuImageLoaderView) _$_findCachedViewById(R.id.cover)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/bg_exb_head_mask.png").p0(DuScaleType.CENTER_CROP).x();
            ((c) ((DuImageLoaderView) _$_findCachedViewById(R.id.f40932bg)).i(basic.getLogoUrl()).q(10)).x();
            g.a(((DuImageLoaderView) _$_findCachedViewById(R.id.pic)).i(basic.getLogoUrl()), DrawableScale.FixedH7).x();
            ((TextView) _$_findCachedViewById(R.id.title)).setText(basic.getTitle());
            if (!PatchProxy.proxy(new Object[]{exbHeaderModel2}, this, changeQuickRedirect, false, 277071, new Class[]{ExbHeaderModel.class}, Void.TYPE).isSupported) {
                CharSequence soldText = exbHeaderModel2.getSoldText();
                String favText = exbHeaderModel2.getFavText();
                if (getViewModel().d()) {
                    if (!(favText == null || StringsKt__StringsJVMKt.isBlank(favText))) {
                        z5 = true;
                        String soldText2 = exbHeaderModel2.getSoldText();
                        boolean z12 = !(soldText2 != null || StringsKt__StringsJVMKt.isBlank(soldText2));
                        TextView textView = (TextView) _$_findCachedViewById(R.id.subTitle);
                        if (!z5 && z12) {
                            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder();
                            o.a(spannableStringBuilder.append(soldText), b.b((float) 8), 0, 2).append((CharSequence) favText);
                            Unit unit = Unit.INSTANCE;
                            soldText = new SpannedString(spannableStringBuilder);
                        } else if (!z5) {
                            soldText = favText;
                        } else if (!z12) {
                            soldText = null;
                        }
                        textView.setText(soldText);
                    }
                }
                z5 = false;
                String soldText22 = exbHeaderModel2.getSoldText();
                boolean z122 = !(soldText22 != null || StringsKt__StringsJVMKt.isBlank(soldText22));
                TextView textView2 = (TextView) _$_findCachedViewById(R.id.subTitle);
                if (!z5) {
                }
                if (!z5) {
                }
                textView2.setText(soldText);
            }
            ExbPriceInfo priceInfo = exbHeaderModel2.getPriceInfo();
            long finalPrice = priceInfo != null ? priceInfo.getFinalPrice() : 0;
            ((FontText) _$_findCachedViewById(R.id.finalPriceView)).c(k.e(finalPrice, false, null, 3), 12, 20);
            TextView textView3 = (TextView) _$_findCachedViewById(R.id.finalPriceLabelView);
            ExbPriceInfo priceInfo2 = exbHeaderModel2.getPriceInfo();
            String finalPriceLabel = priceInfo2 != null ? priceInfo2.getFinalPriceLabel() : null;
            textView3.setVisibility(!(finalPriceLabel == null || StringsKt__StringsJVMKt.isBlank(finalPriceLabel)) && (finalPrice > 0 ? 1 : (finalPrice == 0 ? 0 : -1)) > 0 ? 0 : 8);
            TextView textView4 = (TextView) _$_findCachedViewById(R.id.finalPriceLabelView);
            ExbPriceInfo priceInfo3 = exbHeaderModel2.getPriceInfo();
            textView4.setText(priceInfo3 != null ? priceInfo3.getFinalPriceLabel() : null);
            ExbPriceInfo priceInfo4 = exbHeaderModel2.getPriceInfo();
            long originalPrice = priceInfo4 != null ? priceInfo4.getOriginalPrice() : 0;
            int i3 = (originalPrice > finalPrice ? 1 : (originalPrice == finalPrice ? 0 : -1));
            ((TextView) _$_findCachedViewById(R.id.originalPriceView)).setVisibility(i3 > 0 ? 0 : 8);
            if (i3 > 0) {
                StringBuilder c5 = us.c.c(65509);
                c5.append(k.e(originalPrice, false, null, 3));
                ((TextView) _$_findCachedViewById(R.id.originalPriceView)).setText(c5.toString());
            }
            ExbCouponDiscountModel couponDiscount = exbHeaderModel2.getCouponDiscount();
            boolean z13 = couponDiscount != null;
            ((ExbCouponDiscountView) _$_findCachedViewById(R.id.couponDiscountView)).setVisibility(z13 ? 0 : 8);
            _$_findCachedViewById(R.id.couponDiscountDivider).setVisibility(z13 ? 0 : 8);
            if (couponDiscount != null) {
                ((ExbCouponDiscountView) _$_findCachedViewById(R.id.couponDiscountView)).update(couponDiscount);
            }
            ((TextView) _$_findCachedViewById(R.id.time)).setText(basic.getExhDate());
            ((TextView) _$_findCachedViewById(R.id.timeDetail)).setText(basic.getExhDec());
            TextView textView5 = (TextView) _$_findCachedViewById(R.id.timeDetail);
            String exhDec = basic.getExhDec();
            if (exhDec != null) {
                if (exhDec.length() > 0) {
                    z = true;
                    textView5.setVisibility(!z ? 0 : 8);
                    ((TextView) _$_findCachedViewById(R.id.address)).setText(basic.getName());
                    ((TextView) _$_findCachedViewById(R.id.addressDetail)).setText(basic.getDetailAddress());
                    TextView textView6 = (TextView) _$_findCachedViewById(R.id.addressDetail);
                    detailAddress = basic.getDetailAddress();
                    if (detailAddress != null) {
                        if (detailAddress.length() > 0) {
                            z4 = true;
                            textView6.setVisibility(z4 ? 0 : 8);
                            StringBuilder c12 = us.c.c(20849);
                            c12.append(basic.getExhibitionNums());
                            c12.append((char) 22330);
                            ((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress)).setText(c12.toString());
                            DuIconsTextView duIconsTextView = (DuIconsTextView) _$_findCachedViewById(R.id.moreAddress);
                            if (!(basic.getExhibitionNums() > 1)) {
                                i = 8;
                            }
                            duIconsTextView.setVisibility(i);
                            l0.a((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), b.b((float) 10));
                            ViewExtensionKt.e((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), 0, new ExbHeaderView$onChanged$1(this, basic), 1);
                        }
                    }
                    z4 = false;
                    textView6.setVisibility(z4 ? 0 : 8);
                    StringBuilder c122 = us.c.c(20849);
                    c122.append(basic.getExhibitionNums());
                    c122.append((char) 22330);
                    ((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress)).setText(c122.toString());
                    DuIconsTextView duIconsTextView2 = (DuIconsTextView) _$_findCachedViewById(R.id.moreAddress);
                    if (!(basic.getExhibitionNums() > 1)) {
                    }
                    duIconsTextView2.setVisibility(i);
                    l0.a((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), b.b((float) 10));
                    ViewExtensionKt.e((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), 0, new ExbHeaderView$onChanged$1(this, basic), 1);
                }
            }
            z = false;
            textView5.setVisibility(!z ? 0 : 8);
            ((TextView) _$_findCachedViewById(R.id.address)).setText(basic.getName());
            ((TextView) _$_findCachedViewById(R.id.addressDetail)).setText(basic.getDetailAddress());
            TextView textView62 = (TextView) _$_findCachedViewById(R.id.addressDetail);
            detailAddress = basic.getDetailAddress();
            if (detailAddress != null) {
            }
            z4 = false;
            textView62.setVisibility(z4 ? 0 : 8);
            StringBuilder c1222 = us.c.c(20849);
            c1222.append(basic.getExhibitionNums());
            c1222.append((char) 22330);
            ((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress)).setText(c1222.toString());
            DuIconsTextView duIconsTextView22 = (DuIconsTextView) _$_findCachedViewById(R.id.moreAddress);
            if (!(basic.getExhibitionNums() > 1)) {
            }
            duIconsTextView22.setVisibility(i);
            l0.a((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), b.b((float) 10));
            ViewExtensionKt.e((DuIconsTextView) _$_findCachedViewById(R.id.moreAddress), 0, new ExbHeaderView$onChanged$1(this, basic), 1);
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver
    public void onExposure() {
        ExbHeaderModel exbHeaderModel;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 277072, new Class[0], Void.TYPE).isSupported && (exbHeaderModel = (ExbHeaderModel) getData()) != null) {
            i60.b bVar = i60.b.f33293a;
            ArrayMap arrayMap = new ArrayMap(8);
            String title = exbHeaderModel.getBasic().getTitle();
            if (title == null) {
                title = "";
            }
            arrayMap.put("block_title", title);
            arrayMap.put("show_id", String.valueOf(getViewModel().getSpuId()));
            bVar.b("trade_show_exposure", "881", "", arrayMap);
        }
    }

    @JvmOverloads
    public ExbHeaderView(@NotNull Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ((TextView) _$_findCachedViewById(R.id.originalPriceView)).getPaint().setFlags(16);
    }
}