package com.bytedance.android.live.rank.impl.entrance;

import X.6Is;
import X.AnonymousClass0CB;
import X.AnonymousClass0CH;
import X.AnonymousClass12Q;
import X.AnonymousClass12R;
import X.AnonymousClass133;
import X.AnonymousClass15V;
import X.C263813k;
import X.C43681oE;
import X.Fv2;
import X.Gc2;
import X.Gc3;
import X.GpC;
import X.GtA;
import X.M12;
import android.widget.TextView;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.widgets.LiveRecyclableWidget;
import java.util.Objects;
import kotlin.h.b.n;

public final class RankEntranceWidget extends LiveRecyclableWidget implements Gc3, 6Is {
    public C43681oE LIZ;
    public AnonymousClass133 LIZIZ;
    public LiveDialogFragment LIZJ;
    public TextView LIZLLL;
    public AnonymousClass12R LJ;

    static {
        Covode.recordClassIndex(10163);
    }

    public final void LIZ(Throwable th) {
        Gc2.LIZ(this, th);
    }

    public final int getLayoutId() {
        return 2131561935;
    }

    public final void onStateChanged(AnonymousClass0CH r1, AnonymousClass0CB r2) {
        RankEntranceWidget.super.onStateChanged(r1, r2);
    }

    public final void LIZ() {
        hide();
        this.LIZIZ = null;
        LiveDialogFragment liveDialogFragment = this.LIZJ;
        if (liveDialogFragment != null) {
            liveDialogFragment.dismiss();
        }
    }

    public final String LJIIL() {
        return getClass().getName();
    }

    public final void onUnload() {
        LIZ();
        C43681oE r0 = this.LIZ;
        if (r0 == null) {
            n.LIZ("");
        }
        r0.f_();
        AnonymousClass12R r02 = this.LJ;
        if (r02 == null) {
            n.LIZ("");
        }
        AnonymousClass12Q r2 = r02.LIZ;
        r2.LJIIIIZZ = null;
        Runnable runnable = r2.LJIIJJI;
        if (runnable != null) {
            r2.LJIIJ.removeCallbacks(runnable);
        }
        C263813k.LIZ.clear();
        C263813k.LIZIZ.clear();
    }

    public final void onLoad(Object[] objArr) {
        LIZ();
        C43681oE r1 = this.LIZ;
        if (r1 == null) {
            n.LIZ("");
        }
        r1.LIZ(this);
    }

    /* JADX WARNING: type inference failed for: r2v1, types: [X.0CH] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onInit(java.lang.Object[] r5) {
        /*
            r4 = this;
            X.1oE r0 = new X.1oE
            r0.<init>()
            r4.LIZ = r0
            r0 = 2131369247(0x7f0a1d1f, float:1.8358467E38)
            android.view.View r1 = r4.findViewById(r0)
            java.lang.String r0 = ""
            kotlin.h.b.n.LIZIZ(r1, r0)
            android.widget.TextView r1 = (android.widget.TextView) r1
            r4.LIZLLL = r1
            android.view.View r1 = r4.getView()
            if (r1 == 0) goto L_0x0025
            X.12M r0 = new X.12M
            r0.<init>(r4)
            r1.setOnClickListener(r0)
        L_0x0025:
            X.12R r2 = new X.12R
            android.view.View r1 = r4.contentView
            java.lang.String r0 = "null cannot be cast to non-null type androidx.cardview.widget.CardView"
            java.util.Objects.requireNonNull(r1, r0)
            X.05A r1 = (X.AnonymousClass05A) r1
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r4.dataChannel
            r2.<init>(r1, r0)
            r4.LJ = r2
            com.bytedance.ies.sdk.datachannel.DataChannel r3 = r4.dataChannel
            if (r3 == 0) goto L_0x0046
            r2 = r4
            java.lang.Class<X.28K> r1 = X.AnonymousClass28K.class
            X.27k r0 = new X.27k
            r0.<init>(r4)
            r3.LIZ(r2, r1, r0)
        L_0x0046:
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.live.rank.impl.entrance.RankEntranceWidget.onInit(java.lang.Object[]):void");
    }

    public final void LIZ(AnonymousClass133 r6, boolean z) {
        GpC gpC;
        int i;
        String str;
        String str2;
        M12.LIZ(r6);
        if (!Objects.equals(this.LIZIZ, r6)) {
            if (z) {
                AnonymousClass133 r1 = this.LIZIZ;
                if (r1 != null) {
                    AnonymousClass12R r0 = this.LJ;
                    if (r0 == null) {
                        n.LIZ("");
                    }
                    r0.LIZ(r1, r6);
                    return;
                }
                return;
            }
            AnonymousClass133 r02 = this.LIZIZ;
            GpC gpC2 = null;
            if (r02 != null) {
                gpC = r02.LIZIZ;
            } else {
                gpC = null;
            }
            if (gpC != r6.LIZIZ) {
                GtA LIZ2 = GtA.LJFF.LIZ("livesdk_hourly_rank_entrance_show");
                LIZ2.LIZ(this.dataChannel);
                if (n.LIZ(this.dataChannel.LIZIZ(Fv2.class), true)) {
                    str = "anchor";
                } else {
                    str = "user";
                }
                LIZ2.LIZ("user_type", str);
                if (this.LIZIZ == null) {
                    str2 = "live_play";
                } else {
                    str2 = "rank_update";
                }
                LIZ2.LIZ("show_reason", str2);
                LIZ2.LIZ("rank_type", r6.LIZIZ.getRankName());
                LIZ2.LIZLLL();
            }
            AnonymousClass133 r12 = this.LIZIZ;
            if (r12 != null) {
                AnonymousClass12R r03 = this.LJ;
                if (r03 == null) {
                    n.LIZ("");
                }
                r03.LIZ(r12, r6);
                this.LIZIZ = r6;
                return;
            }
            this.LIZIZ = r6;
            TextView textView = this.LIZLLL;
            if (textView == null) {
                n.LIZ("");
            }
            textView.setText(r6.LIZJ);
            AnonymousClass133 r04 = this.LIZIZ;
            if (r04 != null) {
                gpC2 = r04.LIZIZ;
            }
            if (gpC2 == GpC.WEEKLY_ROOKIE_RANK) {
                i = 2131234817;
            } else {
                i = 2131234588;
            }
            if (AnonymousClass15V.LIZ(this.context)) {
                TextView textView2 = this.LIZLLL;
                if (textView2 == null) {
                    n.LIZ("");
                }
                textView2.setCompoundDrawablesWithIntrinsicBounds(0, 0, i, 0);
                return;
            }
            TextView textView3 = this.LIZLLL;
            if (textView3 == null) {
                n.LIZ("");
            }
            textView3.setCompoundDrawablesWithIntrinsicBounds(i, 0, 0, 0);
        }
    }
}
