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


package com.shizhuang.duapp.modules.product_detail.exown.widget;

import a01.a;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewCompat;
import androidx.lifecycle.LifecycleCoroutineScope;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleOwnerKt;
import cd.g;
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.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.ui.view.ProductImageLoaderView;
import com.shizhuang.duapp.common.widget.font.FontText;
import com.shizhuang.duapp.common.widget.shapeview.ShapeTextView;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_mall_common.extension.LifecycleExtensionKt;
import com.shizhuang.duapp.modules.pay.R$styleable;
import com.shizhuang.duapp.modules.product_detail.own.ui.MyOwnActivity;
import f21.c;
import fi.b;
import j60.y;
import java.util.HashMap;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Unit;
import kotlin.collections.ArraysKt___ArraysKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import qc.f;

@Metadata(bv = {}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0011\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0007\u0018\u00002\u00020\u0001R=\u0010\n\u001a$\u0012 \u0012\u001e\u0012\f\u0012\n \u0005*\u0004\u0018\u00010\u00040\u0004\u0012\f\u0012\n \u0005*\u0004\u0018\u00010\u00040\u00040\u00030\u00028BX‚„\u0002¢\u0006\f\n\u0004\b\u0006\u0010\u0007\u001a\u0004\b\b\u0010\t¨\u0006\u000b"}, d2 = {"Lcom/shizhuang/duapp/modules/product_detail/exown/widget/ExOwnSkuCardShareViewNew;", "Landroid/widget/FrameLayout;", "", "Lkotlin/Pair;", "Landroid/widget/TextView;", "kotlin.jvm.PlatformType", "b", "Lkotlin/Lazy;", "getDescViews", "()[Lkotlin/Pair;", "descViews", "du_product_detail_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: ExOwnSkuCardShareViewNew.kt */
public final class ExOwnSkuCardShareViewNew extends FrameLayout {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final Lazy b;

    /* renamed from: c  reason: collision with root package name */
    public c f22738c;
    public final FrameLayout d;
    public final AppCompatImageView e;
    public final String f;

    /* renamed from: g  reason: collision with root package name */
    public HashMap f22739g;

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

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

    /* JADX WARNING: Illegal instructions before constructor call */
    public ExOwnSkuCardShareViewNew(Context context, AttributeSet attributeSet, String str, int i) {
        super(context, r2);
        AttributeSet attributeSet2 = (i & 2) != 0 ? null : attributeSet;
        String str2 = (i & 4) != 0 ? "" : str;
        this.f = str2;
        this.b = LazyKt__LazyJVMKt.lazy(new ExOwnSkuCardShareViewNew$descViews$2(this));
        int parseColor = Color.parseColor("#B2FFFFFF");
        FrameLayout frameLayout = new FrameLayout(context);
        GradientDrawable gradientDrawable = new GradientDrawable();
        gradientDrawable.setCornerRadius((float) b.b((float) 2));
        gradientDrawable.setColor(parseColor);
        Unit unit = Unit.INSTANCE;
        frameLayout.setBackground(gradientDrawable);
        this.d = frameLayout;
        AppCompatImageView appCompatImageView = new AppCompatImageView(context);
        this.e = appCompatImageView;
        setLayoutParams(new ViewGroup.LayoutParams((int) (((float) b.f32351a) * 0.8666667f), -2));
        setBackgroundColor(Color.parseColor("#3F494E"));
        ViewExtensionKt.v(this, R.layout.item_own_sku_card_new, true);
        ConstraintLayout.LayoutParams layoutParams = new ConstraintLayout.LayoutParams(0, 0);
        layoutParams.topToBottom = ((ConstraintLayout) a(R.id.contentContainer)).getId();
        layoutParams.bottomToBottom = ((DuImageLoaderView) a(R.id.bgCard)).getId();
        layoutParams.endToEnd = ((ConstraintLayout) a(R.id.contentContainer)).getId();
        layoutParams.dimensionRatio = "H,1:1";
        layoutParams.matchConstraintPercentWidth = 0.12f;
        ((ConstraintLayout) a(R.id.cardContainer)).addView(frameLayout, layoutParams);
        appCompatImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        com.shizhuang.duapp.modules.du_mall_common.extension.ViewExtensionKt.b(frameLayout, appCompatImageView, 0, true, true, 0, 0, 0, b.b(2.0f), b.b(2.0f), b.b(1.7f), b.b(1.7f), R$styleable.AppCompatTheme_viewInflaterClass);
        ((ShapeTextView) a(R.id.tvEnterProductDetail)).setVisibility(8);
        ((ConstraintLayout) a(R.id.delLayout)).setVisibility(8);
        ((DuImageLoaderView) a(R.id.ivPoizonTag)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product_detail/icon_detail_card_poizon_tag_new.png").p0(DuScaleType.FIT_XY).x();
    }

    private final Pair<TextView, TextView>[] getDescViews() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 277688, new Class[0], Pair[].class);
        return (Pair[]) (proxy.isSupported ? proxy.result : this.b.getValue());
    }

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

    public final Bitmap b(long j, long j12, int i) {
        Object[] objArr = {new Long(j), new Long(j12), new Integer(i)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Long.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 277689, new Class[]{cls, cls, Integer.TYPE}, Bitmap.class);
        if (proxy.isSupported) {
            return (Bitmap) proxy.result;
        }
        return y.a(f.a() + "router/product/ProductDetail?spuId=" + j + "&skuId=" + j12 + "&sourceName=" + this.f, i, null, 0, 0, 6);
    }

    public final void c(@Nullable c cVar) {
        Pair[] pairArr;
        LifecycleCoroutineScope lifecycleScope;
        String str;
        int i = 1;
        if (!PatchProxy.proxy(new Object[]{cVar}, this, changeQuickRedirect, false, 277690, new Class[]{c.class}, Void.TYPE).isSupported && !Intrinsics.areEqual(this.f22738c, cVar)) {
            this.f22738c = cVar;
            ((FontText) a(R.id.tvProductTitle)).setText(cVar != null ? cVar.g() : null);
            TextView textView = (TextView) a(R.id.tvSkuDesc);
            StringBuilder h12 = a.f.h("规格 ");
            String i3 = cVar != null ? cVar.i() : null;
            String str2 = "";
            if (i3 == null) {
                i3 = str2;
            }
            a0.b.k(h12, i3, textView);
            String j = cVar != null ? cVar.j() : null;
            if (cVar == null || !cVar.m()) {
                ((FontText) a(R.id.tvHornoraryTitle)).setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_own_card_wheat_left, 0, R.drawable.ic_own_card_wheat_right, 0);
                ((FontText) a(R.id.tvHornoraryTitle)).setText(j);
                ((FontText) a(R.id.tvHornoraryTitle)).setVisibility((j == null || j.length() == 0) ^ true ? 0 : 8);
            } else {
                ((FontText) a(R.id.tvHornoraryTitle)).setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
                FontText fontText = (FontText) a(R.id.tvHornoraryTitle);
                String e6 = cVar.e();
                String str3 = e6 != null ? e6 : str2;
                FontText fontText2 = (FontText) a(R.id.tvHornoraryTitle);
                PatchProxyResult proxy = PatchProxy.proxy(new Object[]{str3, fontText2}, this, changeQuickRedirect, false, 277692, new Class[]{String.class, TextView.class}, String.class);
                if (proxy.isSupported) {
                    str = (String) proxy.result;
                } else {
                    String g3 = a.g("来自", str3, "的礼物");
                    int b2 = b.b((float) 180);
                    float measureText = fontText2.getPaint().measureText(g3);
                    while (measureText > ((float) b2)) {
                        String l = fd0.c.l(str3, i, 0);
                        int length = l.length() - i;
                        int i12 = 0;
                        boolean z = false;
                        while (i12 <= length) {
                            boolean z4 = Intrinsics.compare(l.charAt(!z ? i12 : length), 32) <= 0;
                            if (!z) {
                                if (!z4) {
                                    z = true;
                                } else {
                                    i12++;
                                }
                            } else if (!z4) {
                                break;
                            } else {
                                length--;
                            }
                        }
                        str3 = androidx.appcompat.widget.a.f(length, 1, l, i12);
                        g3 = a0.b.f("来自", str3, "...", "的礼物");
                        measureText = fontText2.getPaint().measureText(g3);
                        i = 1;
                    }
                    str = g3;
                }
                fontText.setText(str);
                ((FontText) a(R.id.tvHornoraryTitle)).setVisibility(0);
            }
            ((ImageView) a(R.id.goodTagView)).setVisibility((((FontText) a(R.id.tvHornoraryTitle)).getVisibility() == 0) ^ true ? 0 : 8);
            AppCompatTextView appCompatTextView = (AppCompatTextView) a(R.id.messageVerifyText);
            String d12 = cVar != null ? cVar.d() : null;
            appCompatTextView.setVisibility((d12 == null || d12.length() == 0) ^ true ? 0 : 8);
            AppCompatTextView appCompatTextView2 = (AppCompatTextView) a(R.id.messageVerifyText);
            String d13 = cVar != null ? cVar.d() : null;
            if (d13 == null) {
                d13 = str2;
            }
            appCompatTextView2.setText(d13);
            if (cVar == null || !cVar.n()) {
                ((co.c) ((DuImageLoaderView) a(R.id.bgCard)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product_detail/bg_own_detail_card_new.png").v(MyOwnActivity.f22821q.b())).x();
                ((DuImageLoaderView) a(R.id.ivPoizonTag)).setVisibility(8);
                Pair[] pairArr2 = new Pair[1];
                pairArr2[0] = new Pair("添加时间", cVar != null ? cVar.c() : null);
                pairArr = pairArr2;
            } else {
                ((co.c) ((DuImageLoaderView) a(R.id.bgCard)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product_detail/bg_own_detail_card_poizion_new.png").v(MyOwnActivity.f22821q.b())).x();
                ((DuImageLoaderView) a(R.id.ivPoizonTag)).setVisibility(0);
                ((DuImageLoaderView) a(R.id.ivPoizonTag)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product_detail/icon_detail_card_poizon_tag_new.png").p0(DuScaleType.FIT_XY).x();
                pairArr = new Pair[]{new Pair("收货人", cVar.a() + "  " + cVar.b()), new Pair("购入金额", cVar.h()), new Pair("下单时间", cVar.c())};
            }
            Pair<TextView, TextView>[] descViews = getDescViews();
            int length2 = descViews.length;
            int i13 = 0;
            int i14 = 0;
            while (i13 < length2) {
                Pair<TextView, TextView> pair = descViews[i13];
                int i15 = i14 + 1;
                TextView component1 = pair.component1();
                TextView component2 = pair.component2();
                Pair pair2 = (Pair) ArraysKt___ArraysKt.getOrNull(pairArr, i14);
                component1.setText(pair2 != null ? (String) pair2.getFirst() : null);
                CharSequence text = component1.getText();
                component1.setVisibility((text == null || text.length() == 0) ^ true ? 0 : 8);
                component2.setText(pair2 != null ? (String) pair2.getSecond() : null);
                CharSequence text2 = component2.getText();
                component2.setVisibility((text2 == null || text2.length() == 0) ^ true ? 0 : 8);
                i13++;
                i14 = i15;
            }
            ProductImageLoaderView productImageLoaderView = (ProductImageLoaderView) a(R.id.ivProduct);
            String f12 = cVar != null ? cVar.f() : null;
            if (f12 != null) {
                str2 = f12;
            }
            g.a(productImageLoaderView.i(str2), DrawableScale.OneToOne).x();
            AppCompatImageView appCompatImageView = this.e;
            if (!ViewCompat.isLaidOut(appCompatImageView) || appCompatImageView.isLayoutRequested()) {
                appCompatImageView.addOnLayoutChangeListener(new ExOwnSkuCardShareViewNew$update$$inlined$doOnLayout$1(this, cVar));
                return;
            }
            LifecycleOwner i16 = LifecycleExtensionKt.i(this);
            if (i16 != null && (lifecycleScope = LifecycleOwnerKt.getLifecycleScope(i16)) != null) {
                ik1.f.i(lifecycleScope, null, null, new ExOwnSkuCardShareViewNew$update$$inlined$doOnLayout$lambda$1(null, this, cVar), 3, null);
            }
        }
    }

    public void onMeasure(int i, int i3) {
        Object[] objArr = {new Integer(i), new Integer(i3)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Integer.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 277691, new Class[]{cls, cls}, Void.TYPE).isSupported) {
            super.onMeasure(i, View.MeasureSpec.makeMeasureSpec(0, 0));
        }
    }
}