package com.bytedance.android.livesdk.broadcast.interaction.widget.pause;

import X.0CB;
import X.0CH;
import X.1sU;
import X.6Is;
import X.C1185Fx4;
import X.C1430G2l;
import X.C3491GtA;
import X.C4338HGh;
import X.G9K;
import X.G9L;
import X.G9M;
import X.G9N;
import X.G9O;
import X.G9P;
import X.M12;
import android.os.SystemClock;
import android.view.View;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.widgets.LiveWidget;
import java.util.Locale;
import java.util.Objects;
import kotlin.h.b.n;

public final class PauseLiveWidget extends LiveWidget implements 6Is {
    public static final G9P LIZIZ = new G9P((byte) 0);
    public final G9M LIZ = new G9M(this);
    public long LIZJ;
    public final View LIZLLL;

    static {
        Covode.recordClassIndex(11978);
    }

    public final int getLayoutId() {
        return 2131562209;
    }

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

    public final void hide() {
        super.hide();
        C1430G2l.LIZJ(this.LIZLLL);
    }

    public final void show() {
        super.show();
        C1430G2l.LIZIZ(this.LIZLLL);
    }

    public final void onCreate() {
        1sU findViewById;
        super.onCreate();
        View view = getView();
        if (view != null) {
            view.setOnClickListener(G9L.LIZ);
        }
        View view2 = getView();
        if (!(view2 == null || (findViewById = view2.findViewById(2131362971)) == null)) {
            findViewById.setOnClickListener(new G9K(this));
        }
        DataChannel dataChannel = this.dataChannel;
        if (dataChannel != null) {
            dataChannel.LIZ((Object) this, C1185Fx4.class, new G9N(this));
        }
    }

    public PauseLiveWidget(View view) {
        M12.LIZ(view);
        this.LIZLLL = view;
    }

    public final void LIZ(G9O g9o) {
        boolean z;
        long elapsedRealtime;
        int i = 0;
        if (g9o == G9O.ENTER_PAGE) {
            z = true;
            elapsedRealtime = 0;
            if (1 != 0) {
                this.LIZJ = SystemClock.elapsedRealtime();
            }
            elapsedRealtime = (SystemClock.elapsedRealtime() - this.LIZJ) / 1000;
        } else {
            z = false;
            elapsedRealtime = (SystemClock.elapsedRealtime() - this.LIZJ) / 1000;
        }
        C3491GtA LIZ2 = C3491GtA.LJFF.LIZ("livesdk_live_pause_page");
        LIZ2.LIZ(this.dataChannel);
        String g9o2 = g9o.toString();
        Locale locale = Locale.ENGLISH;
        n.LIZIZ(locale, "");
        Objects.requireNonNull(g9o2, "null cannot be cast to non-null type java.lang.String");
        String lowerCase = g9o2.toLowerCase(locale);
        n.LIZIZ(lowerCase, "");
        LIZ2.LIZ("action_type", lowerCase);
        Integer num = (Integer) this.dataChannel.LIZIZ(C4338HGh.class);
        if (num != null) {
            i = num.intValue();
        }
        LIZ2.LIZ("viewers_cnt", i);
        if (!z) {
            LIZ2.LIZ("pause_duration", elapsedRealtime);
        }
        LIZ2.LIZLLL();
    }
}
