package com.bytedance.android.live.walletnew;

import X.0GZ;
import X.0HH;
import X.0b0;
import X.0cm;
import X.0dh;
import X.15V;
import X.15l;
import X.15m;
import X.16q;
import X.16y;
import X.17C;
import X.1Mf;
import X.1fZ;
import X.1gE;
import X.1hK;
import X.1jk;
import X.1sU;
import X.29m;
import X.7vl;
import X.9Y3;
import X.AGn;
import X.C1044Fun;
import X.C1313Fz8;
import X.C1430G2l;
import X.C1614G9n;
import X.C1699GCu;
import X.C1700GCv;
import X.C1923GLk;
import X.C1924GLl;
import X.C2046GQd;
import X.C2402Gbb;
import X.C2675Gg0;
import X.C2851Giq;
import X.C3028Glh;
import X.C3441GsM;
import X.C3491GtA;
import X.C4100H7d;
import X.C4366HHj;
import X.C4696HUb;
import X.C4703HUi;
import X.C4704HUj;
import X.C4706HUl;
import X.C4710HUp;
import X.C5397Hio;
import X.C5398Hip;
import X.Crj;
import X.CwZ;
import X.Cwu;
import X.DEF;
import X.GMS;
import X.H8K;
import X.HEP;
import X.HUO;
import X.HUQ;
import X.HUR;
import X.HUU;
import X.HV2;
import X.HV3;
import X.HV5;
import X.HV6;
import X.HV7;
import X.HV8;
import X.HVE;
import X.LWw;
import X.Lel;
import X.M12;
import X.Ql4;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bytedance.android.live.gift.IGiftService;
import com.bytedance.android.live.wallet.IWalletService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.livesetting.linkmic.LiveRoomRechargeAgreementConfigSetting;
import com.bytedance.android.livesdk.wallet.Diamond;
import com.bytedance.android.livesdk.wallet.DiamondPackageExtra;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.model.LiveRechargeAgreementConfig;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import kotlin.h.b.n;
import kotlin.o.z;

public final class RechargeDialogNew extends LiveDialogFragment implements C4706HUl {
    public static final C4703HUi LJFF = new C4703HUi((byte) 0);
    public Activity LIZ;
    public HVE LIZIZ;
    public AGn LIZJ;
    public 1gE LIZLLL;
    public C5398Hip LJ;
    public final Crj LJI = 7vl.LIZ(new C4704HUj(this));
    public final HUO LJII = new HUO(this);
    public HashMap LJIIIIZZ;

    static {
        Covode.recordClassIndex(10923);
    }

    public static final RechargeDialogNew LIZ(Activity activity, Bundle bundle, DialogInterface.OnDismissListener onDismissListener, HVE hve, AGn aGn) {
        return LJFF.LIZ(activity, bundle, onDismissListener, hve, aGn);
    }

    public final View LIZ(int i) {
        if (this.LJIIIIZZ == null) {
            this.LJIIIIZZ = new HashMap();
        }
        View view = (View) this.LJIIIIZZ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIIIIZZ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final RechargeViewModel LJFF() {
        return (RechargeViewModel) this.LJI.getValue();
    }

    public final void z_() {
        HashMap hashMap = this.LJIIIIZZ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void LIZ(DiamondPackageExtra diamondPackageExtra, List<Diamond> list) {
        LinearLayout linearLayout;
        ViewGroup.LayoutParams layoutParams;
        LinearLayout linearLayout2;
        M12.LIZ(list);
        HVE hve = this.LIZIZ;
        int i = 0;
        if (hve != null) {
            hve.LIZ(2, 0, "api success");
        }
        if (LJFF().LJIJ()) {
            boolean z = LJFF().LJIILJJIL() != 0;
            C4710HUp hUp = new C4710HUp(this);
            C1430G2l.LIZ(LIZ(2131371961), z);
            C1430G2l.LIZ(LIZ(2131366415), z);
            LIZ(2131371961).setOnClickListener(hUp);
        } else if (list.isEmpty() && LJFF().LJIILJJIL() == 0) {
            LIZ(0, 0, new Exception("rechargeList is empty"));
            return;
        }
        RechargeViewModel LJFF2 = LJFF();
        1gE r4 = this.LIZLLL;
        1sU LIZ2 = LIZ(2131363250);
        M12.LIZ(list);
        LinkedList linkedList = new LinkedList(list);
        if (LJFF2.LJIJ()) {
            if (list.isEmpty()) {
                Diamond diamond = new Diamond();
                diamond.LJFF = -3;
                linkedList.addFirst(diamond);
                if (LIZ2 != null) {
                    LIZ2.setVisibility(8);
                }
                LJFF2.LIZ(r4, diamondPackageExtra, linkedList);
            } else {
                Diamond diamond2 = new Diamond();
                diamond2.LJFF = -3;
                linkedList.addFirst(diamond2);
                LJFF2.LJIIIZ = list.get(0);
                LJFF2.LIZIZ(r4, diamondPackageExtra, linkedList);
                LJFF2.LIZ(r4, diamondPackageExtra, linkedList);
            }
        } else if (LJFF2.LJIILJJIL() != 0 && list.isEmpty()) {
            Diamond diamond3 = new Diamond();
            diamond3.LJFF = LJFF2.LJIILJJIL();
            linkedList.addFirst(diamond3);
            if (LIZ2 != null) {
                LIZ2.setVisibility(8);
            }
            LJFF2.LIZ(r4, diamondPackageExtra, linkedList);
        } else if (list.isEmpty() || LJFF2.LJIILJJIL() != 0) {
            Diamond diamond4 = new Diamond();
            diamond4.LJFF = LJFF2.LJIILJJIL();
            linkedList.addFirst(diamond4);
            LJFF2.LJIIIZ = list.get(0);
            LJFF2.LIZIZ(r4, diamondPackageExtra, linkedList);
            LJFF2.LIZ(r4, diamondPackageExtra, linkedList);
        } else {
            LJFF2.LJIIIZ = list.get(0);
            LJFF2.LIZIZ(r4, diamondPackageExtra, linkedList);
            LJFF2.LIZ(r4, diamondPackageExtra, linkedList);
        }
        1gE r0 = this.LIZLLL;
        if (r0 != null) {
            r0.LIZJ();
        }
        View view = getView();
        if (!(view == null || (linearLayout = (LinearLayout) view.findViewById(2131367286)) == null || (layoutParams = linearLayout.getLayoutParams()) == null)) {
            layoutParams.height = 0b0.LIZ(436.0f);
            View view2 = getView();
            if (!(view2 == null || (linearLayout2 = (LinearLayout) view2.findViewById(2131367286)) == null)) {
                linearLayout2.setLayoutParams(layoutParams);
            }
        }
        View view3 = getView();
        if (view3 != null) {
            view3.post(new HUU(this, list));
        }
        Diamond diamond5 = LJFF().LJIIIZ;
        if (diamond5 != null) {
            i = diamond5.LIZLLL;
        }
        DataChannel dataChannel = this.LJIILIIL;
        C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("livesdk_recharge_show_recommond");
        LIZ3.LIZ(dataChannel);
        LIZ3.LIZ("recommend_package", i);
        LIZ3.LIZLLL();
    }

    public final void LJ() {
        C5398Hip hip = this.LJ;
        if (hip != null) {
            C1430G2l.LIZIZ((Dialog) hip);
        }
    }

    public final void dismiss() {
        LJFF().LJFF();
        super.dismiss();
    }

    public final void onDestroyView() {
        super.onDestroyView();
        LJFF().LJFF();
        z_();
    }

    public final void LIZIZ() {
        15m findViewById;
        View view = getView();
        if (view != null && (findViewById = view.findViewById(2131370625)) != null) {
            findViewById.setStatus(0);
        }
    }

    public final void LIZLLL() {
        15m findViewById;
        View view = getView();
        if (view != null && (findViewById = view.findViewById(2131370625)) != null) {
            findViewById.LIZ();
        }
    }

    public final C1044Fun LIZ() {
        int i;
        int i2;
        int LIZ2;
        int i3;
        if (LJFF().LJI()) {
            i = 2131561670;
        } else {
            i = 2131561669;
        }
        C1044Fun fun = new C1044Fun(i);
        fun.LIZLLL = LJFF().LJI();
        if (LJFF().LJI()) {
            i2 = 80;
        } else {
            i2 = 8388613;
        }
        fun.LJI = i2;
        if (LJFF().LJI()) {
            LIZ2 = -1;
        } else {
            LIZ2 = 0b0.LIZ(375.0f);
        }
        fun.LJII = LIZ2;
        1hK activity = getActivity();
        if (activity != null) {
            if (LJFF().LJI()) {
                i3 = -2;
            } else {
                i3 = 0b0.LIZ(activity).heightPixels;
            }
            fun.LJIIIIZZ = i3;
        }
        return fun;
    }

    public final void onDismiss(DialogInterface dialogInterface) {
        LJFF().LJFF();
        super.onDismiss(dialogInterface);
    }

    public final void onEvent(C2851Giq giq) {
        if (giq != null && giq.LIZIZ) {
            Diamond diamond = new Diamond();
            diamond.LIZLLL = giq.LIZ;
            LIZ(diamond, (HV5) null, false);
        }
    }

    public final LayoutInflater onGetLayoutInflater(Bundle bundle) {
        LayoutInflater cloneInContext = RechargeDialogNew.super.onGetLayoutInflater(bundle).cloneInContext(0dh.LIZ(getActivity()));
        n.LIZIZ(cloneInContext, "");
        return cloneInContext;
    }

    public final void LIZIZ(int i) {
        String str;
        Resources resources;
        1hK activity = getActivity();
        if (activity == null || !activity.isFinishing()) {
            if (this.LJ == null) {
                this.LJ = new C5397Hio(getContext()).LIZ();
            }
            C5398Hip hip = this.LJ;
            if (hip != null) {
                if (i == 0) {
                    str = "";
                } else {
                    Context context = getContext();
                    if (context == null || (resources = context.getResources()) == null) {
                        str = null;
                    } else {
                        str = resources.getString(i);
                    }
                }
                hip.LIZ(str);
            }
            C5398Hip hip2 = this.LJ;
            if (hip2 != null) {
                C1430G2l.LIZ((Dialog) hip2);
            }
        }
    }

    public final void onConfigurationChanged(Configuration configuration) {
        M12.LIZ(configuration);
        RechargeDialogNew.super.onConfigurationChanged(configuration);
        if (configuration.orientation != 1) {
            return;
        }
        if (LJFF().LJIILIIL) {
            dismiss();
            LJFF().LIZ((Activity) getActivity());
            LJFF().LJIILIIL = false;
        } else if (LJFF().LJIILJJIL) {
            dismiss();
            LJFF().LIZIZ(getActivity());
            LJFF().LJIILJJIL = false;
        }
    }

    public final void LIZ(Diamond diamond, HV5 hv5) {
        M12.LIZ(diamond, hv5);
        LIZ(diamond, hv5, true);
    }

    public static View LIZ(LayoutInflater layoutInflater, int i) {
        MethodCollector.i(12044);
        if (9Y3.LIZ(9Y3.LIZ(), true, "tiktok_tux_text_view_opt", false) && layoutInflater != null && layoutInflater.getFactory() == null && layoutInflater.getFactory2() == null) {
            try {
                layoutInflater.setFactory(new Ql4());
            } catch (Exception unused) {
                View inflate = layoutInflater.inflate(i, (ViewGroup) null);
                MethodCollector.o(12044);
                return inflate;
            }
        }
        View inflate2 = layoutInflater.inflate(i, (ViewGroup) null);
        MethodCollector.o(12044);
        return inflate2;
    }

    public final void onViewCreated(View view, Bundle bundle) {
        ViewGroup.LayoutParams layoutParams;
        Map map;
        String str;
        Map map2;
        Long l;
        String str2;
        String str3;
        int i;
        1jk LIZ2;
        1Mf LIZ3;
        View view2;
        ViewGroup.LayoutParams layoutParams2;
        RechargeDialogNew rechargeDialogNew = this;
        MethodCollector.i(11841);
        View view3 = view;
        M12.LIZ(view3);
        super.onViewCreated(view3, bundle);
        rechargeDialogNew.LJFF().LJIIIIZZ = rechargeDialogNew.LIZJ;
        if (rechargeDialogNew.LJFF().LJI()) {
            LinearLayout linearLayout = (LinearLayout) rechargeDialogNew.LIZ(2131367286);
            if (!(linearLayout == null || (layoutParams2 = linearLayout.getLayoutParams()) == null)) {
                layoutParams2.height = -2;
                LinearLayout linearLayout2 = (LinearLayout) rechargeDialogNew.LIZ(2131367286);
                if (linearLayout2 != null) {
                    linearLayout2.setLayoutParams(layoutParams2);
                }
            }
        } else {
            LinearLayout linearLayout3 = (LinearLayout) rechargeDialogNew.LIZ(2131367286);
            if (!(linearLayout3 == null || (layoutParams = linearLayout3.getLayoutParams()) == null)) {
                layoutParams.height = -1;
                layoutParams.width = 0b0.LIZ(375.0f);
                LinearLayout linearLayout4 = (LinearLayout) rechargeDialogNew.LIZ(2131367286);
                if (linearLayout4 != null) {
                    linearLayout4.setLayoutParams(layoutParams);
                }
            }
        }
        Drawable LIZJ2 = 0b0.LIZJ(2131234633);
        int LIZ4 = 0b0.LIZ(16.0f);
        if (LIZJ2 != null) {
            LIZJ2.setBounds(0, 0, LIZ4, LIZ4);
        }
        if (15V.LIZ(rechargeDialogNew.getContext())) {
            1jk LIZ5 = rechargeDialogNew.LIZ(2131371934);
            if (LIZ5 != null) {
                LIZ5.setCompoundDrawables((Drawable) null, (Drawable) null, LIZJ2, (Drawable) null);
            }
        } else {
            1jk LIZ6 = rechargeDialogNew.LIZ(2131371934);
            if (LIZ6 != null) {
                LIZ6.setCompoundDrawables(LIZJ2, (Drawable) null, (Drawable) null, (Drawable) null);
            }
        }
        AGn aGn = rechargeDialogNew.LIZJ;
        if (!(aGn == null || (view2 = aGn.LIZ) == null)) {
            ViewParent parent = view2.getParent();
            if (!(parent instanceof ViewGroup)) {
                parent = null;
            }
            ViewGroup viewGroup = (ViewGroup) parent;
            if (viewGroup != null) {
                viewGroup.removeView(view2);
            }
            FrameLayout frameLayout = (FrameLayout) rechargeDialogNew.LIZ(2131364032);
            if (frameLayout != null) {
                frameLayout.addView(view2);
            }
        }
        1Mf LIZ7 = rechargeDialogNew.LIZ(2131364737);
        if (LIZ7 != null) {
            LIZ7.setOnClickListener(new C1923GLk(rechargeDialogNew));
        }
        if (rechargeDialogNew.LJFF().LJIJI() && !0b0.LJFF() && (LIZ3 = rechargeDialogNew.LIZ(2131364737)) != null) {
            LIZ3.setVisibility(8);
        }
        if (rechargeDialogNew.LJFF().LJIJI() && (LIZ2 = rechargeDialogNew.LIZ(2131371242)) != null) {
            LIZ2.setText(0b0.LIZ(2131829684));
        }
        if (rechargeDialogNew.LJFF().LJIJI()) {
            1jk LIZ8 = rechargeDialogNew.LIZ(2131364905);
            if (LIZ8 != null) {
                LIZ8.setVisibility(0);
            }
            1jk LIZ9 = rechargeDialogNew.LIZ(2131364905);
            if (LIZ9 != null) {
                LIZ9.setText(0b0.LIZ(2131829518));
            }
        }
        if (n.LIZ(rechargeDialogNew.LJFF().LJII(), "other_recharge")) {
            1Mf LIZ10 = rechargeDialogNew.LIZ(2131367027);
            if (LIZ10 != null) {
                LIZ10.setVisibility(0);
            }
            1Mf LIZ11 = rechargeDialogNew.LIZ(2131367027);
            if (LIZ11 != null) {
                LIZ11.setOnClickListener(new C2046GQd(rechargeDialogNew));
            }
        }
        1sU LIZ12 = rechargeDialogNew.LIZ(2131363250);
        if (LIZ12 != null) {
            LIZ12.setVisibility(0);
        }
        1sU LIZ13 = rechargeDialogNew.LIZ(2131363250);
        if (LIZ13 != null) {
            LIZ13.setOnClickListener(new HUR(rechargeDialogNew));
        }
        1fZ findViewById = view3.findViewById(2131372940);
        if (findViewById != null) {
            findViewById.setOverScrollMode(2);
        }
        rechargeDialogNew.LIZLLL = new 1gE(rechargeDialogNew.LJII);
        0GZ findViewById2 = view3.findViewById(2131372940);
        if (findViewById2 != null) {
            findViewById2.setAdapter(rechargeDialogNew.LIZLLL);
        }
        View LIZ14 = LIZ(rechargeDialogNew.getLayoutInflater(), 2131561937);
        rechargeDialogNew.LJFF();
        if (16y.LJFF.LIZ()) {
            ((TextView) LIZ14.findViewById(2131371242)).setText(2131829984);
        }
        View LIZ15 = LIZ(rechargeDialogNew.getLayoutInflater(), 2131561938);
        LIZ14.findViewById(2131363083).setOnClickListener(new HV8(rechargeDialogNew));
        15l LIZ16 = 15l.LIZ(rechargeDialogNew.getContext());
        LIZ16.LIZIZ(2131833791);
        LIZ16.LIZLLL = LIZ14;
        LIZ16.LIZIZ = LIZ15;
        view3.findViewById(2131370625).setBuilder(LIZ16);
        rechargeDialogNew.LJFF();
        M12.LIZ(view3);
        LiveRechargeAgreementConfig value = LiveRoomRechargeAgreementConfigSetting.INSTANCE.getValue();
        if (value == null) {
            value = LiveRoomRechargeAgreementConfigSetting.INSTANCE.getDEFAULT();
        }
        boolean z = value.isShowRechargeLawInGlobal;
        1jk findViewById3 = view3.findViewById(2131371786);
        C1430G2l.LIZ((View) findViewById3, z);
        if (z) {
            String str4 = value.agreementForGlobal;
            String LIZ17 = 0b0.LIZ(2131829399);
            String LIZ18 = 0b0.LIZ(2131829182);
            n.LIZIZ(LIZ17, "");
            String LIZ19 = 0HH.LIZ(LIZ17, Arrays.copyOf(new Object[]{LIZ18}, 1));
            n.LIZIZ(LIZ19, "");
            SpannableString spannableString = new SpannableString(LIZ19);
            Context context = view3.getContext();
            if (context != null) {
                n.LIZIZ(str4, "");
                C1614G9n g9n = new C1614G9n(str4, context);
                n.LIZIZ(LIZ18, "");
                spannableString.setSpan(g9n, z.LIZ(LIZ19, LIZ18, 0, false, 6), z.LIZ(LIZ19, LIZ18, 0, false, 6) + LIZ18.length(), 17);
            }
            n.LIZIZ(findViewById3, "");
            findViewById3.setText(spannableString);
            findViewById3.setHighlightColor(0b0.LIZIZ(2131099762));
            findViewById3.setMovementMethod(LinkMovementMethod.getInstance());
        }
        rechargeDialogNew.LJFF();
        M12.LIZ(view3);
        LiveRechargeAgreementConfig value2 = LiveRoomRechargeAgreementConfigSetting.INSTANCE.getValue();
        if (value2 == null) {
            value2 = LiveRoomRechargeAgreementConfigSetting.INSTANCE.getDEFAULT();
        }
        boolean z2 = value2.isShowRechargeLawInRegion;
        1jk findViewById4 = view3.findViewById(2131371976);
        1jk findViewById5 = view3.findViewById(2131372297);
        C1430G2l.LIZ((View) (LinearLayout) view3.findViewById(2131362222), z2);
        if (z2) {
            String str5 = value2.agreementsForRegion.get(0).lawUrl;
            n.LIZIZ(findViewById4, "");
            findViewById4.setText(value2.agreementsForRegion.get(0).lawName);
            findViewById4.setOnClickListener(new C1699GCu(view3, str5));
            String str6 = value2.agreementsForRegion.get(1).lawUrl;
            n.LIZIZ(findViewById5, "");
            findViewById5.setText(value2.agreementsForRegion.get(1).lawName);
            findViewById5.setOnClickListener(new C1700GCv(view3, str6));
        }
        RechargeViewModel LJFF2 = rechargeDialogNew.LJFF();
        n.LIZIZ(LJFF2, "");
        DataChannel dataChannel = rechargeDialogNew.LJIILIIL;
        AGn aGn2 = rechargeDialogNew.LIZJ;
        if (aGn2 != null) {
            map = aGn2.LIZIZ;
        } else {
            map = null;
        }
        M12.LIZ(LJFF2);
        Cwu[] cwuArr = new Cwu[14];
        cwuArr[0] = CwZ.LIZ("request_page", LJFF2.LJIIIIZZ());
        cwuArr[1] = CwZ.LIZ("charge_reason", LJFF2.LJIIJ());
        cwuArr[2] = CwZ.LIZ("charge_style", "window");
        cwuArr[3] = CwZ.LIZ("panel_type", "normal");
        cwuArr[4] = CwZ.LIZ("gift_enter_from", LJFF2.LJIIJJI());
        cwuArr[5] = CwZ.LIZ("gift_send_type", LJFF2.LJIIL());
        cwuArr[6] = CwZ.LIZ("notification_type", HUQ.LIZ.LIZ(LJFF2.LJIIJJI()));
        cwuArr[7] = CwZ.LIZ("notification_request_id", HUQ.LIZ.LIZ(LJFF2.LJIIJJI(), LJFF2.LJIILIIL()));
        cwuArr[8] = CwZ.LIZ("pay_method", 16y.LJFF.LIZIZ());
        IGiftService LIZ20 = 0cm.LIZ(IGiftService.class);
        n.LIZIZ(LIZ20, "");
        boolean isFirstRecharge = LIZ20.isFirstRecharge();
        String str7 = "1";
        if (isFirstRecharge) {
            str = str7;
        } else {
            str = "0";
        }
        cwuArr[9] = CwZ.LIZ("is_first_recharge", str);
        cwuArr[10] = CwZ.LIZ("second_entrance", LJFF2.LJII());
        cwuArr[11] = CwZ.LIZ("timestamp", String.valueOf(GMS.LIZ()));
        if (!C1430G2l.LIZJ(dataChannel)) {
            str7 = "0";
        }
        cwuArr[12] = CwZ.LIZ("is_anchor", str7);
        cwuArr[13] = CwZ.LIZ("request_id", C2402Gbb.LIZ.LJIIJ());
        Map LIZ21 = LWw.LIZ(cwuArr);
        C3491GtA LIZ22 = C3491GtA.LJFF.LIZ("livesdk_recharge_show");
        LIZ22.LIZ((Map<String, String>) LIZ21);
        LIZ22.LIZ((Map<String, String>) map);
        LIZ22.LIZ(new C3441GsM(dataChannel, "user_live_duration"));
        LIZ22.LIZ(dataChannel);
        LIZ22.LIZLLL();
        DataChannel dataChannel2 = rechargeDialogNew.LJIILIIL;
        int LJIILJJIL = rechargeDialogNew.LJFF().LJIILJJIL();
        int LJIILL = rechargeDialogNew.LJFF().LJIILL();
        if (LJIILJJIL != 0) {
            C3491GtA LIZ23 = C3491GtA.LJFF.LIZ("livesdk_recharge_exchange_entrance_show");
            LIZ23.LIZ();
            LIZ23.LIZ("request_page", "live_detail");
            if (LJIILJJIL == -1) {
                str3 = "ug_exchange";
            } else {
                str3 = "anchor_income";
            }
            LIZ23.LIZ("charge_reason", str3);
            if (LJIILL == 2) {
                i = 1;
            } else {
                i = 0;
            }
            LIZ23.LIZ("could_exchange", i);
            LIZ23.LIZ("is_anchor", C1430G2l.LIZJ(dataChannel2) ? 1 : 0);
            LIZ23.LIZLLL();
        }
        if (rechargeDialogNew.LJFF().LJIJ()) {
            String LJIIJ = rechargeDialogNew.LJFF().LJIIJ();
            String LJIIIIZZ2 = rechargeDialogNew.LJFF().LJIIIIZZ();
            DataChannel dataChannel3 = rechargeDialogNew.LJIILIIL;
            AGn aGn3 = rechargeDialogNew.LIZJ;
            if (aGn3 != null) {
                map2 = aGn3.LIZIZ;
            } else {
                map2 = null;
            }
            M12.LIZ(LJIIJ, LJIIIIZZ2);
            Room room = (Room) DataChannelGlobal.LIZLLL.LIZIZ(HEP.class);
            C3491GtA LIZ24 = C3491GtA.LJFF.LIZ("livesdk_recharge_vip_channel_entrance_show");
            C3028Glh LIZIZ2 = C4100H7d.LIZ().LIZIZ();
            n.LIZIZ(LIZIZ2, "");
            LIZ24.LIZ("user_id", LIZIZ2.LIZJ());
            if (room != null) {
                l = Long.valueOf(room.getOwnerUserId());
            } else {
                l = null;
            }
            LIZ24.LIZ("anchor_id", String.valueOf(l));
            if (room != null) {
                str2 = room.getIdStr();
            } else {
                str2 = null;
            }
            LIZ24.LIZ("room_id", String.valueOf(str2));
            LIZ24.LIZ("charge_reason", LJIIJ);
            LIZ24.LIZ("request_page", LJIIIIZZ2);
            LIZ24.LIZ((Map<String, String>) map2);
            LIZ24.LIZ(dataChannel3);
            LIZ24.LIZ(new C3441GsM(dataChannel3, "user_live_duration"));
            LIZ24.LIZLLL();
        }
        ((C4366HHj) C2675Gg0.LIZ().LIZ(17C.class).LIZ(DEF.LIZ(rechargeDialogNew))).LIZ(new HV6(rechargeDialogNew));
        ((C4366HHj) C2675Gg0.LIZ().LIZ(C2851Giq.class).LIZ(DEF.LIZ(rechargeDialogNew))).LIZ(new HV7(rechargeDialogNew));
        rechargeDialogNew.LJFF().LJII.observe(rechargeDialogNew, new C1924GLl(rechargeDialogNew, view3));
        RechargeViewModel LJFF3 = rechargeDialogNew.LJFF();
        M12.LIZ(rechargeDialogNew);
        if (0cm.LIZ(IWalletService.class) != null) {
            ((C4366HHj) 0cm.LIZ(IWalletService.class).walletCenter().LIZ().LIZ(DEF.LIZ(rechargeDialogNew))).LIZ(new HV2(LJFF3));
            0cm.LIZ(IWalletService.class).walletCenter().LIZJ();
        } else {
            DataChannel dataChannel4 = LJFF3.LJIILLIIL;
            C3491GtA LIZ25 = C3491GtA.LJFF.LIZ("livesdk_recharge_service_error");
            LIZ25.LIZ(dataChannel4);
            LIZ25.LIZLLL();
        }
        rechargeDialogNew.LJFF().LIZJ();
        MethodCollector.o(11841);
    }

    private final void LIZ(Diamond diamond, HV5 hv5, boolean z) {
        String str;
        LJFF().LJIIZILJ();
        HVE hve = this.LIZIZ;
        if (hve != null) {
            hve.LIZ((long) diamond.LIZ);
        }
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel != null) {
            dataChannel.LIZIZ(29m.class, Integer.valueOf(diamond.LIZLLL));
        }
        if (z) {
            C2675Gg0.LIZ().LIZ((Object) new C2851Giq(diamond.LIZLLL));
        }
        C1313Fz8.LIZ(0b0.LJ(), 0b0.LIZ(2131833724), 0);
        LJFF().LIZ(diamond);
        HUQ huq = HUQ.LIZ;
        int i = diamond.LIZLLL;
        Map map = null;
        if (hv5 != null) {
            str = hv5.LIZIZ;
        } else {
            str = null;
        }
        String valueOf = String.valueOf(str);
        RechargeViewModel LJFF2 = LJFF();
        n.LIZIZ(LJFF2, "");
        DataChannel dataChannel2 = this.LJIILIIL;
        AGn aGn = this.LIZJ;
        if (aGn != null) {
            map = aGn.LIZIZ;
        }
        huq.LIZ(i, valueOf, LJFF2, dataChannel2, map);
        if (LJFF().LJIIIZ() == 0) {
            H8K.LIZ.LIZ(getActivity());
        }
        dismiss();
    }

    public final void LIZ(int i, int i2, Exception exc) {
        15m findViewById;
        M12.LIZ(exc);
        HVE hve = this.LIZIZ;
        if (hve != null) {
            String message = exc.getMessage();
            if (message == null) {
                message = "api exception";
            }
            hve.LIZ(0, i, message);
        }
        if (LJFF().LJIILJJIL() != 0) {
            LIZLLL();
            LIZ((DiamondPackageExtra) null, (List<Diamond>) new ArrayList());
            return;
        }
        View view = getView();
        if (!(view == null || (findViewById = view.findViewById(2131370625)) == null)) {
            findViewById.setStatus(2);
        }
        View view2 = getView();
        if (view2 != null) {
            view2.post(new C4696HUb(this, i, exc));
        }
        1gE r1 = this.LIZLLL;
        if (r1 != null) {
            r1.LIZ(Lel.INSTANCE);
        }
        1gE r12 = this.LIZLLL;
        if (r12 != null) {
            r12.LJ = new DiamondPackageExtra();
        }
        1gE r0 = this.LIZLLL;
        if (r0 != null) {
            r0.LIZJ();
        }
    }

    public final void LIZ(int i, int i2, int i3, Exception exc) {
        int i4;
        Exception exc2 = exc;
        M12.LIZ(exc2);
        HVE hve = this.LIZIZ;
        if (hve != null) {
            hve.LIZ(exc2, "fail_google_create_order_fail");
        }
        16q r1 = 16q.LIZ;
        String LJIIJ = LJFF().LJIIJ();
        Diamond diamond = LJFF().LJIIIZ;
        if (diamond != null) {
            i4 = diamond.LIZLLL;
        } else {
            i4 = 0;
        }
        r1.LIZ(new HV3(i, i2, i3, exc2, true, LJIIJ, i4, false), getContext());
    }
}
