package com.bytedance.android.livesdk.chatroom.widget;

import X.0CB;
import X.0CH;
import X.6Is;
import X.BRR;
import X.C1702GCx;
import X.C1703GCy;
import X.C1704GCz;
import X.C3491GtA;
import X.C5629HmY;
import X.C5633Hmc;
import X.C6455Hzs;
import X.GD0;
import X.GD1;
import X.HEW;
import X.K4r;
import X.M12;
import android.os.CountDownTimer;
import android.view.View;
import com.bytedance.android.live.broadcast.api.LiveIntroApi;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.LiveWidget;
import kotlin.h.b.n;

public final class LiveCloseWidget extends LiveWidget implements C5633Hmc, 6Is {
    public boolean LIZ;
    public CountDownTimer LIZIZ;

    static {
        Covode.recordClassIndex(14685);
    }

    public final int getLayoutId() {
        return 2131562199;
    }

    public final void onStateChanged(0CH r1, 0CB r2) {
        super.onStateChanged(r1, r2);
    }

    public final void LIZ() {
        GD0 gd0 = new GD0(this);
        this.LIZIZ = gd0;
        gd0.start();
    }

    public final void onCreate() {
        super.onCreate();
        C5629HmY.LIZ("live_anchor_room_intro_switch", (C5633Hmc) this);
        ((LiveIntroApi) GD1.LIZIZ.LIZ().LIZ(LiveIntroApi.class)).getLiveIntroData().LIZ(new C6455Hzs()).LIZ(new C1702GCx(this), C1704GCz.LIZ);
        View view = getView();
        if (view != null) {
            view.setOnClickListener(new C1703GCy(this));
        }
        show();
    }

    public final void onDestroy() {
        super.onDestroy();
        C5629HmY.LIZIZ("live_anchor_room_intro_switch", (C5633Hmc) this);
        if (this.LIZ) {
            C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_anchor_room_detail_effective_use");
            LIZ2.LIZ(this.dataChannel);
            LIZ2.LIZ("live_type", (String) DataChannelGlobal.LIZLLL.LIZIZ(HEW.class));
            LIZ2.LIZLLL();
        }
        CountDownTimer countDownTimer = this.LIZIZ;
        if (countDownTimer != null) {
            countDownTimer.cancel();
        }
    }

    public final void LIZ(BRR brr) {
        M12.LIZ(brr);
        if (n.LIZ(brr.LIZ, "live_anchor_room_intro_switch")) {
            K4r k4r = brr.LIZIZ;
            if (k4r == null || !k4r.LIZJ("is_turn_on")) {
                CountDownTimer countDownTimer = this.LIZIZ;
                if (countDownTimer != null) {
                    countDownTimer.cancel();
                    return;
                }
                return;
            }
            CountDownTimer countDownTimer2 = this.LIZIZ;
            if (countDownTimer2 != null) {
                countDownTimer2.cancel();
            }
            LIZ();
        }
    }
}
