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


package com.shizhuang.duapp.modules.productv2.facedetect.detect.ui;

import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.os.BundleKt;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModelKt;
import bj1.e;
import cd.l;
import com.knightboost.weaver.api.Scope;
import com.knightboost.weaver.api.annotations.Insert;
import com.knightboost.weaver.api.annotations.TargetClass;
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.bean.ImageViewModel;
import com.shizhuang.duapp.common.extension.ViewExtensionKt;
import com.shizhuang.duapp.common.extension.ViewModelLifecycleAwareLazy;
import com.shizhuang.duapp.common.ui.BaseFragment;
import com.shizhuang.duapp.common.utils.RxPermissionsHelper;
import com.shizhuang.duapp.libs.animation.DuAnimationView;
import com.shizhuang.duapp.libs.duimageloaderview.DuImageLoaderView;
import com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectSexChooseDialog;
import com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.PermissionRequestDialog;
import com.shizhuang.duapp.modules.productv2.facedetect.detect.vm.FaceDetectVM;
import com.shizhuang.duapp.modules.productv2.facedetect.detect.vm.FaceDetectVM$uploadImage$1;
import com.shizhuang.duapp.modules.productv2.facedetect.detect.widgets.FaceDetectFlawContainer;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.Acne;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.AiSkinDetectRecord;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.Blackhead;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.DarkCircle;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.Pore;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.Speckle;
import com.shizhuang.duapp.modules.productv2.facedetect.result.model.Wrinkle;
import com.shizhuang.poizoncamera.PoizonCameraView;
import com.shizhuang.poizoncamera.Size;
import df.r0;
import df.x;
import h2.o;
import ik1.f;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
import jh1.d;
import kotlin.Lazy;
import kotlin.LazyKt__LazyJVMKt;
import kotlin.Metadata;
import kotlin.TuplesKt;
import kotlin.Unit;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Ref;
import kotlinx.coroutines.CoroutineExceptionHandler;
import o5.i;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

@Metadata(bv = {}, d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0002\b\u0007\u0018\u00002\u00020\u0001:\u0002\n\u000bB\u0007¢\u0006\u0004\b\b\u0010\tJ\b\u0010\u0003\u001a\u00020\u0002H\u0016J\b\u0010\u0004\u001a\u00020\u0002H\u0016J\u0010\u0010\u0007\u001a\u00020\u00022\u0006\u0010\u0006\u001a\u00020\u0005H\u0016¨\u0006\f"}, d2 = {"Lcom/shizhuang/duapp/modules/productv2/facedetect/detect/ui/FaceDetectFragment;", "Lcom/shizhuang/duapp/common/ui/BaseFragment;", "", "onResume", "onPause", "", "hidden", "onHiddenChanged", "<init>", "()V", "CameraImageCallback", "a", "du_product_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: FaceDetectFragment.kt */
public final class FaceDetectFragment extends BaseFragment {
    public static ChangeQuickRedirect changeQuickRedirect;
    @NotNull
    public static final a m = new a(null);
    public final String b = "FaceDetectFragment";

    /* renamed from: c  reason: collision with root package name */
    public final Lazy f23619c = new ViewModelLifecycleAwareLazy(this, new FaceDetectFragment$$special$$inlined$duActivityViewModel$1(this));
    public boolean d;
    public int e = 1;
    public ValueAnimator f;

    /* renamed from: g  reason: collision with root package name */
    public final float f23620g = ((float) fi.b.b((float) 266));

    /* renamed from: h  reason: collision with root package name */
    public final Lazy f23621h = LazyKt__LazyJVMKt.lazy(FaceDetectFragment$compositeDisposable$2.INSTANCE);
    public boolean i;
    public long j;
    public String k = "0%";
    public HashMap l;

    /* compiled from: FaceDetectFragment.kt */
    public static final class CameraImageCallback extends PoizonCameraView.Callback {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final WeakReference<FaceDetectFragment> f23622a;

        public CameraImageCallback(@NotNull FaceDetectFragment faceDetectFragment) {
            this.f23622a = new WeakReference<>(faceDetectFragment);
        }

        @Override // com.shizhuang.poizoncamera.PoizonCameraView.Callback
        public void onPictureTaken(@Nullable Bitmap bitmap) {
            FaceDetectFragment faceDetectFragment;
            if (!PatchProxy.proxy(new Object[]{bitmap}, this, changeQuickRedirect, false, 293284, new Class[]{Bitmap.class}, Void.TYPE).isSupported && bitmap != null && (faceDetectFragment = this.f23622a.get()) != null) {
                Ref.ObjectRef objectRef = new Ref.ObjectRef();
                T t = (T) faceDetectFragment.getContext();
                if (t != null) {
                    objectRef.element = t;
                    DuImageLoaderView duImageLoaderView = (DuImageLoaderView) faceDetectFragment._$_findCachedViewById(R.id.imgCover);
                    if (duImageLoaderView != null) {
                        duImageLoaderView.e(bitmap);
                    }
                    LifecycleOwnerKt.getLifecycleScope(faceDetectFragment).launchWhenResumed(new FaceDetectFragment$CameraImageCallback$onPictureTaken$1(objectRef, bitmap, faceDetectFragment, null));
                }
            }
        }
    }

    public class _boostWeave {
        public static ChangeQuickRedirect changeQuickRedirect;

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onCreate")
        @Keep
        public static void FragmentMethodWeaver_onCreate(FaceDetectFragment faceDetectFragment, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{faceDetectFragment, bundle}, null, changeQuickRedirect, true, 293294, new Class[]{FaceDetectFragment.class, Bundle.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                FaceDetectFragment.d(faceDetectFragment, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (faceDetectFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectFragment")) {
                    jn.b.f34396a.fragmentOnCreateMethod(faceDetectFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onCreateView")
        @Keep
        public static View FragmentMethodWeaver_onCreateView(@NonNull FaceDetectFragment faceDetectFragment, @androidx.annotation.Nullable LayoutInflater layoutInflater, @androidx.annotation.Nullable ViewGroup viewGroup, Bundle bundle) {
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{faceDetectFragment, layoutInflater, viewGroup, bundle}, null, changeQuickRedirect, true, 293296, new Class[]{FaceDetectFragment.class, LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
            if (proxy.isSupported) {
                return (View) proxy.result;
            }
            long currentTimeMillis = System.currentTimeMillis();
            View f = FaceDetectFragment.f(faceDetectFragment, layoutInflater, viewGroup, bundle);
            long currentTimeMillis2 = System.currentTimeMillis();
            if (faceDetectFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectFragment")) {
                jn.b.f34396a.fragmentOnCreateViewMethod(faceDetectFragment, currentTimeMillis, currentTimeMillis2);
            }
            return f;
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onResume")
        @Keep
        public static void FragmentMethodWeaver_onResume(FaceDetectFragment faceDetectFragment) {
            if (!PatchProxy.proxy(new Object[]{faceDetectFragment}, null, changeQuickRedirect, true, 293293, new Class[]{FaceDetectFragment.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                FaceDetectFragment.c(faceDetectFragment);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (faceDetectFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectFragment")) {
                    jn.b.f34396a.fragmentOnResumeMethod(faceDetectFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onStart")
        @Keep
        public static void FragmentMethodWeaver_onStart(FaceDetectFragment faceDetectFragment) {
            if (!PatchProxy.proxy(new Object[]{faceDetectFragment}, null, changeQuickRedirect, true, 293295, new Class[]{FaceDetectFragment.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                FaceDetectFragment.e(faceDetectFragment);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (faceDetectFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectFragment")) {
                    jn.b.f34396a.fragmentOnStartMethod(faceDetectFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

        @TargetClass(scope = Scope.ALL_CHILDREN, value = "androidx.fragment.app.Fragment")
        @Insert(mayCreateSuper = true, value = "onViewCreated")
        @Keep
        public static void FragmentMethodWeaver_onViewCreated(@NonNull FaceDetectFragment faceDetectFragment, @androidx.annotation.Nullable View view, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{faceDetectFragment, view, bundle}, null, changeQuickRedirect, true, 293297, new Class[]{FaceDetectFragment.class, View.class, Bundle.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                FaceDetectFragment.g(faceDetectFragment, view, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (faceDetectFragment.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.productv2.facedetect.detect.ui.FaceDetectFragment")) {
                    jn.b.f34396a.fragmentOnViewCreatedMethod(faceDetectFragment, currentTimeMillis, currentTimeMillis2);
                }
            }
        }
    }

    /* compiled from: FaceDetectFragment.kt */
    public static final class a {
        public static ChangeQuickRedirect changeQuickRedirect;

        public a(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    /* compiled from: FaceDetectFragment.kt */
    public static final class b implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ FaceDetectFragment b;

        public b(FaceDetectFragment faceDetectFragment) {
            this.b = faceDetectFragment;
        }

        public final void run() {
            PermissionRequestDialog permissionRequestDialog;
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293299, new Class[0], Void.TYPE).isSupported && l.c(this.b)) {
                FaceDetectFragment faceDetectFragment = this.b;
                if (!PatchProxy.proxy(new Object[0], faceDetectFragment, FaceDetectFragment.changeQuickRedirect, false, 293261, new Class[0], Void.TYPE).isSupported) {
                    PermissionRequestDialog.a aVar = PermissionRequestDialog.f23629h;
                    int i = faceDetectFragment.e;
                    PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i)}, aVar, PermissionRequestDialog.a.changeQuickRedirect, false, 293458, new Class[]{Integer.TYPE}, PermissionRequestDialog.class);
                    if (proxy.isSupported) {
                        permissionRequestDialog = (PermissionRequestDialog) proxy.result;
                    } else {
                        PermissionRequestDialog permissionRequestDialog2 = new PermissionRequestDialog();
                        permissionRequestDialog2.setArguments(BundleKt.bundleOf(TuplesKt.to("permission", Integer.valueOf(i))));
                        permissionRequestDialog = permissionRequestDialog2;
                    }
                    permissionRequestDialog.j(faceDetectFragment);
                    FaceDetectFragment$showPermissionAskDialog$1 faceDetectFragment$showPermissionAskDialog$1 = new FaceDetectFragment$showPermissionAskDialog$1(faceDetectFragment);
                    if (!PatchProxy.proxy(new Object[]{faceDetectFragment$showPermissionAskDialog$1}, permissionRequestDialog, PermissionRequestDialog.changeQuickRedirect, false, 293439, new Class[]{Function0.class}, Void.TYPE).isSupported) {
                        permissionRequestDialog.f = faceDetectFragment$showPermissionAskDialog$1;
                    }
                }
            }
        }
    }

    /* compiled from: FaceDetectFragment.kt */
    public static final class c implements Runnable {
        public static ChangeQuickRedirect changeQuickRedirect;
        public final /* synthetic */ FaceDetectFragment b;

        /* renamed from: c  reason: collision with root package name */
        public final /* synthetic */ Function0 f23623c;

        public c(FaceDetectFragment faceDetectFragment, Function0 function0) {
            this.b = faceDetectFragment;
            this.f23623c = function0;
        }

        public final void run() {
            Function0 function0;
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293300, new Class[0], Void.TYPE).isSupported && l.c(this.b) && (function0 = this.f23623c) != null) {
                Unit unit = (Unit) function0.invoke();
            }
        }
    }

    public static void c(FaceDetectFragment faceDetectFragment) {
        boolean z = false;
        if (!PatchProxy.proxy(new Object[0], faceDetectFragment, changeQuickRedirect, false, 293244, new Class[0], Void.TYPE).isSupported) {
            super.onResume();
            if (!PatchProxy.proxy(new Object[0], i60.a.f33292a, i60.a.changeQuickRedirect, false, 124795, new Class[0], Void.TYPE).isSupported) {
                a1.a.j(8, i60.b.f33293a, "trade_ai_pageview", "1221", "");
            }
            PatchProxyResult proxy = PatchProxy.proxy(new Object[]{"android.permission.CAMERA"}, faceDetectFragment, changeQuickRedirect, false, 293260, new Class[]{String.class}, Boolean.TYPE);
            if (proxy.isSupported) {
                z = ((Boolean) proxy.result).booleanValue();
            } else {
                FragmentActivity activity = faceDetectFragment.getActivity();
                if (activity != null) {
                    z = new d(activity).a("android.permission.CAMERA");
                }
            }
            if (z) {
                faceDetectFragment.q();
            }
        }
    }

    public static void d(FaceDetectFragment faceDetectFragment, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, faceDetectFragment, changeQuickRedirect, false, 293276, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.onCreate(bundle);
        }
    }

    public static void e(FaceDetectFragment faceDetectFragment) {
        if (!PatchProxy.proxy(new Object[0], faceDetectFragment, changeQuickRedirect, false, 293278, new Class[0], Void.TYPE).isSupported) {
            super.onStart();
        }
    }

    public static View f(FaceDetectFragment faceDetectFragment, LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{layoutInflater, viewGroup, bundle}, faceDetectFragment, changeQuickRedirect, false, 293280, new Class[]{LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
        return proxy.isSupported ? (View) proxy.result : super.onCreateView(layoutInflater, viewGroup, bundle);
    }

    public static void g(FaceDetectFragment faceDetectFragment, View view, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{view, bundle}, faceDetectFragment, changeQuickRedirect, false, 293282, new Class[]{View.class, Bundle.class}, Void.TYPE).isSupported) {
            super.onViewCreated(view, bundle);
        }
    }

    public View _$_findCachedViewById(int i3) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{new Integer(i3)}, this, changeQuickRedirect, false, 293273, 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 view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i3);
        this.l.put(Integer.valueOf(i3), findViewById);
        return findViewById;
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public int getLayout() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293241, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.layout_face_detect;
    }

    public final void h() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293267, new Class[0], Void.TYPE).isSupported) {
            DuAnimationView duAnimationView = (DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector);
            if (duAnimationView != null) {
                duAnimationView.E();
            }
            DuAnimationView duAnimationView2 = (DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis);
            if (duAnimationView2 != null) {
                duAnimationView2.E();
            }
            ValueAnimator valueAnimator = this.f;
            if (valueAnimator != null) {
                valueAnimator.removeAllListeners();
            }
            ValueAnimator valueAnimator2 = this.f;
            if (valueAnimator2 != null) {
                valueAnimator2.cancel();
            }
            this.f = null;
        }
    }

    public final void i() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293258, new Class[0], Void.TYPE).isSupported) {
            int i3 = this.e;
            if (i3 == 1) {
                j("android.permission.CAMERA", new FaceDetectFragment$checkPermission$1(this));
            } else if (i3 == 2) {
                q();
                j("android.permission.WRITE_EXTERNAL_STORAGE", null);
            }
        }
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public void initData() {
        LiveData liveData;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293242, new Class[0], Void.TYPE).isSupported) {
            i();
            FaceDetectVM l12 = l();
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], l12, FaceDetectVM.changeQuickRedirect, false, 293470, new Class[0], LiveData.class);
            if (proxy.isSupported) {
                liveData = (LiveData) proxy.result;
            } else {
                liveData = l12.f23631c;
            }
            liveData.observe(this, new FaceDetectFragment$initData$1(this));
        }
    }

    @Override // com.shizhuang.duapp.common.base.inter.IViewController, com.shizhuang.duapp.common.ui.BaseFragment
    public void initView(@Nullable Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 293247, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            o("0");
            GradientDrawable gradientDrawable = new GradientDrawable();
            gradientDrawable.setColor(getResources().getColor(R.color.color_1A000000));
            gradientDrawable.setCornerRadius((float) fi.b.b((float) 1));
            ((TextView) _$_findCachedViewById(R.id.tvIgnore)).setBackground(gradientDrawable);
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293248, new Class[0], Void.TYPE).isSupported) {
                int i3 = r0.i(getContext());
                ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) _$_findCachedViewById(R.id.viewPlaceholder).getLayoutParams();
                ((ViewGroup.MarginLayoutParams) layoutParams).height = i3;
                _$_findCachedViewById(R.id.viewPlaceholder).setLayoutParams(layoutParams);
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293249, new Class[0], Void.TYPE).isSupported) {
                ViewExtensionKt.j((DuImageLoaderView) _$_findCachedViewById(R.id.imgGuide), 0, new FaceDetectFragment$initClick$1(this), 1);
                ViewExtensionKt.j((ImageView) _$_findCachedViewById(R.id.imgBack), 0, new FaceDetectFragment$initClick$2(this), 1);
                ViewExtensionKt.j((DuImageLoaderView) _$_findCachedViewById(R.id.imgCapture), 0, new FaceDetectFragment$initClick$3(this), 1);
                ViewExtensionKt.j((TextView) _$_findCachedViewById(R.id.tvIgnore), 0, new FaceDetectFragment$initClick$4(this), 1);
                ViewExtensionKt.j((ConstraintLayout) _$_findCachedViewById(R.id.constraintSwitchCamera), 0, new FaceDetectFragment$initClick$5(this), 1);
                ViewExtensionKt.j((ConstraintLayout) _$_findCachedViewById(R.id.constraintGallery), 0, new FaceDetectFragment$initClick$6(this), 1);
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293250, new Class[0], Void.TYPE).isSupported) {
                CameraImageCallback cameraImageCallback = new CameraImageCallback(this);
                PoizonCameraView poizonCameraView = (PoizonCameraView) _$_findCachedViewById(R.id.cameraView);
                poizonCameraView.setMaxPreviewSize(new Size(1080, 1920));
                poizonCameraView.b(cameraImageCallback);
                poizonCameraView.g(false);
                poizonCameraView.setFacing(1);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector)).F("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/facedetect_animation2.mp4").s();
            }
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293251, new Class[0], Void.TYPE).isSupported) {
                k().add(e.interval(1500, TimeUnit.MILLISECONDS).subscribe(new b51.a(this), new b51.b(this)));
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:8:0x003a, code lost:
        if (r10.equals("android.permission.WRITE_EXTERNAL_STORAGE") == false) goto L_0x003d;
     */
    public final void j(String str, Function0<Unit> function0) {
        int i3 = 2;
        if (!PatchProxy.proxy(new Object[]{str, function0}, this, changeQuickRedirect, false, 293259, new Class[]{String.class, Function0.class}, Void.TYPE).isSupported) {
            int hashCode = str.hashCode();
            if (hashCode == 463403621) {
                str.equals("android.permission.CAMERA");
            } else if (hashCode == 1365911975) {
            }
            i3 = 1;
            this.e = i3;
            new RxPermissionsHelper(requireActivity()).a(str, new b(this)).h(new c(this, function0)).d();
        }
    }

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

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

    public final void m() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293266, new Class[0], Void.TYPE).isSupported) {
            t(false);
        }
    }

    public final void n(int i3) {
        Acne acne;
        DarkCircle darkCircle;
        Blackhead blackhead;
        Pore pore;
        Speckle speckle;
        Wrinkle wrinkle;
        Object[] objArr = {new Integer(i3)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Integer.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 293263, new Class[]{cls}, Void.TYPE).isSupported) {
            if (i3 == 1) {
                ((TextView) _$_findCachedViewById(R.id.tvIgnore)).setVisibility(0);
                ((DuImageLoaderView) _$_findCachedViewById(R.id.imgGuide)).setVisibility(8);
                ((ConstraintLayout) _$_findCachedViewById(R.id.bottomScanArea)).setVisibility(0);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector)).setVisibility(8);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).setVisibility(8);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).E();
            }
            FaceDetectFlawContainer faceDetectFlawContainer = (FaceDetectFlawContainer) _$_findCachedViewById(R.id.resultContainer);
            if (!PatchProxy.proxy(new Object[]{new Integer(i3)}, faceDetectFlawContainer, FaceDetectFlawContainer.changeQuickRedirect, false, 293489, new Class[]{cls}, Void.TYPE).isSupported) {
                faceDetectFlawContainer.removeAllViews();
                float d12 = (float) o.d();
                float c5 = ((float) o.c()) / 2.0f;
                if (i3 == 1) {
                    AiSkinDetectRecord aiSkinDetectRecord = faceDetectFlawContainer.b;
                    if (!(aiSkinDetectRecord == null || (darkCircle = aiSkinDetectRecord.getDarkCircle()) == null)) {
                        faceDetectFlawContainer.a(i.f36333a, c5 - ((float) fi.b.b((float) 70)), -((float) fi.b.b((float) 100)), (float) fi.b.b((float) 0), darkCircle.getAnchorDesc(), darkCircle.getAnchorName());
                    }
                    AiSkinDetectRecord aiSkinDetectRecord2 = faceDetectFlawContainer.b;
                    if (aiSkinDetectRecord2 != null && (acne = aiSkinDetectRecord2.getAcne()) != null) {
                        faceDetectFlawContainer.a(d12 - ((float) fi.b.b((float) 210)), c5 - ((float) fi.b.b((float) 180)), (float) fi.b.b((float) 100), i.f36333a, acne.getAnchorDesc(), acne.getAnchorName());
                    }
                } else if (i3 == 2) {
                    AiSkinDetectRecord aiSkinDetectRecord3 = faceDetectFlawContainer.b;
                    if (!(aiSkinDetectRecord3 == null || (pore = aiSkinDetectRecord3.getPore()) == null)) {
                        faceDetectFlawContainer.a(i.f36333a, ((float) fi.b.b((float) 6)) + c5, -((float) fi.b.b((float) 100)), (float) fi.b.b((float) 0), pore.getAnchorDesc(), pore.getAnchorName());
                    }
                    AiSkinDetectRecord aiSkinDetectRecord4 = faceDetectFlawContainer.b;
                    if (aiSkinDetectRecord4 != null && (blackhead = aiSkinDetectRecord4.getBlackhead()) != null) {
                        faceDetectFlawContainer.a(d12 - ((float) fi.b.b((float) 208)), c5 - ((float) fi.b.b((float) 67)), (float) fi.b.b((float) 100), i.f36333a, blackhead.getAnchorDesc(), blackhead.getAnchorName());
                    }
                } else if (i3 == 3) {
                    AiSkinDetectRecord aiSkinDetectRecord5 = faceDetectFlawContainer.b;
                    if (!(aiSkinDetectRecord5 == null || (wrinkle = aiSkinDetectRecord5.getWrinkle()) == null)) {
                        faceDetectFlawContainer.a(i.f36333a, c5 - ((float) fi.b.b((float) 61)), -((float) fi.b.b((float) 100)), (float) fi.b.b((float) 0), wrinkle.getAnchorDesc(), wrinkle.getAnchorName());
                    }
                    AiSkinDetectRecord aiSkinDetectRecord6 = faceDetectFlawContainer.b;
                    if (aiSkinDetectRecord6 != null && (speckle = aiSkinDetectRecord6.getSpeckle()) != null) {
                        faceDetectFlawContainer.a(d12 - ((float) fi.b.b((float) 200)), c5 - ((float) fi.b.b((float) 40)), (float) fi.b.b((float) 100), i.f36333a, speckle.getAnchorDesc(), speckle.getAnchorName());
                    }
                }
            }
        }
    }

    public final void o(String str) {
        if (!PatchProxy.proxy(new Object[]{str}, this, changeQuickRedirect, false, 293254, new Class[]{String.class}, Void.TYPE).isSupported) {
            ((TextView) _$_findCachedViewById(R.id.tvScanProgress)).setText("正在检测中 " + str + '%');
        }
    }

    @Override // androidx.fragment.app.Fragment
    public void onActivityResult(int i3, int i12, @Nullable Intent intent) {
        ImageViewModel imageViewModel;
        String str;
        Object[] objArr = {new Integer(i3), new Integer(i12), intent};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Integer.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 293272, new Class[]{cls, cls, Intent.class}, Void.TYPE).isSupported) {
            super.onActivityResult(i3, i12, intent);
            if (i3 == 100 && i12 == -1 && intent != null && (imageViewModel = (ImageViewModel) CollectionsKt___CollectionsKt.getOrNull(x.a(intent.getParcelableArrayListExtra("imageList")), 0)) != null && (str = imageViewModel.url) != null) {
                ((DuImageLoaderView) _$_findCachedViewById(R.id.imgCover)).i(str).x();
                r(str, false);
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onCreate(Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, this, changeQuickRedirect, false, 293275, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onCreate(this, bundle);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[]{layoutInflater, viewGroup, bundle}, this, changeQuickRedirect, false, 293279, new Class[]{LayoutInflater.class, ViewGroup.class, Bundle.class}, View.class);
        return proxy.isSupported ? (View) proxy.result : _boostWeave.FragmentMethodWeaver_onCreateView(this, layoutInflater, viewGroup, bundle);
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onDestroyView() {
        HashMap hashMap;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293271, new Class[0], Void.TYPE).isSupported) {
            super.onDestroyView();
            h();
            k().a();
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293274, new Class[0], Void.TYPE).isSupported && (hashMap = this.l) != null) {
                hashMap.clear();
            }
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onHiddenChanged(boolean z) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 293246, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            super.onHiddenChanged(z);
            if (!z) {
                i();
                ((PoizonCameraView) _$_findCachedViewById(R.id.cameraView)).setFacing(1);
                return;
            }
            s();
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onPause() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293245, new Class[0], Void.TYPE).isSupported) {
            s();
            super.onPause();
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293243, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onResume(this);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onStart() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293277, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onStart(this);
        }
    }

    @Override // com.shizhuang.duapp.common.ui.BaseFragment, androidx.fragment.app.Fragment
    public void onViewCreated(View view, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{view, bundle}, this, changeQuickRedirect, false, 293281, new Class[]{View.class, Bundle.class}, Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onViewCreated(this, view, bundle);
        }
    }

    public final void p() {
        FaceDetectSexChooseDialog faceDetectSexChooseDialog;
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293265, new Class[0], Void.TYPE).isSupported) {
            this.i = false;
            PatchProxyResult proxy = PatchProxy.proxy(new Object[0], FaceDetectSexChooseDialog.f23625h, FaceDetectSexChooseDialog.a.changeQuickRedirect, false, 293390, new Class[0], FaceDetectSexChooseDialog.class);
            if (proxy.isSupported) {
                faceDetectSexChooseDialog = (FaceDetectSexChooseDialog) proxy.result;
            } else {
                faceDetectSexChooseDialog = new FaceDetectSexChooseDialog();
            }
            FaceDetectFragment$showSexChooseDialog$$inlined$apply$lambda$1 faceDetectFragment$showSexChooseDialog$$inlined$apply$lambda$1 = new FaceDetectFragment$showSexChooseDialog$$inlined$apply$lambda$1(faceDetectSexChooseDialog, this);
            if (!PatchProxy.proxy(new Object[]{faceDetectFragment$showSexChooseDialog$$inlined$apply$lambda$1}, faceDetectSexChooseDialog, FaceDetectSexChooseDialog.changeQuickRedirect, false, 293370, new Class[]{Function1.class}, Void.TYPE).isSupported) {
                faceDetectSexChooseDialog.f = faceDetectFragment$showSexChooseDialog$$inlined$apply$lambda$1;
            }
            if (!faceDetectSexChooseDialog.f()) {
                faceDetectSexChooseDialog.j(this);
            }
        }
    }

    public final void q() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293256, new Class[0], Void.TYPE).isSupported && !this.i) {
            ((PoizonCameraView) _$_findCachedViewById(R.id.cameraView)).c(true);
            ((PoizonCameraView) _$_findCachedViewById(R.id.cameraView)).i();
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r23v0, resolved type: boolean */
    /* JADX WARN: Multi-variable type inference failed */
    public final void r(String str, boolean z) {
        Object[] objArr = {str, new Byte(z ? (byte) 1 : 0)};
        ChangeQuickRedirect changeQuickRedirect2 = changeQuickRedirect;
        Class cls = Boolean.TYPE;
        if (!PatchProxy.proxy(objArr, this, changeQuickRedirect2, false, 293262, new Class[]{String.class, cls}, Void.TYPE).isSupported) {
            this.j = System.currentTimeMillis();
            t(true);
            FaceDetectVM l12 = l();
            Context context = getContext();
            if (!PatchProxy.proxy(new Object[]{context, str, new Byte((byte) z)}, l12, FaceDetectVM.changeQuickRedirect, false, 293473, new Class[]{Context.class, String.class, cls}, Void.TYPE).isSupported && context != null) {
                f.i(ViewModelKt.getViewModelScope(l12), new c51.c(CoroutineExceptionHandler.Key, l12), null, new FaceDetectVM$uploadImage$1(l12, context, str, z, null), 2, null);
            }
            if (!PatchProxy.proxy(new Object[0], i60.a.f33292a, i60.a.changeQuickRedirect, false, 124949, new Class[0], Void.TYPE).isSupported) {
                a1.a.j(8, i60.b.f33293a, "trade_ai_exposure", "1225", "");
            }
        }
    }

    public final void s() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 293257, new Class[0], Void.TYPE).isSupported) {
            try {
                ((PoizonCameraView) _$_findCachedViewById(R.id.cameraView)).k();
            } catch (Exception e6) {
                fo.a.u(this.b).e(e6, "stop camera fail", new Object[0]);
            }
        }
    }

    public final void t(boolean z) {
        if (!PatchProxy.proxy(new Object[]{new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 293252, new Class[]{Boolean.TYPE}, Void.TYPE).isSupported) {
            if (z) {
                ((DuImageLoaderView) _$_findCachedViewById(R.id.imgCover)).setVisibility(0);
                ((FaceDetectFlawContainer) _$_findCachedViewById(R.id.resultContainer)).setVisibility(0);
                ((ConstraintLayout) _$_findCachedViewById(R.id.capturePanel)).setVisibility(8);
                ((ImageView) _$_findCachedViewById(R.id.imgBack)).setVisibility(0);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).setVisibility(0);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector)).setVisibility(8);
                ((DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector)).E();
                this.i = true;
                s();
                ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).F("https://apk.poizon.com/duApp/Android_Config/resource/mall/app/facedetect_animation3.mp4").s();
                return;
            }
            ((DuImageLoaderView) _$_findCachedViewById(R.id.imgCover)).setVisibility(8);
            ((FaceDetectFlawContainer) _$_findCachedViewById(R.id.resultContainer)).setVisibility(8);
            ((ConstraintLayout) _$_findCachedViewById(R.id.capturePanel)).setVisibility(0);
            ((ImageView) _$_findCachedViewById(R.id.imgBack)).setVisibility(0);
            ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).setVisibility(8);
            ((DuAnimationView) _$_findCachedViewById(R.id.imgAnalysis)).E();
            ((DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector)).setVisibility(0);
            DuAnimationView duAnimationView = (DuAnimationView) _$_findCachedViewById(R.id.imgFaceVector);
            if (duAnimationView != null) {
                duAnimationView.y();
            }
            ((TextView) _$_findCachedViewById(R.id.tvIgnore)).setVisibility(8);
            ((DuImageLoaderView) _$_findCachedViewById(R.id.imgGuide)).setVisibility(0);
            ((ConstraintLayout) _$_findCachedViewById(R.id.bottomScanArea)).setVisibility(8);
            this.i = false;
            ((FaceDetectFlawContainer) _$_findCachedViewById(R.id.resultContainer)).removeAllViews();
            q();
            o("0");
        }
    }

    public final void u(String str, boolean z) {
        if (!PatchProxy.proxy(new Object[]{str, new Byte(z ? (byte) 1 : 0)}, this, changeQuickRedirect, false, 293269, new Class[]{String.class, Boolean.TYPE}, Void.TYPE).isSupported) {
            i60.a aVar = i60.a.f33292a;
            Integer valueOf = Integer.valueOf(z ? 1 : 0);
            if (!PatchProxy.proxy(new Object[]{str, valueOf}, aVar, i60.a.changeQuickRedirect, false, 124794, new Class[]{Object.class, Object.class}, Void.TYPE).isSupported) {
                i60.b.f33293a.b("trade_ai_click", "1221", "520", a.f.b(8, "button_title", str, "is_labeled", valueOf));
            }
        }
    }
}