package com.bytedance.android.livesdk.chatroom.end.newaudienceend;

import X.0CH;
import X.0HH;
import X.0Ul;
import X.0b0;
import X.0bg;
import X.0c0;
import X.0cm;
import X.0eM;
import X.0yx;
import X.1Fq;
import X.1Mn;
import X.1Om;
import X.1jk;
import X.1sP;
import X.292;
import X.2D0;
import X.2Rs;
import X.3Vj;
import X.C1187Fx6;
import X.C1781GFy;
import X.C1U;
import X.C2287GZk;
import X.C2385GbK;
import X.C2400GbZ;
import X.C2556Ge5;
import X.C2557Ge6;
import X.C2996GlB;
import X.C2999GlE;
import X.C3000GlF;
import X.C3002GlH;
import X.C3003GlI;
import X.C3004GlJ;
import X.C3005GlK;
import X.C3006GlL;
import X.C3007GlM;
import X.C3008GlN;
import X.C3009GlO;
import X.C3010GlP;
import X.C3011GlQ;
import X.C3014GlT;
import X.C3015GlU;
import X.C3016GlV;
import X.C3017GlW;
import X.C3020GlZ;
import X.C3024Gld;
import X.C3320GqP;
import X.C3491GtA;
import X.C4100H7d;
import X.C4282HEd;
import X.C4323HFs;
import X.C4343HGm;
import X.C5112HeD;
import X.C6455Hzs;
import X.GAX;
import X.GRC;
import X.GSF;
import X.HI6;
import X.HL0;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.fragment.app.Fragment;
import com.bytedance.android.live.base.model.ImageModel;
import com.bytedance.android.live.base.model.user.User;
import com.bytedance.android.live.microom.IMicRoomService;
import com.bytedance.android.livesdk.chatroom.api.EndPageRecommendRetrofitApi;
import com.bytedance.android.livesdk.chatroom.end.LiveEndFragment;
import com.bytedance.android.livesdk.livesetting.comment.LiveCommentSubOnlyAnimationInterval;
import com.bytedance.android.livesdk.livesetting.publicscreen.LiveChatShowDelayForHotLiveSetting;
import com.bytedance.android.livesdk.model.message.ControlMessage;
import com.bytedance.android.livesdk.model.message.PunishEventInfo;
import com.bytedance.android.livesdk.widget.LiveDebugInfoView;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.android.livesdkapi.host.IHostApp;
import com.bytedance.android.livesdkapi.host.IHostContext;
import com.bytedance.android.livesdkapi.session.EnterRoomConfig;
import com.bytedance.common.utility.collection.WeakHandler;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.datachannel.DataChannelGlobal;
import com.bytedance.ies.sdk.widgets.FluencyOpt;
import com.bytedance.ies.sdk.widgets.IWidgetProvider;
import com.bytedance.ies.sdk.widgets.LiveWidgetProvider;
import com.bytedance.ies.sdk.widgets.RecyclableWidgetManager;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

public class LiveNewAudienceEndFragment extends LiveEndFragment implements View.OnClickListener, C2557Ge6, C3005GlK, C1U {
    public Handler LIZLLL = new Handler(Looper.getMainLooper());
    public Room LJ;
    public C1U LJFF;
    public long LJI = 0;
    public View LJII;
    public 1jk LJIIIIZZ;
    public 1jk LJIIIZ;
    public int LJIIJ = 0;
    public volatile boolean LJIIJJI;
    public boolean LJIIL;
    public boolean LJIILIIL = false;
    public boolean LJIILJJIL = false;
    public Runnable LJIILL = new C3000GlF(this);
    public Runnable LJIILLIIL = new C2999GlE(this);
    public C2996GlB LJIIZILJ;
    public DataChannel LJIJ;
    public ControlMessage LJIJI;
    public PunishEventInfo LJIJJ;
    public 1jk LJIJJLI;
    public View LJIL;
    public View LJJ;
    public ImageView LJJI;
    public 1sP LJJIFFI;
    public C2556Ge5 LJJII;
    public 1jk LJJIII;
    public 1jk LJJIIJ;
    public ImageView LJJIIJZLJL;
    public View LJJIIZ;
    public 1Fq LJJIIZI;
    public 292 LJJIJ;
    public View LJJIJIIJI;
    public View LJJIJIIJIL;
    public ImageView LJJIJIL;
    public boolean LJJIJL;
    public final int LJJIJLIJ = 1;
    public final int LJJIL = 2;
    public final int LJJIZ = 3;
    public LiveDebugInfoView LJJJ;
    public RecyclableWidgetManager LJJJI;
    public boolean LJJJIL;
    public int LJJJJ = 0;
    public String LJJJJI;
    public long LJJJJIZL;
    public int LJJJJJ;
    public int LJJJJJL = 0;
    public String LJJJJL = "user_swipe";
    public long LJJJJLI = SystemClock.elapsedRealtime();
    public Runnable LJJJJLL = new C3009GlO(this);

    static {
        Covode.recordClassIndex(13480);
    }

    private boolean LJIIJJI() {
        return 0cm.LIZ(IHostApp.class).getPushLiveState();
    }

    private void LJIILIIL() {
        1jk r1 = this.LJIIIZ;
        if (r1 != null) {
            r1.setVisibility(4);
        }
    }

    public final void LIZJ() {
        Handler handler = this.LIZLLL;
        if (handler != null) {
            handler.removeCallbacksAndMessages((Object) null);
        }
    }

    public final boolean LJIIIIZZ() {
        C1U c1u = this.LJFF;
        if (c1u == null || !c1u.LJIIIIZZ()) {
            return false;
        }
        return true;
    }

    public void onPause() {
        super.onPause();
        Handler handler = this.LIZLLL;
        if (handler != null) {
            handler.removeCallbacksAndMessages((Object) null);
        }
        LJIIL();
    }

    private boolean LJIIJ() {
        return 0cm.LIZ(IHostApp.class).isNotificationEnabled(getContext());
    }

    private void LJIIL() {
        1jk r1 = this.LJIIIIZZ;
        if (r1 != null) {
            r1.setText(0b0.LIZ(2131828656));
        }
        LJIILIIL();
    }

    public final void LIZLLL() {
        this.LJJJJL = "auto_swipe";
        DataChannel dataChannel = this.LJIJ;
        if (dataChannel != null) {
            dataChannel.LIZIZ(C1187Fx6.class, Long.valueOf(this.LJI));
        }
        this.LJIIJ--;
        LJIILIIL();
    }

    public final void LJ() {
        this.LJIIL = true;
        this.LIZLLL.removeCallbacksAndMessages((Object) null);
        this.LJII.setVisibility(0);
        this.LIZLLL.post(this.LJIILLIIL);
    }

    public final /* synthetic */ void LJII() {
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_exit_liveroom_click");
        LIZ.LIZ(this.LJIJ);
        LIZ.LIZLLL();
        C3006GlL.LIZ("normal", this.LJIJ);
        LIZ();
    }

    public void onResume() {
        super.onResume();
        if (this.LJIIJJI) {
            Handler handler = this.LIZLLL;
            if (handler != null) {
                handler.removeCallbacksAndMessages((Object) null);
                return;
            }
            return;
        }
        LJIIIZ();
    }

    public final void LIZIZ() {
        1Fq r2;
        if (this.LJJIIJZLJL != null && (r2 = this.LJJIIZI) != null && this.LJJIJ != null) {
            r2.setVisibility(8);
            this.LJJIJ.setVisibility(8);
            this.LJJIIJZLJL.setVisibility(0);
            this.LJJIIJZLJL.setBackgroundResource(2131234932);
            LIZ(false);
        }
    }

    public final /* synthetic */ void LJFF() {
        LJIIL();
        this.LIZLLL.removeCallbacksAndMessages((Object) null);
        C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_finish_anchor_click");
        LIZ.LIZ(this.LJIJ);
        LIZ.LIZ("user_id", C4100H7d.LIZ().LIZIZ().LIZJ());
        LIZ.LIZLLL();
        LIZ(this.LJ);
    }

    public void onDestroy() {
        super.onDestroy();
        Handler handler = this.LIZLLL;
        if (handler != null) {
            handler.removeCallbacksAndMessages((Object) null);
        }
        C2996GlB glB = this.LJIIZILJ;
        if (glB.LIZ != null) {
            glB.LIZ.removeCallbacks(C3020GlZ.LIZ);
        }
        if (glB.LIZLLL != null) {
            glB.LIZLLL.LIZ.LIZ();
        }
    }

    private void LJIIIZ() {
        C2996GlB glB = this.LJIIZILJ;
        if (glB != null) {
            long j = this.LJI;
            if (glB.LIZ != null) {
                GRC.LIZ.LIZ(glB.LIZ, false, j, 4, 12);
            }
            C2996GlB glB2 = this.LJIIZILJ;
            long j2 = this.LJI;
            if (glB2.LIZ != null) {
                WeakHandler weakHandler = glB2.LIZ;
                ((EndPageRecommendRetrofitApi) 0yx.LIZ().LIZ(EndPageRecommendRetrofitApi.class)).getRecommendV2("live_end_recommend", "78", 4, 0, j2, 0).LIZ(new C6455Hzs()).LIZ(new C3024Gld(weakHandler), new 2Rs(weakHandler));
            }
            this.LJIILIIL = false;
        }
    }

    public final /* synthetic */ void LJI() {
        if (this.LJ != null) {
            this.LJJIIJZLJL.setVisibility(8);
            this.LJJIJ.setVisibility(0);
            IMicRoomService LIZ = 0cm.LIZ(IMicRoomService.class);
            if (LIZ == null || !LIZ.isMicRoomForRoom(this.LJ) || !LIZ.isMicAudience()) {
                C2996GlB glB = this.LJIIZILJ;
                Room room = this.LJ;
                String str = this.LIZIZ;
                if (room != null) {
                    glB.LIZLLL.LIZ(room.getOwner().getId(), room, str, new C3003GlI(glB));
                }
            } else {
                C2996GlB glB2 = this.LJIIZILJ;
                Room room2 = this.LJ;
                String str2 = this.LIZIZ;
                if (!(room2 == null || room2.officialChannelInfo == null || room2.officialChannelInfo.LIZ == null)) {
                    glB2.LIZLLL.LIZ(room2.officialChannelInfo.LIZ.getId(), room2, str2, new C3002GlH(glB2));
                }
            }
            this.LJJIJ.LIZ();
        }
        this.LJJIJL = true;
        LIZ(false);
    }

    public final void LIZ(ControlMessage controlMessage) {
        this.LJIJI = controlMessage;
        this.LJIJJ = null;
    }

    public final void LIZIZ(int i) {
        int i2 = 2131234733;
        if (i == 1) {
            i2 = 2131234734;
        } else if (i != 2 && i == 3) {
            i2 = 2131234735;
        }
        ImageView imageView = this.LJJIJIL;
        if (imageView != null) {
            imageView.setBackgroundResource(i2);
        }
    }

    public final String LIZJ(int i) {
        return 0b0.LIZ(2131828654, new Object[]{Integer.valueOf(i)});
    }

    public void setUserVisibleHint(boolean z) {
        super.setUserVisibleHint(z);
        this.LJIILJJIL = z;
        if (!z) {
            Handler handler = this.LIZLLL;
            if (handler != null) {
                handler.removeCallbacksAndMessages((Object) null);
            }
            LJIIL();
            C3006GlL.LIZ(this.LJJJJL, this.LJIJ);
            String str = this.LJJJJL;
            C3320GqP gqP = (C3320GqP) DataChannelGlobal.LIZLLL.LIZIZ(C4282HEd.class);
            if (gqP != null) {
                gqP.LJJJJI = 1;
                gqP.LJJJJLI = str;
            }
        } else if (!this.LJIIJJI) {
            LJIIIZ();
        }
    }

    public final void LIZJ(Room room) {
        if (room != null && this.LJJIIJZLJL != null && this.LJJIIZI != null && this.LJJIJ != null) {
            if (room.getOwner() == null || room.getOwner().getFollowInfo().getFollowStatus() == 1 || room.getOwner().getFollowInfo().getFollowStatus() == 2) {
                this.LJJIIJZLJL.setVisibility(8);
            } else {
                this.LJJIIJZLJL.setVisibility(0);
            }
            this.LJJIIZI.setVisibility(8);
            this.LJJIJ.setVisibility(8);
        }
    }

    private void LIZ(boolean z) {
        int intValue;
        String str;
        this.LJJIJIIJIL.setVisibility(8);
        if (z) {
            this.LJJIJIIJIL.setVisibility(0);
            if (!LJIIJ() || !LJIIJJI()) {
                this.LJJIJIL.setBackgroundResource(2131234735);
            }
        }
        if (!this.LJJIJL) {
            if (System.currentTimeMillis() - ((Long) C1781GFy.LLILZIL.LIZ()).longValue() < 1296000000 || (intValue = ((Integer) C1781GFy.LLILZLL.LIZ()).intValue()) > 3) {
                return;
            }
            if (!LJIIJ() || !LJIIJJI()) {
                C1781GFy.LLILZIL.LIZ(Long.valueOf(System.currentTimeMillis()));
                C1781GFy.LLILZLL.LIZ(Integer.valueOf(intValue + 1));
                Room room = this.LJ;
                String str2 = "-1";
                if (room == null || room.getOwner() == null) {
                    str = str2;
                } else {
                    str = String.valueOf(this.LJ.getOwner().getId());
                }
                Room room2 = this.LJ;
                if (room2 != null) {
                    str2 = String.valueOf(room2.getId());
                }
                C3491GtA LIZ = C3491GtA.LJFF.LIZ("livesdk_notification_setting_alert_show");
                LIZ.LIZ("enter_from_merge", "live_end");
                LIZ.LIZ("room_id", str2);
                LIZ.LIZ("anchor_id", str);
                LIZ.LIZLLL();
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:2:0x000b, code lost:
        r3 = r18;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0012, code lost:
        r4 = r0.getOwner();
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void onClick(android.view.View r19) {
        /*
            r18 = this;
            r13 = r19
            int r0 = r13.getId()
            r1 = 2131368131(0x7f0a18c3, float:1.8356203E38)
            if (r0 != r1) goto L_0x001e
            r3 = r18
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r3.LJ
            r5 = 0
            if (r0 == 0) goto L_0x001e
            com.bytedance.android.live.base.model.user.User r4 = r0.getOwner()
            if (r4 == 0) goto L_0x001e
            com.bytedance.android.live.base.model.user.FollowInfo r0 = r4.getFollowInfo()
            if (r0 != 0) goto L_0x001f
        L_0x001e:
            return
        L_0x001f:
            int r0 = r13.getId()
            if (r0 != r1) goto L_0x0046
            X.GtO r1 = X.C3491GtA.LJFF
            java.lang.String r0 = "livesdk_finish_bell_click"
            X.GtA r6 = r1.LIZ(r0)
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r3.LJIJ
            r6.LIZ((com.bytedance.ies.sdk.datachannel.DataChannel) r0)
            X.H7d r0 = X.C4100H7d.LIZ()
            X.Glh r0 = r0.LIZIZ()
            long r1 = r0.LIZJ()
            java.lang.String r0 = "user_id"
            r6.LIZ((java.lang.String) r0, (long) r1)
            r6.LIZLLL()
        L_0x0046:
            X.1jk r0 = r3.LJIJJLI
            if (r0 == 0) goto L_0x00e6
            java.lang.CharSequence r0 = r0.getText()
            boolean r0 = android.text.TextUtils.isEmpty(r0)
            if (r0 != 0) goto L_0x00e6
            X.1jk r0 = r3.LJIJJLI
            java.lang.CharSequence r0 = r0.getText()
            java.lang.String r10 = r0.toString()
        L_0x005e:
            com.bytedance.android.live.base.model.user.FollowInfo r0 = r4.getFollowInfo()
            long r0 = r0.getPushStatus()
            int r12 = (int) r0
            r7 = 1
            r3.LJIIJJI = r7
            X.Gji r15 = new X.Gji
            r15.<init>()
            long r0 = r4.getId()
            java.lang.String r0 = java.lang.String.valueOf(r0)
            r15.LIZIZ = r0
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r3.LJ
            long r0 = r0.getId()
            java.lang.String r0 = java.lang.String.valueOf(r0)
            r15.LIZ = r0
            java.lang.String r0 = "live_end"
            r15.LIZJ = r0
            java.lang.String r0 = "live_cover"
            r15.LIZLLL = r0
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r3.LJIJ
            java.lang.Class<X.HFX> r0 = X.HFX.class
            java.lang.Object r6 = r1.LIZIZ(r0)
            java.lang.Boolean r6 = (java.lang.Boolean) r6
            java.lang.Class<com.bytedance.android.livesdkapi.host.IHostApp> r0 = com.bytedance.android.livesdkapi.host.IHostApp.class
            X.0UT r8 = X.0cm.LIZ(r0)
            com.bytedance.android.livesdkapi.host.IHostApp r8 = (com.bytedance.android.livesdkapi.host.IHostApp) r8
            long r0 = r4.getId()
            java.lang.String r9 = java.lang.String.valueOf(r0)
            java.lang.String r11 = r4.getSecUid()
            r2 = 2131830042(0x7f11251a, float:1.929307E38)
            java.lang.Object[] r1 = new java.lang.Object[r7]
            r0 = 0
            r1[r0] = r10
            java.lang.String r14 = r3.getString(r2, r1)
            boolean r16 = r6.booleanValue()
            com.bytedance.android.livesdk.chatroom.end.newaudienceend.LiveNewAudienceEndFragment$2 r0 = new com.bytedance.android.livesdk.chatroom.end.newaudienceend.LiveNewAudienceEndFragment$2
            r0.<init>(r4)
            r17 = r0
            r8.showNotificationTipDialog(r9, r10, r11, r12, r13, r14, r15, r16, r17)
            android.os.Handler r0 = r3.LIZLLL
            if (r0 == 0) goto L_0x00e1
            r0.removeCallbacksAndMessages(r5)
            android.os.Handler r4 = r3.LIZLLL
            X.GlS r2 = new X.GlS
            r2.<init>(r3)
            com.bytedance.android.livesdk.livesetting.watchlive.liveend.LiveNewAudienceFinishPageSetting r0 = com.bytedance.android.livesdk.livesetting.watchlive.liveend.LiveNewAudienceFinishPageSetting.INSTANCE
            com.bytedance.android.livesdk.model.LiveNewAudienceEndModel r0 = r0.getValue()
            int r0 = r0.timeCountDown
            int r0 = r0 * 1000
            long r0 = (long) r0
            r4.postDelayed(r2, r0)
        L_0x00e1:
            r3.LJIIL()
            goto L_0x001e
        L_0x00e6:
            java.lang.String r10 = ""
            goto L_0x005e
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.end.newaudienceend.LiveNewAudienceEndFragment.onClick(android.view.View):void");
    }

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.LJIJ = GSF.LIZ((Fragment) this);
        C2996GlB glB = new C2996GlB(this);
        this.LJIIZILJ = glB;
        glB.LIZJ = this.LJFF;
        Bundle arguments = getArguments();
        if (arguments != null) {
            this.LJJJJ = arguments.getInt("room_position", -1);
            this.LJJJJI = arguments.getString("show_reason", "");
            this.LJJJJIZL = arguments.getLong("watch_live_duration", 0);
            this.LJIIL = arguments.getBoolean("can_swipe_next", false);
            this.LJJJJJ = arguments.getInt("live_end_reason", 0);
            this.LJJJJJL = arguments.getInt("enter_live_alive", 0);
        }
        DataChannel dataChannel = this.LJIJ;
        if (dataChannel != null) {
            dataChannel.LIZIZ((0CH) this, 2D0.class, new C3004GlJ(this));
            this.LJIJ.LIZ(C4323HFs.class, Integer.valueOf(this.LJJJJJ));
        }
        DataChannel dataChannel2 = this.LJIJ;
        if (dataChannel2 != null) {
            C3008GlN glN = (C3008GlN) dataChannel2.LIZIZ(C4343HGm.class);
            if (glN == null) {
                C3011GlQ glQ = new C3011GlQ();
                glN = new C3008GlN(glQ.LIZ, glQ.LIZIZ, glQ.LIZJ, glQ.LIZLLL, (byte) 0);
                this.LJIJ.LIZ(C4343HGm.class, glN);
            }
            C3320GqP gqP = (C3320GqP) DataChannelGlobal.LIZLLL.LIZIZ(C4282HEd.class);
            if (gqP != null) {
                gqP.LJJJJI = 1;
                gqP.LJJJJJ = gqP.LIZ;
                gqP.LJJJJIZL = gqP.LIZIZ;
                gqP.LJJJJJL = gqP.LJIILIIL;
                glN.LIZIZ = gqP.LIZ;
                glN.LIZ = gqP.LIZIZ;
                glN.LIZJ = gqP.LJIILIIL;
                if (TextUtils.equals("normal", this.LJJJJI) || this.LJJJJJL == 1) {
                    glN.LIZLLL = "live_end";
                    gqP.LJJJJL = "live_end";
                    return;
                }
                glN.LIZLLL = "recommend";
                gqP.LJJJJL = "recommend";
            }
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:20:0x0046  */
    /* JADX WARNING: Removed duplicated region for block: B:27:0x0071  */
    /* JADX WARNING: Removed duplicated region for block: B:62:0x0112  */
    /* JADX WARNING: Removed duplicated region for block: B:81:? A[RETURN, SYNTHETIC] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void LIZ(java.util.List<com.bytedance.android.livesdkapi.depend.model.live.Room> r9) {
        /*
            r8 = this;
            r2 = 1
            r8.LJIILIIL = r2
            X.1jk r0 = r8.LJIJJLI
            if (r0 == 0) goto L_0x0015
            X.Ge5 r0 = r8.LJJII
            if (r0 == 0) goto L_0x0015
            android.view.View r0 = r8.LJJIIZ
            if (r0 == 0) goto L_0x0015
            boolean r0 = X.878.LIZ(r9)
            if (r0 == 0) goto L_0x0016
        L_0x0015:
            return
        L_0x0016:
            android.content.Context r3 = r8.getContext()
            int r1 = X.0b0.LIZIZ()
            int r0 = X.0b0.LIZLLL()
            int r1 = r1 - r0
            float r1 = (float) r1
            X.1jk r0 = r8.LJIJJLI
            float r0 = r0.getY()
            float r1 = r1 - r0
            int r4 = X.C5112HeD.LIZJ(r3, r1)
            r0 = 549(0x225, float:7.7E-43)
            r3 = 0
            if (r4 >= r0) goto L_0x012a
            r7 = 1
        L_0x0035:
            r0 = 349(0x15d, float:4.89E-43)
            if (r4 >= r0) goto L_0x0127
            r1 = 1
        L_0x003a:
            if (r7 == 0) goto L_0x0122
            r0 = 420(0x1a4, float:5.89E-43)
            if (r4 <= r0) goto L_0x011a
            r0 = 1
            r7 = 0
        L_0x0042:
            r4 = 4
            r5 = 2
            if (r0 == 0) goto L_0x0112
            int r0 = r9.size()
            if (r0 < r4) goto L_0x0101
            if (r7 != 0) goto L_0x0101
            r0 = 1134559232(0x43a00000, float:320.0)
            int r6 = X.0b0.LIZ(r0)
        L_0x0054:
            android.view.View r0 = r8.LJIL
            r1 = 8
            r0.setVisibility(r1)
            android.view.View r0 = r8.LJJ
            r0.setVisibility(r1)
        L_0x0060:
            X.Ge5 r0 = r8.LJJII
            android.view.ViewGroup$LayoutParams r1 = r0.getLayoutParams()
            r1.height = r6
            X.Ge5 r0 = r8.LJJII
            r0.setLayoutParams(r1)
            X.Ge5 r6 = r8.LJJII
            if (r9 == 0) goto L_0x0015
            int r0 = r9.size()
            if (r0 == 0) goto L_0x0083
            java.util.List<android.view.View> r0 = r6.LIZIZ
            if (r0 == 0) goto L_0x0083
            java.util.List<android.view.View> r0 = r6.LIZIZ
            int r0 = r0.size()
            if (r0 == r4) goto L_0x00d6
        L_0x0083:
            int r0 = r9.size()
            if (r0 <= r2) goto L_0x0015
            android.os.Handler r0 = r8.LIZLLL
            if (r0 == 0) goto L_0x0015
            android.view.View r0 = r8.LJJIIZ
            r0.setVisibility(r3)
            X.1jk r1 = r8.LJIIIIZZ
            r0 = 2131828656(0x7f111fb0, float:1.929026E38)
            java.lang.String r0 = X.0b0.LIZ(r0)
            r1.setText(r0)
            com.bytedance.android.livesdk.livesetting.watchlive.liveend.LiveNewAudienceFinishPageSetting r0 = com.bytedance.android.livesdk.livesetting.watchlive.liveend.LiveNewAudienceFinishPageSetting.INSTANCE
            com.bytedance.android.livesdk.model.LiveNewAudienceEndModel r0 = r0.getValue()
            int r0 = r0.timeJumpRoom
            r8.LJIIJ = r0
            int r0 = r0 + r2
            r8.LJIIJ = r0
            java.lang.String r0 = r8.LIZJ
            if (r0 == 0) goto L_0x012d
            java.lang.String r1 = r8.LIZJ
            java.util.Locale r0 = java.util.Locale.US
            java.lang.String r1 = r1.toLowerCase(r0)
            java.lang.String r0 = "push"
            boolean r0 = r1.contains(r0)
            if (r0 == 0) goto L_0x012d
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r8.LJ
            if (r0 == 0) goto L_0x012d
            com.bytedance.android.live.base.model.user.User r0 = r0.getOwner()
            if (r0 == 0) goto L_0x012d
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = r8.LJ
            com.bytedance.android.live.base.model.user.User r0 = r0.getOwner()
            boolean r0 = r0.isFollowing()
            if (r0 == 0) goto L_0x012d
            return
        L_0x00d6:
            int r0 = r9.size()
            r1 = 3
            if (r0 > r1) goto L_0x00e7
            int r0 = r9.size()
            if (r0 < r5) goto L_0x00e7
            r6.LIZ((java.util.List<com.bytedance.android.livesdkapi.depend.model.live.Room>) r9, (int) r5)
            goto L_0x0083
        L_0x00e7:
            int r0 = r9.size()
            if (r0 <= r1) goto L_0x0083
            if (r7 == 0) goto L_0x00f3
            r6.LIZ((java.util.List<com.bytedance.android.livesdkapi.depend.model.live.Room>) r9, (int) r5)
            goto L_0x0083
        L_0x00f3:
            android.view.View r0 = r6.LJ
            r0.setVisibility(r3)
            android.view.View r0 = r6.LIZLLL
            r0.setVisibility(r3)
            r6.LIZ((java.util.List<com.bytedance.android.livesdkapi.depend.model.live.Room>) r9, (int) r4)
            goto L_0x0083
        L_0x0101:
            int r0 = r9.size()
            if (r0 < r5) goto L_0x010f
            r0 = 1126170624(0x43200000, float:160.0)
            int r6 = X.0b0.LIZ(r0)
            goto L_0x0054
        L_0x010f:
            r6 = 0
            goto L_0x0054
        L_0x0112:
            r0 = 1137246208(0x43c90000, float:402.0)
            int r6 = X.0b0.LIZ(r0)
            goto L_0x0060
        L_0x011a:
            r0 = 260(0x104, float:3.64E-43)
            if (r4 <= r0) goto L_0x0122
            r0 = 1
            r7 = 1
            goto L_0x0042
        L_0x0122:
            r0 = 0
            if (r1 != 0) goto L_0x0015
            goto L_0x0042
        L_0x0127:
            r1 = 0
            goto L_0x003a
        L_0x012a:
            r7 = 0
            goto L_0x0035
        L_0x012d:
            boolean r0 = r8.LJIIJJI
            if (r0 == 0) goto L_0x0132
            return
        L_0x0132:
            boolean r0 = r8.LJIIL
            if (r0 != 0) goto L_0x0137
            return
        L_0x0137:
            r8.LJ()
            goto L_0x0015
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.chatroom.end.newaudienceend.LiveNewAudienceEndFragment.LIZ(java.util.List):void");
    }

    public final void LIZIZ(Room room) {
        int i;
        View findViewById;
        View view;
        boolean z;
        User user;
        String str;
        ImageModel avatarLarge;
        String str2;
        String string;
        if (isAdded()) {
            Room room2 = room;
            this.LJ = room2;
            if (room2 == null || room2.getStats() == null) {
                i = 0;
            } else {
                i = room2.getStats().replayViewers;
            }
            if (i <= 0) {
                1jk r0 = this.LJJIII;
                if (r0 != null) {
                    r0.setVisibility(8);
                }
            } else {
                String str3 = 3Vj.LIZ((long) i) + " " + 0b0.LIZ(2131833815);
                1jk r02 = this.LJJIII;
                if (r02 != null) {
                    r02.setText(str3);
                }
            }
            if (!(this.LJJI == null || this.LJJIFFI == null || (view = this.LJJIJIIJI) == null)) {
                view.setVisibility(8);
                IMicRoomService LIZ = 0cm.LIZ(IMicRoomService.class);
                if (LIZ == null || !LIZ.isMicRoomForRoom(this.LJ) || !LIZ.isMicAudienceForRoom(this.LJ)) {
                    z = false;
                } else {
                    z = true;
                }
                Room room3 = this.LJ;
                ImageModel imageModel = null;
                if (room3 != null) {
                    user = room3.getOwner();
                    if (!(user == null || this.LIZLLL == null || this.LJIIIIZZ == null)) {
                        if (z) {
                            Room room4 = this.LJ;
                            if (!(room4 == null || room4.officialChannelInfo == null || this.LJ.officialChannelInfo.LIZ == null)) {
                                imageModel = this.LJ.officialChannelInfo.LIZ.getAvatarMedium();
                            }
                            HI6.LIZ(this.LJJI, imageModel, 2131234890);
                        } else {
                            HI6.LIZ(this.LJJI, user.getAvatarMedium(), 2131234890);
                        }
                        this.LJJI.setOnClickListener(new C3016GlV(this));
                        if (this.LJIJJLI != null) {
                            Room room5 = this.LJ;
                            if (room5 == null || room5.officialChannelInfo == null) {
                                str2 = "";
                            } else {
                                str2 = 0Ul.LIZ(this.LJ.officialChannelInfo.LIZ);
                            }
                            if (z) {
                                this.LJIJJLI.setText(str2);
                                string = getString(2131828747, new Object[]{str2});
                            } else {
                                String LIZ2 = 0Ul.LIZ(user);
                                this.LJIJJLI.setText(LIZ2);
                                string = getString(2131828747, new Object[]{LIZ2});
                            }
                            SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(string);
                            int length = spannableStringBuilder.length();
                            spannableStringBuilder.append(" " + getString(2131828748));
                            0eM.LIZ(getContext(), spannableStringBuilder, 0, length, 3, LiveChatShowDelayForHotLiveSetting.DEFAULT);
                            0eM.LIZ(getContext(), spannableStringBuilder, length + 1, spannableStringBuilder.length(), 3, LiveCommentSubOnlyAnimationInterval.DEFAULT);
                        }
                    }
                } else {
                    user = null;
                }
                float LIZ3 = ((float) C5112HeD.LIZ(getContext())) / ((float) C5112HeD.LIZIZ(getContext()));
                if (user != null) {
                    if (z) {
                        Room room6 = this.LJ;
                        if (!(room6 == null || room6.officialChannelInfo == null || this.LJ.officialChannelInfo.LIZ == null)) {
                            avatarLarge = this.LJ.officialChannelInfo.LIZ.getAvatarLarge();
                        }
                    } else if (user.getAvatarLarge() != null) {
                        avatarLarge = user.getAvatarLarge();
                    }
                    if (!(avatarLarge == null || avatarLarge.getUrls() == null || avatarLarge.getUrls().size() <= 0)) {
                        C2385GbK LIZ4 = 0bg.LIZ();
                        LIZ4.LIZ((List<String>) avatarLarge.getUrls());
                        LIZ4.LIZ(8, LIZ3);
                        LIZ4.LIZ((View) this.LJJIFFI);
                    }
                }
                Room room7 = this.LJ;
                if (!(room7 == null || this.LJJIIJZLJL == null || this.LJJIIZI == null || this.LJJIJ == null || room7.getOwner().getFollowInfo().getFollowStatus() == 1 || this.LJ.getOwner().getFollowInfo().getFollowStatus() == 2)) {
                    this.LJJIIJZLJL.setVisibility(0);
                    this.LJJIIZI.setVisibility(8);
                    this.LJJIJ.setVisibility(8);
                }
                if (!(user == null || user.getFollowInfo() == null)) {
                    if (user.getFollowInfo().getFollowStatus() == 1 || user.getFollowInfo().getFollowStatus() == 2) {
                        LIZ(true);
                    } else {
                        LIZ(false);
                    }
                }
                if (!(this.LJIIZILJ == null || user == null)) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("target_uid", String.valueOf(user.getId()));
                    hashMap.put("sec_target_uid", C4100H7d.LIZ().LIZIZ().LIZ(user.getId()));
                    hashMap.put("packed_level", "2");
                    hashMap.put("current_room_id", String.valueOf(this.LJ.getId()));
                    hashMap.put("request_from", "live_push_settings");
                    if (this.LJ.getOwner() != null) {
                        str = String.valueOf(this.LJ.getOwner().getId());
                    } else {
                        str = "0";
                    }
                    hashMap.put("anchor_id", str);
                    hashMap.put("sec_anchor_id", C4100H7d.LIZ().LIZIZ().LIZ(this.LJ.getOwnerUserId()));
                    C4100H7d.LIZ().LIZIZ().LIZ((HashMap<String, String>) hashMap).a_(new C3007GlM(this.LJIIZILJ, new C3017GlW() {
                        static {
                            Covode.recordClassIndex(13481);
                        }

                        public final void LIZ(User user) {
                            if (user != null && user.getFollowInfo() != null) {
                                LiveNewAudienceEndFragment.this.LIZIZ((int) user.getFollowInfo().getPushStatus());
                            }
                        }
                    }));
                }
            }
            if (this.LJ != null && getView() != null && 0cm.LIZ(IHostContext.class).isOffline() && (findViewById = getView().findViewById(2131363926)) != null) {
                findViewById.setVisibility(8);
                Boolean bool = C2287GZk.LIZ;
                if (bool != null && bool.booleanValue()) {
                    findViewById.setVisibility(0);
                    if (this.LJJJ == null) {
                        this.LJJJ = new LiveDebugInfoView();
                    }
                    if (!this.LJJJIL) {
                        this.LJJJ.setArgs(new Object[]{this.LJ});
                        this.LJJJIL = true;
                        this.LJJJI.load(2131363926, this.LJJJ);
                    }
                }
            }
        }
    }

    public void onViewCreated(View view, Bundle bundle) {
        super.onViewCreated(view, bundle);
        this.LJJJI = RecyclableWidgetManager.of((Fragment) this, view, false, (IWidgetProvider) LiveWidgetProvider.getInstance(), (FluencyOpt) 1Mn.LIZ);
        this.LJIL = LIZ(2131368557);
        this.LJJ = LIZ(2131368558);
        this.LJII = LIZ(2131368000);
        View LIZ = LIZ(2131367435);
        this.LJJIJIIJI = LIZ;
        LIZ.setVisibility(0);
        this.LJIJJLI = LIZ(2131362299);
        this.LJJI = (ImageView) LIZ(2131362279);
        this.LJJIFFI = LIZ(2131362590);
        C2556Ge5 ge5 = (C2556Ge5) LIZ(2131369351);
        this.LJJII = ge5;
        if (ge5 != null) {
            ge5.setDataChannel(this.LJIJ);
            this.LJJII.setIView(this);
        }
        this.LJJIII = LIZ(2131369565);
        this.LJJIIJ = LIZ(2131373081);
        this.LJIIIZ = LIZ(2131362853);
        this.LJJIIZ = LIZ(2131368077);
        this.LJIIIIZZ = LIZ(2131368086);
        this.LJIIIZ.setVisibility(4);
        if (!this.LJIIL) {
            this.LJII.setVisibility(4);
        }
        LIZ(2131363848).setOnClickListener(new C3014GlT(this));
        this.LJJIIJZLJL = (ImageView) LIZ(2131365101);
        this.LJJIIZI = LIZ(2131365090);
        292 LIZ2 = LIZ(2131365091);
        this.LJJIJ = LIZ2;
        LIZ2.LIZ(292.LIZ("tiktok_live_watch_resource", "ttlive_anim_follow_success.webp"));
        ImageView imageView = this.LJJIIJZLJL;
        if (!(imageView == null || this.LJJIIZI == null)) {
            imageView.setOnClickListener(new C3015GlU(this));
        }
        this.LJJIJIIJIL = LIZ(2131368131);
        this.LJJIJIL = (ImageView) LIZ(2131368132);
        this.LJJIJIIJIL.setOnClickListener(this);
        ControlMessage controlMessage = this.LJIJI;
        CharSequence charSequence = "";
        if (controlMessage != null) {
            charSequence = "";
            if (controlMessage.LJ != null) {
                CharSequence LIZ3 = HL0.LIZ(this.LJIJI.LJ, "");
                boolean isEmpty = TextUtils.isEmpty(LIZ3);
                charSequence = LIZ3;
                if (!isEmpty) {
                    this.LJIJJ = this.LJIJI.LJFF;
                    charSequence = LIZ3;
                }
            }
        }
        if (!TextUtils.isEmpty(charSequence)) {
            this.LJJIIJ.setText(charSequence);
            this.LJJIIJ.setVisibility(0);
            this.LJJIII.setVisibility(8);
        } else {
            this.LJJIIJ.setVisibility(8);
            this.LJJIII.setVisibility(0);
        }
        1Om.LIZ().LIZ(0);
        int i = this.LJJJJ;
        String str = this.LJJJJI;
        long j = this.LJJJJIZL;
        PunishEventInfo punishEventInfo = this.LJIJJ;
        HashMap hashMap = null;
        if (punishEventInfo != null) {
            hashMap = new HashMap();
            hashMap.put("record_id", punishEventInfo.LIZJ);
            hashMap.put("violation_type", punishEventInfo.LIZ);
            hashMap.put("violation_reason", punishEventInfo.LIZIZ);
        }
        EnterRoomConfig enterRoomConfig = GAX.LIZ.LIZ().LIZIZ;
        C3491GtA LIZ4 = C3491GtA.LJFF.LIZ("livesdk_finish_show");
        LIZ4.LIZ("room_position", i);
        LIZ4.LIZ("show_reason", str);
        LIZ4.LIZ("watch_live_duration", j);
        LIZ4.LIZ((Map<String, String>) hashMap);
        LIZ4.LIZ();
        LIZ4.LIZ("room_id", enterRoomConfig.LIZLLL.LJJJJZI);
        LIZ4.LIZLLL();
        C3010GlP.LIZIZ = this.LJJJJLI;
        long elapsedRealtime = SystemClock.elapsedRealtime();
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.putAll(C3010GlP.LIZ);
        long j2 = -1;
        if (C3010GlP.LIZIZ != -1) {
            j2 = elapsedRealtime - C3010GlP.LIZIZ;
        }
        linkedHashMap.put("duration", Long.valueOf(j2));
        String concat = "livesdk_live_audience_end_".concat("view_created");
        0c0.LIZ(concat, 0, linkedHashMap);
        linkedHashMap.put("event_name", concat);
        C2400GbZ.LIZIZ().LIZ("ttlive_live_end", linkedHashMap);
    }

    public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        return 0HH.LIZ(LayoutInflater.from(getContext()), 2131561739, viewGroup, false);
    }
}
