package com.bytedance.android.livesdk.mvp;

import X.0b0;
import X.0yx;
import X.1Mf;
import X.1jk;
import X.1sU;
import X.2K7;
import X.C1044Fun;
import X.C1601G9a;
import X.C1602G9b;
import X.C1605G9e;
import X.C1607G9g;
import X.C1608G9h;
import X.C1612G9l;
import X.C3026Glf;
import X.C3491GtA;
import X.C6455Hzs;
import X.G47;
import X.G4A;
import X.G4E;
import X.G9Z;
import X.GAX;
import X.M12;
import X.Mjy;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.view.View;
import android.widget.ImageView;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdkapi.session.EnterRoomConfig;
import com.bytedance.android.livesdkapi.session.EnterRoomLinkSession;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.util.HashMap;
import kotlin.h.b.n;

public final class PaidRoomCheckDialog extends LiveDialogFragment implements WeakHandler.IHandler {
    public static final C1605G9e LJIIJ = new C1605G9e((byte) 0);
    public boolean LIZ;
    public boolean LIZIZ = true;
    public String LIZJ = "";
    public InputFilter LIZLLL;
    public final Handler LJ = new WeakHandler(this);
    public boolean LJFF;
    public int LJI;
    public long LJII;
    public EnterRoomConfig LJIIIIZZ;
    public final TextWatcher LJIIIZ = new G47(this);
    public Mjy LJIIJJI = new Mjy();
    public HashMap LJIIZILJ;

    static {
        Covode.recordClassIndex(19667);
    }

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

    public final /* synthetic */ void onDestroyView() {
        super.onDestroyView();
        z_();
    }

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

    public static boolean LJ() {
        try {
            return 2K7.LIZ.LIZJ();
        } catch (Exception unused) {
            return false;
        }
    }

    public final C1044Fun LIZ() {
        C1044Fun fun = new C1044Fun(2131561565);
        fun.LIZ = 0;
        fun.LIZIZ = 2131887240;
        fun.LJI = 80;
        fun.LJIIIIZZ = -2;
        fun.LJ = false;
        return fun;
    }

    public final void LIZLLL() {
        getContext();
        if (LJ()) {
            1Mf LIZ2 = LIZ(2131364604);
            n.LIZIZ(LIZ2, "");
            LIZ2.setBackground(0b0.LIZJ(2131235189));
            1jk LIZ3 = LIZ(2131371242);
            n.LIZIZ(LIZ3, "");
            LIZ3.setText(0b0.LIZ(2131830684));
            1jk LIZ4 = LIZ(2131363684);
            n.LIZIZ(LIZ4, "");
            LIZ4.setText(0b0.LIZ(2131830579));
            return;
        }
        1Mf LIZ5 = LIZ(2131364604);
        n.LIZIZ(LIZ5, "");
        LIZ5.setBackground(0b0.LIZJ(2131235159));
        1jk LIZ6 = LIZ(2131371242);
        n.LIZIZ(LIZ6, "");
        LIZ6.setText(0b0.LIZ(2131829959));
        1jk LIZ7 = LIZ(2131363684);
        n.LIZIZ(LIZ7, "");
        LIZ7.setText(0b0.LIZ(2131829960) + " " + 0b0.LIZ(2131830579));
    }

    public final void handleMsg(Message message) {
        if (this.LJI >= 4) {
            1sU LIZ2 = LIZ(2131370808);
            n.LIZIZ(LIZ2, "");
            LIZ2.setEnabled(true);
        }
        this.LJFF = false;
    }

    public final void onCreate(Bundle bundle) {
        long j;
        super.onCreate(bundle);
        Bundle arguments = getArguments();
        if (arguments != null) {
            j = arguments.getLong("roomId");
        } else {
            j = 0;
        }
        this.LJII = j;
        C3026Glf glf = GAX.LIZ;
        n.LIZIZ(glf, "");
        EnterRoomLinkSession LIZ2 = glf.LIZ();
        n.LIZIZ(LIZ2, "");
        this.LJIIIIZZ = LIZ2.LIZIZ;
    }

    public final void onDismiss(DialogInterface dialogInterface) {
        C1608G9h g9h = new C1608G9h();
        g9h.LIZ = this.LIZ;
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel != null) {
            dataChannel.LIZIZ(C1607G9g.class, g9h);
        }
        super.onDismiss(dialogInterface);
        this.LJ.removeMessages(101);
        this.LJIIJJI.LIZ();
    }

    public final void LIZ(boolean z) {
        C1612G9l g9l = (C1612G9l) LIZ(2131367435);
        n.LIZIZ(g9l, "");
        g9l.setVisibility(0);
        this.LJIIJJI.LIZ(((PaidRoomApi) 0yx.LIZ().LIZ(PaidRoomApi.class)).queryRoomData(Long.valueOf(this.LJII)).LIZ(new C6455Hzs()).LIZ(new G9Z(this), new C1602G9b(this, z)));
    }

    public final void LIZ(String str) {
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        EnterRoomConfig.RoomsData roomsData;
        EnterRoomConfig.RoomsData roomsData2;
        EnterRoomConfig.LogData logData;
        EnterRoomConfig.LogData logData2;
        EnterRoomConfig.RoomsData roomsData3;
        EnterRoomConfig.RoomsData roomsData4;
        C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_event_gate_popup_continue");
        EnterRoomConfig enterRoomConfig = this.LJIIIIZZ;
        String str7 = null;
        if (enterRoomConfig == null || (roomsData4 = enterRoomConfig.LIZLLL) == null) {
            str2 = null;
        } else {
            str2 = roomsData4.LJJJJI;
        }
        LIZ2.LIZ("enter_from_merge", str2);
        EnterRoomConfig enterRoomConfig2 = this.LJIIIIZZ;
        if (enterRoomConfig2 == null || (roomsData3 = enterRoomConfig2.LIZLLL) == null) {
            str3 = null;
        } else {
            str3 = roomsData3.LJJJJJ;
        }
        LIZ2.LIZ("enter_method", str3);
        EnterRoomConfig enterRoomConfig3 = this.LJIIIIZZ;
        if (enterRoomConfig3 == null || (logData2 = enterRoomConfig3.LIZJ) == null) {
            str4 = null;
        } else {
            str4 = logData2.LIZIZ;
        }
        LIZ2.LIZ("anchor_id", str4);
        LIZ2.LIZ("room_id", this.LJII);
        EnterRoomConfig enterRoomConfig4 = this.LJIIIIZZ;
        if (enterRoomConfig4 == null || (logData = enterRoomConfig4.LIZJ) == null) {
            str5 = null;
        } else {
            str5 = logData.LIZ;
        }
        LIZ2.LIZ("request_id", str5);
        EnterRoomConfig enterRoomConfig5 = this.LJIIIIZZ;
        if (enterRoomConfig5 == null || (roomsData2 = enterRoomConfig5.LIZLLL) == null) {
            str6 = null;
        } else {
            str6 = roomsData2.LJJJJJL;
        }
        LIZ2.LIZ("action_type", str6);
        EnterRoomConfig enterRoomConfig6 = this.LJIIIIZZ;
        if (!(enterRoomConfig6 == null || (roomsData = enterRoomConfig6.LIZLLL) == null)) {
            str7 = roomsData.LJJIL;
        }
        LIZ2.LIZ("follow_status", str7);
        LIZ2.LIZLLL();
        LIZ(2131370808).LIZ();
        this.LJIIJJI.LIZ(((PaidRoomApi) 0yx.LIZ().LIZ(PaidRoomApi.class)).checkCode(str, Long.valueOf(this.LJII)).LIZ(new C6455Hzs()).LIZ(new G4A(this), new G4E(this)));
    }

    public final void onViewCreated(View view, Bundle bundle) {
        M12.LIZ(view);
        super.onViewCreated(view, bundle);
        ((ImageView) LIZ(2131363409)).setOnClickListener(new C1601G9a(this));
        LIZ(false);
    }
}
