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


package com.shizhuang.duapp.modules.blindbox.box.fragment;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.view.ViewCompat;
import androidx.core.view.ViewKt;
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.dialog.BaseDialogFragment;
import com.shizhuang.duapp.modules.blindbox.box.activity.BlindBoxOpenActivity;
import com.shizhuang.duapp.modules.share.callback.DuShareListener;
import com.shizhuang.duapp.modules.share.constance.SHARE_MEDIA;
import com.shizhuang.duapp.modules.share.view.ShareLightCommonView;
import df.h0;
import df.r0;
import java.util.HashMap;
import kotlin.Metadata;
import kotlin.Result;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import pb1.i;
import ww.e;

@Metadata(bv = {}, d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\u0018\u00002\u00020\u0001:\u0001\u0004B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0005"}, d2 = {"Lcom/shizhuang/duapp/modules/blindbox/box/fragment/ShareBoxDialog;", "Lcom/shizhuang/duapp/common/dialog/BaseDialogFragment;", "<init>", "()V", "a", "du_blind_box_release"}, k = 1, mv = {1, 4, 2})
/* compiled from: ShareBoxDialog.kt */
public final class ShareBoxDialog extends BaseDialogFragment {
    public static ChangeQuickRedirect changeQuickRedirect;
    @NotNull

    /* renamed from: h  reason: collision with root package name */
    public static final a f11169h = new a(null);
    public String e;
    public View f;

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

    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(ShareBoxDialog shareBoxDialog, Bundle bundle) {
            if (!PatchProxy.proxy(new Object[]{shareBoxDialog, bundle}, null, changeQuickRedirect, true, 69252, new Class[]{ShareBoxDialog.class, Bundle.class}, Void.TYPE).isSupported) {
                long currentTimeMillis = System.currentTimeMillis();
                ShareBoxDialog.s(shareBoxDialog, bundle);
                long currentTimeMillis2 = System.currentTimeMillis();
                if (shareBoxDialog.getClass().getCanonicalName().equals("com.shizhuang.duapp.modules.blindbox.box.fragment.ShareBoxDialog")) {
                    jn.b.f34396a.fragmentOnCreateMethod(shareBoxDialog, currentTimeMillis, currentTimeMillis2);
                }
            }
        }

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

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

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

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

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

        public a(DefaultConstructorMarker defaultConstructorMarker) {
        }
    }

    /* compiled from: ShareBoxDialog.kt */
    public static final class b implements DuShareListener {
        public static ChangeQuickRedirect changeQuickRedirect;

        /* renamed from: a  reason: collision with root package name */
        public final /* synthetic */ ShareBoxDialog f11171a;

        /* JADX WARN: Incorrect args count in method signature: ()V */
        public b(ShareBoxDialog shareBoxDialog) {
            this.f11171a = shareBoxDialog;
        }

        @Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
        public void onCancel(@org.jetbrains.annotations.Nullable SHARE_MEDIA share_media) {
            boolean z = PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 69260, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported;
        }

        @Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
        public void onError(@org.jetbrains.annotations.Nullable SHARE_MEDIA share_media, @org.jetbrains.annotations.Nullable Throwable th2) {
            boolean z = PatchProxy.proxy(new Object[]{share_media, th2}, this, changeQuickRedirect, false, 69261, new Class[]{SHARE_MEDIA.class, Throwable.class}, Void.TYPE).isSupported;
        }

        @Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
        public void onResult(@org.jetbrains.annotations.Nullable SHARE_MEDIA share_media) {
            boolean z = PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 69259, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported;
        }

        @Override // com.shizhuang.duapp.modules.share.callback.DuShareListener
        public void onStart(@org.jetbrains.annotations.Nullable SHARE_MEDIA share_media) {
            if (!PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 69262, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported && l.c(this.f11171a)) {
                this.f11171a.dismiss();
            }
        }
    }

    public static void s(ShareBoxDialog shareBoxDialog, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{bundle}, shareBoxDialog, changeQuickRedirect, false, 69242, new Class[]{Bundle.class}, Void.TYPE).isSupported) {
            super.onCreate(bundle);
        }
    }

    public static void t(ShareBoxDialog shareBoxDialog) {
        if (!PatchProxy.proxy(new Object[0], shareBoxDialog, changeQuickRedirect, false, 69244, new Class[0], Void.TYPE).isSupported) {
            super.onStart();
        }
    }

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

    public static void v(ShareBoxDialog shareBoxDialog) {
        if (!PatchProxy.proxy(new Object[0], shareBoxDialog, changeQuickRedirect, false, 69248, new Class[0], Void.TYPE).isSupported) {
            super.onResume();
        }
    }

    public static void w(ShareBoxDialog shareBoxDialog, View view, Bundle bundle) {
        if (!PatchProxy.proxy(new Object[]{view, bundle}, shareBoxDialog, changeQuickRedirect, false, 69250, new Class[]{View.class, Bundle.class}, Void.TYPE).isSupported) {
            super.onViewCreated(view, bundle);
        }
    }

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

    @Override // com.shizhuang.duapp.common.dialog.DuDialogFragment
    public void g() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69233, new Class[0], Void.TYPE).isSupported) {
            super.g();
            Dialog dialog = getDialog();
            if (dialog != null) {
                dialog.setCanceledOnTouchOutside(true);
                dialog.setCancelable(true);
            }
            Dialog dialog2 = getDialog();
            Window window = dialog2 != null ? dialog2.getWindow() : null;
            if (window != null) {
                WindowManager.LayoutParams attributes = window.getAttributes();
                attributes.width = -1;
                attributes.height = -1;
                window.setAttributes(attributes);
            }
        }
    }

    @Override // androidx.fragment.app.Fragment, androidx.fragment.app.DialogFragment
    public void onAttach(@NotNull Context context) {
        if (!PatchProxy.proxy(new Object[]{context}, this, changeQuickRedirect, false, 69230, new Class[]{Context.class}, Void.TYPE).isSupported) {
            super.onAttach(context);
            ConstraintLayout constraintLayout = null;
            if (!(context instanceof BlindBoxOpenActivity)) {
                context = null;
            }
            BlindBoxOpenActivity blindBoxOpenActivity = (BlindBoxOpenActivity) context;
            if (blindBoxOpenActivity != null) {
                constraintLayout = (ConstraintLayout) blindBoxOpenActivity._$_findCachedViewById(R.id.screenBaseView);
            }
            this.f = constraintLayout;
        }
    }

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

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

    @Override // androidx.fragment.app.Fragment, com.shizhuang.duapp.common.dialog.BaseDialogFragment, androidx.fragment.app.DialogFragment
    public void onDestroyView() {
        HashMap hashMap;
        super.onDestroyView();
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69239, new Class[0], Void.TYPE).isSupported && (hashMap = this.f11170g) != null) {
            hashMap.clear();
        }
    }

    @Override // com.shizhuang.duapp.common.dialog.DuDialogFragment, androidx.appcompat.app.AppCompatDialogFragment, androidx.fragment.app.Fragment, com.shizhuang.duapp.common.dialog.BaseDialogFragment, androidx.fragment.app.DialogFragment
    public void onResume() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69247, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onResume(this);
        }
    }

    @Override // com.shizhuang.duapp.common.dialog.DuDialogFragment, androidx.appcompat.app.AppCompatDialogFragment, androidx.fragment.app.Fragment, com.shizhuang.duapp.common.dialog.BaseDialogFragment, androidx.fragment.app.DialogFragment
    public void onStart() {
        if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69243, new Class[0], Void.TYPE).isSupported) {
            _boostWeave.FragmentMethodWeaver_onStart(this);
        }
    }

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

    @Override // com.shizhuang.duapp.common.dialog.BaseDialogFragment
    public int p() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69232, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.style.ShareScreenShot;
    }

    @Override // com.shizhuang.duapp.common.dialog.BaseDialogFragment
    public int q() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69231, new Class[0], Integer.TYPE);
        return proxy.isSupported ? ((Integer) proxy.result).intValue() : R.layout.fragment_share_box_dialog;
    }

    @Override // com.shizhuang.duapp.common.dialog.BaseDialogFragment
    public void r(@org.jetbrains.annotations.Nullable View view) {
        String str;
        Bitmap drawToBitmap$default;
        boolean z = true;
        if (!PatchProxy.proxy(new Object[]{view}, this, changeQuickRedirect, false, 69234, new Class[]{View.class}, Void.TYPE).isSupported) {
            Bundle arguments = getArguments();
            if (arguments == null || (str = arguments.getString("key_router_url")) == null) {
                str = "https://a.app.qq.com/o/simple.jsp?pkgname=com.shizhuang.duapp&fromcase=40002";
            }
            this.e = str;
            ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) ((ConstraintLayout) _$_findCachedViewById(R.id.shareView)).getLayoutParams();
            layoutParams.setMargins(((ViewGroup.MarginLayoutParams) layoutParams).leftMargin, r0.i(getContext()), ((ViewGroup.MarginLayoutParams) layoutParams).rightMargin, ((ViewGroup.MarginLayoutParams) layoutParams).bottomMargin);
            try {
                Result.Companion companion = Result.Companion;
                View view2 = this.f;
                Bitmap bitmap = null;
                if (!(view2 == null || (drawToBitmap$default = ViewKt.drawToBitmap$default(view2, null, 1, null)) == null)) {
                    bitmap = Bitmap.createBitmap(drawToBitmap$default, 0, 0, drawToBitmap$default.getWidth(), (drawToBitmap$default.getWidth() * 585) / 375);
                }
                ((AppCompatImageView) _$_findCachedViewById(R.id.screenImage)).setImageBitmap(bitmap);
                Result.m822constructorimpl(Unit.INSTANCE);
            } catch (Throwable th2) {
                Result.Companion companion2 = Result.Companion;
                Result.m822constructorimpl(ResultKt.createFailure(th2));
            }
            String str2 = this.e;
            if (str2 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("routerUrl");
            }
            if (str2.length() != 0) {
                z = false;
            }
            if (z) {
                this.e = "https://a.app.qq.com/o/simple.jsp?pkgname=com.shizhuang.duapp&fromcase=40002";
            }
            String str3 = this.e;
            if (str3 == null) {
                Intrinsics.throwUninitializedPropertyAccessException("routerUrl");
            }
            ((ImageView) _$_findCachedViewById(R.id.ivQrCode)).setImageBitmap(h0.a(str3, fi.b.b(43.0f)));
            if (!PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69236, new Class[0], Void.TYPE).isSupported) {
                ((ShareLightCommonView) _$_findCachedViewById(R.id.shareLightCommonView)).m.setOnClickListener(new ShareBoxDialog$initShareLayout$1(this));
                ((ShareLightCommonView) _$_findCachedViewById(R.id.shareLightCommonView)).a(new e(this));
            }
        }
    }

    public final Bitmap x() {
        PatchProxyResult proxy = PatchProxy.proxy(new Object[0], this, changeQuickRedirect, false, 69235, new Class[0], Bitmap.class);
        return proxy.isSupported ? (Bitmap) proxy.result : ViewKt.drawToBitmap$default((ConstraintLayout) _$_findCachedViewById(R.id.shareView), null, 1, null);
    }

    public final void y(SHARE_MEDIA share_media) {
        if (!PatchProxy.proxy(new Object[]{share_media}, this, changeQuickRedirect, false, 69237, new Class[]{SHARE_MEDIA.class}, Void.TYPE).isSupported && l.c(this) && ViewCompat.isLaidOut((ConstraintLayout) _$_findCachedViewById(R.id.shareView))) {
            pb1.l b2 = pb1.l.b(getActivity());
            i iVar = new i();
            if (share_media == SHARE_MEDIA.QQ) {
                iVar.t(Bitmap.CompressFormat.PNG);
            }
            iVar.r(x());
            iVar.w(false);
            Unit unit = Unit.INSTANCE;
            b2.e(iVar).f(new b(this)).g(share_media);
        }
    }
}