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


package com.shizhuang.duapp.modules.product_detail.own.views;

import android.content.Context;
import android.util.ArrayMap;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.lifecycle.ViewModelLazy;
import cd.h;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
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.AbsModuleView;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.libs.animation.DuAnimationView;
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.du_mall_common.utils.exposure.callback.IMallViewExposureObserver;
import com.shizhuang.duapp.modules.product_detail.own.model.MyOwnTopModel;
import com.shizhuang.duapp.modules.product_detail.own.vm.MyOwnViewModel;
import df.q0;
import i60.b;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.Triple;
import kotlin.Unit;
import kotlin.collections.CollectionsKt__CollectionsKt;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.JvmOverloads;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt__StringsKt;
import l60.c;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import u21.a;

@Metadata(bv = {}, d1 = {"\u00008\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u00002\b\u0012\u0004\u0012\u00020\u00020\u00012\u00020\u00032\u00020\u0004B'\b\u0007\u0012\u0006\u0010\u0011\u001a\u00020\u0010\u0012\n\b\u0002\u0010\u0013\u001a\u0004\u0018\u00010\u0012\u0012\b\b\u0002\u0010\u0014\u001a\u00020\u0005¢\u0006\u0004\b\u0015\u0010\u0016J\b\u0010\u0006\u001a\u00020\u0005H\u0016J\b\u0010\b\u001a\u00020\u0007H\u0007J\b\u0010\t\u001a\u00020\u0007H\u0007R\u001b\u0010\u000f\u001a\u00020\n8BX‚„\u0002¢\u0006\f\n\u0004\b\u000b\u0010\f\u001a\u0004\b\r\u0010\u000e¨\u0006\u0017"}, d2 = {"Lcom/shizhuang/duapp/modules/product_detail/own/views/MyOwnTopViewV2;", "Lcom/shizhuang/duapp/common/component/module/AbsModuleView;", "Lcom/shizhuang/duapp/modules/product_detail/own/model/MyOwnTopModel;", "Lcom/shizhuang/duapp/modules/du_mall_common/utils/exposure/callback/IMallViewExposureObserver;", "Landroidx/lifecycle/LifecycleObserver;", "", "getLayoutId", "", "onPause", "onResume", "Lcom/shizhuang/duapp/modules/product_detail/own/vm/MyOwnViewModel;", "b", "Lkotlin/Lazy;", "getViewModel", "()Lcom/shizhuang/duapp/modules/product_detail/own/vm/MyOwnViewModel;", "viewModel", "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: MyOwnTopViewV2.kt */
public final class MyOwnTopViewV2 extends AbsModuleView<MyOwnTopModel> implements IMallViewExposureObserver, LifecycleObserver {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final Lazy b;

    /* renamed from: c  reason: collision with root package name */
    public boolean f22862c;
    public String d;
    public HashMap e;

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

    @JvmOverloads
    public MyOwnTopViewV2(@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 */ MyOwnTopViewV2(Context context, AttributeSet attributeSet, int i, int i3) {
        this(context, (i3 & 2) != 0 ? null : attributeSet, (i3 & 4) != 0 ? 0 : i);
    }

    public static /* synthetic */ void b(MyOwnTopViewV2 myOwnTopViewV2, TextView textView, float f, String str, int i, float f12, String str2, int i3) {
        myOwnTopViewV2.a(textView, f, str, i, (i3 & 16) != 0 ? 1.0f : f12, (i3 & 32) != 0 ? "" : null);
    }

    private final MyOwnViewModel getViewModel() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280862, new Class[0], MyOwnViewModel.class);
        return (MyOwnViewModel) (proxy.isSupported ? proxy.result : this.b.getValue());
    }

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

    public final void a(TextView textView, float f, String str, int i, float f12, String str2) {
        String str3;
        Object[] objArr = {textView, new Float(f), str, new Integer(i), new Float(f12), str2};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Float.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 280872, new Class[]{TextView.class, cls, String.class, Integer.TYPE, cls, String.class}, Void.TYPE).isSupported) {
            List split$default = StringsKt__StringsKt.split$default((CharSequence) str, new String[]{String.valueOf(i)}, false, 0, 6, (Object) null);
            if (split$default.size() == 2) {
                if (i > 9999) {
                    str3 = "9999+";
                } else {
                    str3 = String.valueOf(i);
                }
                q0 a5 = new q0(textView, true).d(f).a((CharSequence) split$default.get(0), new Object[0]);
                q0.a aVar = q0.d;
                a5.a(str3, q0.a.f(aVar, getContext(), null, 2), aVar.c(f12)).a((CharSequence) split$default.get(1), new Object[0]).a(str2, new Object[0]).b();
                return;
            }
            textView.setText(str);
        }
    }

    public final void c(MyOwnTopModel myOwnTopModel) {
        if (!PatchProxy.proxy(new Object[]{myOwnTopModel}, this, changeQuickRedirect, false, 280866, new Class[]{MyOwnTopModel.class}, Void.TYPE).isSupported) {
            boolean isShoes = myOwnTopModel.isShoes();
            MyOwnTopViewV2$playAnimation$1 myOwnTopViewV2$playAnimation$1 = new MyOwnTopViewV2$playAnimation$1(this, myOwnTopModel);
            if (!PatchProxy.proxy(new Object[]{new Byte(isShoes ? (byte) 1 : 0), myOwnTopViewV2$playAnimation$1}, this, changeQuickRedirect, false, 280867, new Class[]{Boolean.TYPE, Function0.class}, Void.TYPE).isSupported) {
                String str = isShoes ? "https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/video_my_own_open_shoe1.mp4" : "https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/video_my_own_open_cloth1.mp4";
                if (!this.f22862c) {
                    this.f22862c = true;
                    DuAnimationView k = ((DuAnimationView) _$_findCachedViewById(R.id.openAnimationView)).F(str).k(false);
                    PatchProxyResult proxy = PatchProxy.proxy(new Object[]{"https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/bg_my_own_top_animation_placeholder.png", DuScaleType.FIT_CENTER}, k, DuAnimationView.changeQuickRedirect, false, 18740, new Class[]{String.class, DuScaleType.class}, DuAnimationView.class);
                    if (proxy.isSupported) {
                        k = (DuAnimationView) proxy.result;
                    } else {
                        k.d = "https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/bg_my_own_top_animation_placeholder.png";
                    }
                    LifecycleOwner i = LifecycleExtensionKt.i(this);
                    if (i == null) {
                        i = ViewExtensionKt.g(this);
                    }
                    k.j(i).D(true).m(new MyOwnTopViewV2$playOpenAnimation$1(myOwnTopViewV2$playAnimation$1)).s();
                    return;
                }
                Unit unit = (Unit) myOwnTopViewV2$playAnimation$1.invoke();
            }
        }
    }

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

    public void onAttachedToWindow() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280865, new Class[0], Void.TYPE).isSupported) {
            super.onAttachedToWindow();
            MyOwnTopModel myOwnTopModel = (MyOwnTopModel) getData();
            if (myOwnTopModel != null) {
                c(myOwnTopModel);
            }
        }
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    @Override // com.shizhuang.duapp.common.component.module.AbsModuleView
    public void onChanged(MyOwnTopModel myOwnTopModel) {
        String str;
        String str2;
        Triple triple;
        Pair pair;
        MyOwnTopModel myOwnTopModel2 = myOwnTopModel;
        if (!PatchProxy.proxy(new Object[]{myOwnTopModel2}, this, changeQuickRedirect, false, 280864, new Class[]{MyOwnTopModel.class}, Void.TYPE).isSupported) {
            super.update(myOwnTopModel2);
            ((DuImageLoaderView) _$_findCachedViewById(R.id.ivBackground)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/product/bg_my_own_top.png").x();
            ((TextView) _$_findCachedViewById(R.id.tvOwnTitle)).getPaint().setFakeBoldText(true);
            TextView textView = (TextView) _$_findCachedViewById(R.id.tvOwnTitle);
            float f = myOwnTopModel2.getMyOwnValues() > 0 ? 12.0f : 14.0f;
            String myOwnTitle = myOwnTopModel2.getMyOwnTitle();
            b(this, textView, f, myOwnTitle != null ? myOwnTitle : "", myOwnTopModel2.getMyOwnCount(), myOwnTopModel2.getMyOwnValues() > 0 ? 1.83f : 2.57f, null, 32);
            if (myOwnTopModel2.getMyOwnValues() > 0) {
                TextView textView2 = (TextView) _$_findCachedViewById(R.id.tvOwnValues);
                long myOwnValues = myOwnTopModel2.getMyOwnValues();
                Object[] objArr = {new Long(myOwnValues)};
                ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
                Class cls = Long.TYPE;
                PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 280870, new Class[]{cls}, Triple.class);
                if (proxy.isSupported) {
                    triple = (Triple) proxy.result;
                } else {
                    PatchProxyResult proxy2 = PatchProxy.proxy(new Object[]{new Long(myOwnValues)}, this, changeQuickRedirect, false, 280871, new Class[]{cls}, Pair.class);
                    if (proxy2.isSupported) {
                        pair = (Pair) proxy2.result;
                    } else if (myOwnValues < ((long) 10000)) {
                        pair = new Pair(String.valueOf(myOwnValues), "");
                    } else if (myOwnValues >= ((long) 100000000)) {
                        StringCompanionObject stringCompanionObject = StringCompanionObject.INSTANCE;
                        pair = new Pair(String.format("%.1f", Arrays.copyOf(new Object[]{Float.valueOf(((float) myOwnValues) / 1.0E8f)}, 1)), " 亿");
                    } else {
                        StringCompanionObject stringCompanionObject2 = StringCompanionObject.INSTANCE;
                        pair = new Pair(String.format("%.1f", Arrays.copyOf(new Object[]{Float.valueOf(((float) myOwnValues) / 10000.0f)}, 1)), " 万");
                    }
                    triple = new Triple("¥", (String) pair.getFirst(), (String) pair.getSecond());
                }
                if (!PatchProxy.proxy(new Object[]{textView2, triple}, this, changeQuickRedirect, false, 280869, new Class[]{TextView.class, Triple.class}, Void.TYPE).isSupported) {
                    textView2.getPaint().setFakeBoldText(true);
                    textView2.setVisibility(0);
                    q0.a aVar = q0.d;
                    new q0(textView2, true).d(12.0f).a("总价值约", new Object[0]).a((CharSequence) triple.getFirst(), q0.a.f(aVar, getContext(), null, 2), aVar.c(1.1f)).a((CharSequence) triple.getSecond(), q0.a.f(aVar, getContext(), null, 2), aVar.c(1.83f)).a((CharSequence) triple.getThird(), q0.a.f(aVar, getContext(), null, 2), aVar.c(1.1f)).b();
                }
            } else {
                ((TextView) _$_findCachedViewById(R.id.tvOwnValues)).setVisibility(8);
            }
            TextView textView3 = (TextView) _$_findCachedViewById(R.id.tvOwnDesc1);
            String c1Name = myOwnTopModel2.getC1Name();
            if (c1Name != null) {
                str = c1Name;
            } else {
                str = "";
            }
            a(textView3, 11.0f, str, myOwnTopModel2.getC1Count(), 1.19f, ",");
            TextView textView4 = (TextView) _$_findCachedViewById(R.id.tvOwnDesc2);
            String brandName = myOwnTopModel2.getBrandName();
            if (brandName != null) {
                str2 = brandName;
            } else {
                str2 = "";
            }
            b(this, textView4, 11.0f, str2, myOwnTopModel2.getBrandCount(), 1.19f, null, 32);
            if (isAttachedToWindow()) {
                c(myOwnTopModel2);
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.exposure.callback.IMallViewExposureObserver
    public void onExposure() {
        MyOwnTopModel myOwnTopModel;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280873, new Class[0], Void.TYPE).isSupported && (myOwnTopModel = (MyOwnTopModel) getData()) != null) {
            a aVar = a.f38776a;
            String[] strArr = new String[3];
            String myOwnTitle = myOwnTopModel.getMyOwnTitle();
            if (myOwnTitle == null) {
                myOwnTitle = "";
            }
            strArr[0] = myOwnTitle;
            String c1Name = myOwnTopModel.getC1Name();
            if (c1Name == null) {
                c1Name = "";
            }
            strArr[1] = c1Name;
            String brandName = myOwnTopModel.getBrandName();
            if (brandName == null) {
                brandName = "";
            }
            strArr[2] = brandName;
            String joinToString$default = CollectionsKt___CollectionsKt.joinToString$default(CollectionsKt__CollectionsKt.listOf((Object[]) strArr), ",", null, null, 0, null, null, 62, null);
            if (!PatchProxy.proxy(new Object[]{joinToString$default, "", ""}, aVar, a.changeQuickRedirect, false, 282194, new Class[]{Object.class, Object.class, Object.class}, Void.TYPE).isSupported) {
                b bVar = b.f33293a;
                ArrayMap e6 = g.a.e(8, "block_content_title", joinToString$default, "category_lv1_title", "");
                e6.put("brand_title", "");
                bVar.b("trade_common_exposure", "1016", "2550", e6);
            }
        }
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    public final void onPause() {
        boolean z = false;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280874, new Class[0], Void.TYPE).isSupported) {
            if (((DuAnimationView) _$_findCachedViewById(R.id.repeatAnimationView)).getVisibility() == 0) {
                z = true;
            }
            if (z) {
                ((DuAnimationView) _$_findCachedViewById(R.id.repeatAnimationView)).E();
            }
        }
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    public final void onResume() {
        boolean z = false;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 280875, new Class[0], Void.TYPE).isSupported) {
            if (((DuAnimationView) _$_findCachedViewById(R.id.repeatAnimationView)).getVisibility() == 0) {
                z = true;
            }
            if (z) {
                ((DuAnimationView) _$_findCachedViewById(R.id.repeatAnimationView)).s();
            }
        }
    }

    @JvmOverloads
    public MyOwnTopViewV2(@NotNull Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        AppCompatActivity g3 = ViewExtensionKt.g(this);
        this.b = new ViewModelLazy(Reflection.getOrCreateKotlinClass(MyOwnViewModel.class), new MyOwnTopViewV2$$special$$inlined$activityViewModels$2(g3), new MyOwnTopViewV2$$special$$inlined$activityViewModels$1(g3));
        ((GenericDraweeHierarchy) ((DuImageLoaderView) _$_findCachedViewById(R.id.ivBackground)).getHierarchy()).setActualImageScaleType(c.f35032a);
        LifecycleOwner e6 = h.e(this);
        if (e6 != null) {
            e6.getLifecycle().addObserver(this);
            getViewModel().g().observe(e6, new MyOwnTopViewV2$$special$$inlined$let$lambda$1(this));
        }
        this.d = "";
    }
}