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


package com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion;

import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
import androidx.lifecycle.Observer;
import androidx.lifecycle.OnLifecycleEvent;
import androidx.lifecycle.ViewModelLazy;
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.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.modules.du_mall_common.extension.ViewExtensionKt;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmDetailInfoModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.model.PmThreeDimensionItemModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.views.PmHeaderView;
import com.shizhuang.duapp.modules.product_detail.detailv3.vm.PmViewModel;
import fi.b;
import java.util.HashMap;
import kotlin.Lazy;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Reflection;
import org.jetbrains.annotations.NotNull;
import s01.d;
import s01.j;
import s01.o;
import s01.p;
import u21.a;

@Metadata(bv = {}, d1 = {"\u0000\u0014\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u00012\u00020\u0002J\b\u0010\u0004\u001a\u00020\u0003H\u0007¨\u0006\u0005"}, d2 = {"Lcom/shizhuang/duapp/modules/product_detail/detailv3/threedimesion/PmHeaderThreeDController;", "Ls01/d;", "Landroidx/lifecycle/LifecycleObserver;", "", "onDestroy", "du_product_detail_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: PmHeaderThreeDController.kt */
public final class PmHeaderThreeDController extends d implements LifecycleObserver {
    public static ChangeQuickRedirect changeQuickRedirect;
    public final Lazy e;
    public final Lazy f;

    /* renamed from: g  reason: collision with root package name */
    public final co.d f22174g;

    /* renamed from: h  reason: collision with root package name */
    public boolean f22175h;
    public boolean i;
    @NotNull
    public final PmHeaderView j;
    @NotNull
    public final PmThreeDimensionItemModel k;
    public HashMap l;

    public PmHeaderThreeDController(@NotNull final AppCompatActivity appCompatActivity, @NotNull PmHeaderView pmHeaderView, @NotNull PmThreeDimensionItemModel pmThreeDimensionItemModel) {
        super(appCompatActivity, pmHeaderView);
        this.j = pmHeaderView;
        this.k = pmThreeDimensionItemModel;
        this.e = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PmViewModel.class), new PmHeaderThreeDController$$special$$inlined$viewModels$2(appCompatActivity), new PmHeaderThreeDController$$special$$inlined$viewModels$1(appCompatActivity));
        this.f = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PmThreeDimensionViewModel.class), new PmHeaderThreeDController$$special$$inlined$viewModels$4(appCompatActivity), new PmHeaderThreeDController$$special$$inlined$viewModels$3(appCompatActivity));
        float f12 = (float) 20;
        this.f22174g = new co.d(b.b(f12), b.b(f12));
        appCompatActivity.getLifecycle().addObserver(this);
        j();
        ((LinearLayout) e(R.id.lay3dButton)).setVisibility(0);
        ((LinearLayout) e(R.id.lay3dButton)).setEnabled(true);
        ViewExtensionKt.e((LinearLayout) e(R.id.lay3dButton), 0, new Function1<View, Unit>(this) {
            /* class com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmHeaderThreeDController.AnonymousClass1 */
            public static ChangeQuickRedirect changeQuickRedirect;
            public final /* synthetic */ PmHeaderThreeDController this$0;

            {
                this.this$0 = r1;
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // kotlin.jvm.functions.Function1
            public /* bridge */ /* synthetic */ Unit invoke(View view) {
                invoke(view);
                return Unit.INSTANCE;
            }

            public final void invoke(@NotNull View view) {
                PmHeaderView pmHeaderView;
                PmThreeDimensionItemModel pmThreeDimensionItemModel;
                o a5;
                if (!PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 269460, new Class[]{View.class}, Void.TYPE).isSupported) {
                    a aVar = a.f38776a;
                    Integer valueOf = Integer.valueOf(this.this$0.b());
                    Long valueOf2 = Long.valueOf(this.this$0.i().getSpuId());
                    PmHeaderThreeDController pmHeaderThreeDController = this.this$0;
                    PatchProxyResult proxy = PatchProxy.proxy(new Object[0], pmHeaderThreeDController, PmHeaderThreeDController.changeQuickRedirect, false, 269452, new Class[0], PmHeaderView.class);
                    if (proxy.isSupported) {
                        pmHeaderView = (PmHeaderView) proxy.result;
                    } else {
                        pmHeaderView = pmHeaderThreeDController.j;
                    }
                    aVar.N("", "3D空间", valueOf, valueOf2, "", Integer.valueOf(pmHeaderView.getBlockPosition()), Long.valueOf(this.this$0.g()), Integer.valueOf(this.this$0.i().k().O()));
                    PmHeaderThreeDController pmHeaderThreeDController2 = this.this$0;
                    pmHeaderThreeDController2.f22175h = true;
                    j c5 = pmHeaderThreeDController2.h().c();
                    if (c5 == null || (a5 = c5.a()) == null || a5.b() != this.this$0.i().getSpuId()) {
                        this.this$0.f();
                    }
                    PmThreeDimensionViewModel h12 = this.this$0.h();
                    AppCompatActivity appCompatActivity = appCompatActivity;
                    PmHeaderThreeDController pmHeaderThreeDController3 = this.this$0;
                    PatchProxyResult proxy2 = PatchProxy.proxy(new Object[0], pmHeaderThreeDController3, PmHeaderThreeDController.changeQuickRedirect, false, 269453, new Class[0], PmThreeDimensionItemModel.class);
                    if (proxy2.isSupported) {
                        pmThreeDimensionItemModel = (PmThreeDimensionItemModel) proxy2.result;
                    } else {
                        pmThreeDimensionItemModel = pmHeaderThreeDController3.k;
                    }
                    h12.h(appCompatActivity, 2, Boolean.FALSE, pmThreeDimensionItemModel.isMultiMesh());
                }
            }
        }, 1);
        f();
        h().e().observe(appCompatActivity, new Observer<p>(this) {
            /* class com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmHeaderThreeDController.AnonymousClass2 */
            public static ChangeQuickRedirect changeQuickRedirect;
            public final /* synthetic */ PmHeaderThreeDController b;

            {
                this.b = r1;
            }

            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // androidx.lifecycle.Observer
            public void onChanged(p pVar) {
                j c5;
                o a5;
                p pVar2 = pVar;
                if (!PatchProxy.proxy(new Object[]{pVar2}, this, changeQuickRedirect, false, 269461, new Class[]{p.class}, Void.TYPE).isSupported && pVar2 != null && (c5 = this.b.h().c()) != null && (a5 = c5.a()) != null && a5.b() == this.b.i().getSpuId()) {
                    if (pVar2 instanceof p.b) {
                        ((LinearLayout) this.b.e(R.id.lay3dButton)).setEnabled(false);
                        PmHeaderThreeDController pmHeaderThreeDController = this.b;
                        if (pmHeaderThreeDController.f22175h) {
                            StringBuilder sb2 = new StringBuilder();
                            sb2.append(((p.b) pVar2).a());
                            sb2.append('%');
                            ((TextView) pmHeaderThreeDController.e(R.id.item3dButton)).setText(sb2.toString());
                            PmHeaderThreeDController pmHeaderThreeDController2 = this.b;
                            if (!PatchProxy.proxy(new Object[0], pmHeaderThreeDController2, PmHeaderThreeDController.changeQuickRedirect, false, 269450, new Class[0], Void.TYPE).isSupported && !pmHeaderThreeDController2.i) {
                                pmHeaderThreeDController2.i = true;
                                ((c) ((DuImageLoaderView) pmHeaderThreeDController2.e(R.id.item3dIcon)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/ic_three_d_loading.webp").v(pmHeaderThreeDController2.f22174g)).x();
                                return;
                            }
                            return;
                        }
                        return;
                    }
                    PmHeaderThreeDController pmHeaderThreeDController3 = this.b;
                    pmHeaderThreeDController3.f22175h = false;
                    ((LinearLayout) pmHeaderThreeDController3.e(R.id.lay3dButton)).setEnabled(true);
                    ((TextView) this.b.e(R.id.item3dButton)).setText(R.string.good_detail_3d);
                    this.b.j();
                }
            }
        });
    }

    @Override // s01.d
    public void c(boolean z) {
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 269447, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            super.c(z);
            LinearLayout linearLayout = (LinearLayout) e(R.id.lay3dButton);
            if (!z) {
                i3 = 8;
            }
            linearLayout.setVisibility(i3);
        }
    }

    public View e(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 269454, new Class[]{Integer.TYPE}, View.class);
        if (proxy.isSupported) {
            return (View) proxy.result;
        }
        if (this.l == null) {
            this.l = new HashMap();
        }
        View view = (View) this.l.get(Integer.valueOf(i3));
        if (view != null) {
            return view;
        }
        View containerView = getContainerView();
        if (containerView == null) {
            return null;
        }
        View findViewById = containerView.findViewById(i3);
        this.l.put(Integer.valueOf(i3), findViewById);
        return findViewById;
    }

    public final void f() {
        String str;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269446, new Class[0], Void.TYPE).isSupported) {
            PmDetailInfoModel value = i().g().getValue();
            if (value == null || (str = value.getArticleNumber()) == null) {
                str = "";
            }
            h().a(i().getSpuId(), str, this.k.getObjFileUrl(), this.k.getCoverUrl(), this.k.getKey());
        }
    }

    public final long g() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269449, new Class[0], Long.TYPE);
        return proxy.isSupported ? ((Long) proxy.result).longValue() : this.k.getPropertyValueId();
    }

    public final PmThreeDimensionViewModel h() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269445, new Class[0], PmThreeDimensionViewModel.class);
        return (PmThreeDimensionViewModel) (proxy.isSupported ? proxy.result : this.f.getValue());
    }

    public final PmViewModel i() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269444, new Class[0], PmViewModel.class);
        return (PmViewModel) (proxy.isSupported ? proxy.result : this.e.getValue());
    }

    public final void j() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269451, new Class[0], Void.TYPE).isSupported) {
            this.i = false;
            ((c) ((DuImageLoaderView) e(R.id.item3dIcon)).i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/ic_three_d_normal.png").v(this.f22174g)).x();
        }
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
    public final void onDestroy() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 269448, new Class[0], Void.TYPE).isSupported) {
            h().b();
            ((LinearLayout) e(R.id.lay3dButton)).setVisibility(8);
            a().getLifecycle().removeObserver(this);
        }
    }
}