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


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

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.ValueAnimator;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.util.Property;
import android.view.View;
import android.view.ViewStub;
import android.widget.FrameLayout;
import android.widget.ImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewKt;
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.common.event.FavoriteChangeEvent;
import com.shizhuang.duapp.common.ui.BaseActivity;
import com.shizhuang.duapp.common.utils.livebus.PageEventBus;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.libs.duimageloaderview.options.DuScaleType;
import com.shizhuang.duapp.modules.du_mall_common.clothes3d.PanoramaImageView;
import com.shizhuang.duapp.modules.du_mall_common.widget.ar_3d.Mall3dArShareIconTipsPop;
import com.shizhuang.duapp.modules.product_detail.detailv3.helper.PmTDSpaceSpuListHelper;
import com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmClothesThreeDHelper;
import com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmPanoramaViewModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmTDSpaceDataViewModel;
import com.shizhuang.duapp.modules.product_detail.detailv3.threedimesion.PmThreeDimensionHelper;
import com.shizhuang.duapp.modules.product_detail.detailv3.vm.PmFocusMapViewModel;
import fi.b;
import fj1.a;
import java.util.HashMap;
import java.util.List;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Reflection;
import o5.i;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import q01.s;
import s01.e;

@Metadata(bv = {}, d1 = {"\u0000\u0016\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\u0018\u00002\u00020\u0001J\u0010\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0007¨\u0006\u0006"}, d2 = {"Lcom/shizhuang/duapp/modules/product_detail/detailv3/callbacks/Pm360Callback;", "Lcom/shizhuang/duapp/modules/product_detail/detailv3/callbacks/PmBaseViewCallback;", "Lcom/shizhuang/duapp/common/event/FavoriteChangeEvent;", "event", "", "onFavoriteChange", "du_product_detail_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: Pm360Callback.kt */
public final class Pm360Callback extends PmBaseViewCallback {
    public static ChangeQuickRedirect changeQuickRedirect;

    /* renamed from: g  reason: collision with root package name */
    public boolean f21952g;

    /* renamed from: h  reason: collision with root package name */
    public boolean f21953h;
    public final Lazy i;
    public final Lazy j;
    public final Lazy k;
    public boolean l;
    public Bitmap m;
    public final Lazy n = LazyKt__LazyJVMKt.lazy(new Pm360Callback$shareIconTipsPop$2(this));
    public final Lazy o = LazyKt__LazyJVMKt.lazy(new Pm360Callback$mClothesThreeDHelper$2(this));
    public final Lazy p = LazyKt__LazyJVMKt.lazy(Pm360Callback$compositeDisposable$2.INSTANCE);

    /* renamed from: q  reason: collision with root package name */
    public final ViewStub f21954q;
    public boolean r;
    public PmTDSpaceSpuListHelper s;
    public final PmThreeDimensionHelper.OnThreeDimensionCallback t;
    @NotNull

    /* renamed from: u  reason: collision with root package name */
    public final BaseActivity f21955u;

    /* renamed from: v  reason: collision with root package name */
    public HashMap f21956v;

    public Pm360Callback(@NotNull BaseActivity baseActivity) {
        super(baseActivity);
        this.f21955u = baseActivity;
        this.i = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PmFocusMapViewModel.class), new Pm360Callback$$special$$inlined$viewModels$2(baseActivity), new Pm360Callback$$special$$inlined$viewModels$1(baseActivity));
        this.j = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PmPanoramaViewModel.class), new Pm360Callback$$special$$inlined$viewModels$4(baseActivity), new Pm360Callback$$special$$inlined$viewModels$3(baseActivity));
        this.k = new ViewModelLazy(Reflection.getOrCreateKotlinClass(PmTDSpaceDataViewModel.class), new Pm360Callback$$special$$inlined$viewModels$6(baseActivity), new Pm360Callback$$special$$inlined$viewModels$5(baseActivity));
        this.f21954q = (ViewStub) baseActivity.findViewById(R.id.cover360Stub);
        this.t = new Pm360Callback$threeDimensionCallback$1(this);
    }

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

    public final Animator e(boolean z) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 262228, new Class[]{Boolean.TYPE}, Animator.class);
        if (proxy.isSupported) {
            return (Animator) proxy.result;
        }
        int i3 = b.i(this.f13641c);
        int f = b.f(this.f13641c);
        ((FrameLayout) d(R.id.leftLayout)).setVisibility(0);
        float f12 = (float) i3;
        ((FrameLayout) d(R.id.leftLayout)).setPivotX(f12);
        ((FrameLayout) d(R.id.leftLayout)).setPivotY(((float) f) / ((float) 2));
        ((FrameLayout) d(R.id.leftLayout)).setCameraDistance(((float) 10) * f12);
        ((ConstraintLayout) d(R.id.mainContent)).setPivotX(i.f36333a);
        ((ConstraintLayout) d(R.id.mainContent)).setPivotY((float) (((ConstraintLayout) d(R.id.mainContent)).getHeight() / 2));
        ((ConstraintLayout) d(R.id.mainContent)).setCameraDistance((float) (((ConstraintLayout) d(R.id.mainContent)).getWidth() * 10));
        float b = (float) b.b((float) 40);
        Animator i12 = i((ConstraintLayout) d(R.id.mainContent), z, i.f36333a, 75.0f, i.f36333a, b);
        Animator i13 = i((FrameLayout) d(R.id.leftLayout), z, -75.0f, i.f36333a, -f12, b - f12);
        Animator g3 = g(d(R.id.mainContentMask), z, i.f36333a, 0.3f);
        g3.setDuration(500);
        Animator g6 = g(d(R.id.leftLayoutMask), z, 1.0f, 0.1f);
        g6.setDuration(500);
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.playTogether(i12, i13, g3, g6);
        animatorSet.setDuration(500L);
        return animatorSet;
    }

    public final void f(boolean z) {
        boolean z4 = true;
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 262223, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported && this.r) {
            ((ImageView) d(R.id.iv360Favorite)).setVisibility(z && !this.f21953h ? 0 : 8);
            ImageView imageView = (ImageView) d(R.id.iv360Buy);
            if (!z || !o().k()) {
                z4 = false;
            }
            if (!z4) {
                i3 = 8;
            }
            imageView.setVisibility(i3);
            n().e();
        }
    }

    public final Animator g(View view, boolean z, float f, float f12) {
        Object[] objArr = {view, new Byte(z ? (byte) 1 : 0), new Float(f), new Float(f12)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Float.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 262227, new Class[]{View.class, Boolean.TYPE, cls, cls}, Animator.class);
        if (proxy.isSupported) {
            return (Animator) proxy.result;
        }
        return ObjectAnimator.ofPropertyValuesHolder(view, h(z, View.ALPHA, f, f12));
    }

    public final PropertyValuesHolder h(boolean z, Property<?, Float> property, float f, float f12) {
        Object[] objArr = {new Byte(z ? (byte) 1 : 0), property, new Float(f), new Float(f12)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Float.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 262225, new Class[]{Boolean.TYPE, Property.class, cls, cls}, PropertyValuesHolder.class);
        if (proxy.isSupported) {
            return (PropertyValuesHolder) proxy.result;
        }
        if (z) {
            return PropertyValuesHolder.ofFloat(property, f, f12);
        }
        return PropertyValuesHolder.ofFloat(property, f12, f);
    }

    public final Animator i(View view, boolean z, float f, float f12, float f13, float f14) {
        Object[] objArr = {view, new Byte(z ? (byte) 1 : 0), new Float(f), new Float(f12), new Float(f13), new Float(f14)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Float.TYPE;
        PatchProxyResult proxy = PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 262226, new Class[]{View.class, Boolean.TYPE, cls, cls, cls, cls}, Animator.class);
        if (proxy.isSupported) {
            return (Animator) proxy.result;
        }
        ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(view, h(z, View.ROTATION_Y, f, f12), h(z, View.TRANSLATION_X, f13, f14));
        ofPropertyValuesHolder.setDuration(500L);
        ofPropertyValuesHolder.setInterpolator(null);
        return ofPropertyValuesHolder;
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public void initData() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262214, new Class[0], Void.TYPE).isSupported) {
            super.initData();
            PageEventBus.h(this.f13641c).a(s.class).observe(this.f13641c, new Pm360Callback$initData$1(this));
            m().c().observe(this.f13641c, new Pm360Callback$initData$2(this));
            m().getLoadStatus().observe(this.f13641c, new Pm360Callback$initData$3(this));
            o().getModel().observe(this.f13641c, new Pm360Callback$initData$4(this));
            o().e().observe(this.f13641c, new Pm360Callback$initData$5(this));
        }
    }

    public final a j() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262211, new Class[0], a.class);
        return (a) (proxy.isSupported ? proxy.result : this.p.getValue());
    }

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

    public final PmClothesThreeDHelper l() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262210, new Class[0], PmClothesThreeDHelper.class);
        return (PmClothesThreeDHelper) (proxy.isSupported ? proxy.result : this.o.getValue());
    }

    public final PmPanoramaViewModel m() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262207, new Class[0], PmPanoramaViewModel.class);
        return (PmPanoramaViewModel) (proxy.isSupported ? proxy.result : this.j.getValue());
    }

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

    public final PmTDSpaceDataViewModel o() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262208, new Class[0], PmTDSpaceDataViewModel.class);
        return (PmTDSpaceDataViewModel) (proxy.isSupported ? proxy.result : this.k.getValue());
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public boolean onBackPressed() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262232, new Class[0], Boolean.TYPE);
        if (proxy.isSupported) {
            return ((Boolean) proxy.result).booleanValue();
        }
        if (this.f21952g) {
            this.f21952g = false;
            p();
            j().dispose();
            return true;
        } else if (!Intrinsics.areEqual(k().c().getValue(), Boolean.TRUE)) {
            return super.onBackPressed();
        } else {
            k().c().setValue(Boolean.FALSE);
            return true;
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public void onCreate() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262230, new Class[0], Void.TYPE).isSupported) {
            super.onCreate();
            EventBus.b().k(this);
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public void onDestroy() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262235, new Class[0], Void.TYPE).isSupported) {
            super.onDestroy();
            j().dispose();
            if (this.r) {
                n().c();
            }
            EventBus.b().n(this);
        }
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public final void onFavoriteChange(@NotNull FavoriteChangeEvent favoriteChangeEvent) {
        ImageView imageView;
        boolean z = true;
        if (!PatchProxy.proxy(new Object[]{favoriteChangeEvent}, this, changeQuickRedirect, false, 262231, new Class[]{FavoriteChangeEvent.class}, Void.TYPE).isSupported && favoriteChangeEvent.getSpuId() == o().getSpuId() && (imageView = (ImageView) d(R.id.iv360Favorite)) != null) {
            if (favoriteChangeEvent.getFavoriteCount() <= 0) {
                z = false;
            }
            imageView.setSelected(z);
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public void onPause() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262234, new Class[0], Void.TYPE).isSupported) {
            super.onPause();
            View childAt = ((FrameLayout) d(R.id.layFullscreen)).getChildAt(0);
            if (childAt instanceof PanoramaImageView) {
                ((PanoramaImageView) childAt).setPauseRotate(true);
            }
        }
    }

    @Override // com.shizhuang.duapp.modules.du_mall_common.utils.page.PageViewCallback, com.shizhuang.duapp.modules.du_mall_common.utils.page.IPageViewCallback
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262233, new Class[0], Void.TYPE).isSupported) {
            super.onResume();
            View childAt = ((FrameLayout) d(R.id.layFullscreen)).getChildAt(0);
            if (childAt instanceof PanoramaImageView) {
                ((PanoramaImageView) childAt).setPauseRotate(false);
            }
        }
    }

    /* JADX WARN: Type inference failed for: r1v4, types: [byte, boolean] */
    /* JADX WARN: Type inference failed for: r1v6 */
    /* JADX WARN: Type inference failed for: r1v7 */
    /* JADX WARNING: Unknown variable types count: 1 */
    public final void p() {
        s01.a value;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 262221, new Class[0], Void.TYPE).isSupported) {
            if (this.l) {
                PmClothesThreeDHelper l12 = l();
                ?? r12 = c().getSpuId() != o().getSpuId() ? 1 : 0;
                byte b = r12 == true ? (byte) 1 : 0;
                byte b2 = r12 == true ? (byte) 1 : 0;
                byte b5 = r12 == true ? (byte) 1 : 0;
                Object[] objArr = {new Byte(b)};
                ChangeQuickRedirect changeQuickRedirect2 = PmClothesThreeDHelper.changeQuickRedirect;
                Class cls = Boolean.TYPE;
                if (!PatchProxy.proxy(objArr, l12, changeQuickRedirect2, false, 269378, new Class[]{cls}, Void.TYPE).isSupported) {
                    PmThreeDimensionHelper.OnThreeDimensionCallback onThreeDimensionCallback = l12.f22164a;
                    if (onThreeDimensionCallback != null) {
                        onThreeDimensionCallback.onThreeDimensionExit(500);
                    }
                    l12.d.postDelayed(new e(l12), 500);
                    PmPanoramaViewModel b12 = l12.b();
                    if (!PatchProxy.proxy(new Object[]{new Byte((byte) r12)}, b12, PmPanoramaViewModel.changeQuickRedirect, false, 269498, new Class[]{cls}, Void.TYPE).isSupported && (value = b12.f.getValue()) != null) {
                        b12.f.postValue(new s01.a(false, value.a(), r12));
                    }
                }
                this.l = false;
                o().a(PmTDSpaceDataViewModel.TDSpaceSwitchState.INITIAL);
            }
            this.f21954q.setVisibility(8);
            if (this.r) {
                ((ImageView) d(R.id.iv360Back)).setVisibility(8);
                ((ImageView) d(R.id.iv360Share)).setVisibility(8);
                ((ImageView) d(R.id.iv360Buy)).setVisibility(8);
                n().c();
            }
        }
    }

    public final void q(boolean z) {
        int i3 = 0;
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 262224, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            ViewStub viewStub = (ViewStub) this.f13641c.findViewById(R.id.stub3dBgView);
            if (viewStub != null) {
                ViewKt.setVisible(viewStub, z);
            }
            DuImageLoaderView duImageLoaderView = (DuImageLoaderView) this.f13641c.findViewById(R.id._3dBgView);
            if (duImageLoaderView != null) {
                if (!z) {
                    i3 = 8;
                }
                duImageLoaderView.setVisibility(i3);
                ColorDrawable colorDrawable = new ColorDrawable(Color.parseColor("#FFA3A6B0"));
                c p0 = duImageLoaderView.i("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/common/animation3d_bg_product_detail_3d.webp").l0(colorDrawable).c0(colorDrawable).p0(DuScaleType.CENTER_CROP);
                p0.C = true;
                p0.x();
            }
        }
    }

    public final void r(List<String> list) {
        if (!PatchProxy.proxy(new Object[]{list}, this, changeQuickRedirect, false, 262215, new Class[]{List.class}, Void.TYPE).isSupported) {
            o().a(PmTDSpaceDataViewModel.TDSpaceSwitchState.SUCCESS);
            View childAt = ((FrameLayout) d(R.id.layFullscreen)).getChildAt(0);
            if (childAt instanceof PanoramaImageView) {
                PanoramaImageView panoramaImageView = (PanoramaImageView) childAt;
                panoramaImageView.setImages(list);
                panoramaImageView.setAutoRotate(true);
                panoramaImageView.z();
                if (!PatchProxy.proxy(new Object[0], panoramaImageView, PanoramaImageView.changeQuickRedirect, false, 115352, new Class[0], Void.TYPE).isSupported) {
                    panoramaImageView.q();
                    float[] fArr = new float[9];
                    panoramaImageView.w.getValues(fArr);
                    float f = fArr[2];
                    float f12 = fArr[5];
                    float f13 = fArr[0];
                    ValueAnimator ofFloat = ValueAnimator.ofFloat(i.f36333a, 1.0f);
                    ofFloat.setDuration(500L);
                    ofFloat.addUpdateListener(new d50.e(panoramaImageView, f, f12, f13));
                    Unit unit = Unit.INSTANCE;
                    panoramaImageView.f13348u = ofFloat;
                    ofFloat.start();
                }
            }
        }
    }
}