package com.bytedance.android.live.toolbar;

import X.AnonymousClass0UT;
import X.AnonymousClass150;
import X.AnonymousClass158;
import X.AnonymousClass15A;
import X.BRR;
import X.C09160Ze;
import X.C10000b0;
import X.C11100cm;
import X.C267914z;
import X.Fun;
import X.Fv7;
import X.Gbb;
import X.GtA;
import X.HmW;
import X.HmY;
import X.Hmc;
import X.K4o;
import X.K4r;
import X.KB8;
import X.Kek;
import X.M12;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.DialogInterface;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import com.bytedance.android.live.browser.IBrowserService;
import com.bytedance.android.livesdk.LiveDialogFragment;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveCenterLayoutStyleSetting;
import com.bytedance.android.livesdk.model.RoomAuthStatus;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import java.util.HashMap;
import java.util.List;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class ToolbarButtonMoreDialogNew extends LiveDialogFragment implements Hmc {
    public static final C267914z LIZ = new C267914z((byte) 0);
    public final C09160Ze LIZIZ;
    public Kek LIZJ;
    public ValueAnimator LIZLLL;
    public long LJ;
    public final List<AnonymousClass158> LJFF;
    public final List<AnonymousClass158> LJI;
    public final DataChannel LJII;
    public HashMap LJIIIIZZ;

    static {
        Covode.recordClassIndex(10663);
    }

    /* JADX WARNING: type inference failed for: r3v0, types: [com.bytedance.android.live.toolbar.ToolbarButtonMoreDialogNew, androidx.fragment.app.Fragment] */
    public final View LIZ(int i) {
        if (this.LJIIIIZZ == null) {
            this.LJIIIIZZ = new HashMap();
        }
        View view = (View) this.LJIIIIZZ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJIIIIZZ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

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

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

    public final Fun LIZ() {
        Fun fun = new Fun(2131561638);
        fun.LIZ = 2;
        fun.LIZIZ = 2131887253;
        fun.LJI = 80;
        fun.LJIIIZ = 50;
        return fun;
    }

    /* JADX WARNING: type inference failed for: r2v0, types: [X.0CH] */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onCreate(android.os.Bundle r5) {
        /*
            r4 = this;
            com.bytedance.android.live.toolbar.ToolbarButtonMoreDialogNew.super.onCreate(r5)
            com.bytedance.ies.sdk.datachannel.DataChannel r3 = r4.LJII
            r2 = r4
            java.lang.Class<X.2D8> r1 = X.AnonymousClass2D8.class
            X.282 r0 = new X.282
            r0.<init>(r4)
            r3.LIZ(r2, r1, r0)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.live.toolbar.ToolbarButtonMoreDialogNew.onCreate(android.os.Bundle):void");
    }

    private final void LIZIZ(BRR brr) {
        float f;
        ValueAnimator duration;
        LinearLayout linearLayout = (LinearLayout) LIZ(2131369304);
        n.LIZIZ(linearLayout, "");
        ViewGroup.LayoutParams layoutParams = linearLayout.getLayoutParams();
        K4r k4r = brr.LIZIZ;
        if (k4r != null) {
            f = (float) K4o.LIZ(k4r, "height", 160);
        } else {
            f = 160.0f;
        }
        ValueAnimator ofInt = ObjectAnimator.ofInt(new int[]{layoutParams.height, C10000b0.LIZ(f)});
        this.LIZLLL = ofInt;
        if (ofInt != null) {
            ofInt.addUpdateListener(new AnonymousClass150(this, layoutParams));
        }
        ValueAnimator valueAnimator = this.LIZLLL;
        if (valueAnimator != null && (duration = valueAnimator.setDuration(300)) != null) {
            duration.start();
        }
    }

    public final void LIZ(BRR brr) {
        Boolean bool;
        Room room;
        RoomAuthStatus roomAuthStatus;
        M12.LIZ(brr);
        if (n.LIZ(brr.LIZ, "anchor_center_request_room_info")) {
            LIZIZ(brr);
            long currentTimeMillis = System.currentTimeMillis();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("room_id", String.valueOf(Gbb.LIZ.LJIIIIZZ()));
            DataChannel dataChannel = this.LJIILIIL;
            if (dataChannel == null || (room = (Room) dataChannel.LIZIZ(Fv7.class)) == null || (roomAuthStatus = room.getRoomAuthStatus()) == null) {
                bool = null;
            } else {
                bool = Boolean.valueOf(roomAuthStatus.isEnableGift());
            }
            jSONObject.put("gift_permission", bool);
            HmY.LIZ(new HmW("anchor_center_response_room_info", currentTimeMillis, new KB8(jSONObject)));
        }
        if (n.LIZ(brr.LIZ, "anchor_center_receive_flash_card")) {
            LIZIZ(brr);
        }
    }

    public final void onDismiss(DialogInterface dialogInterface) {
        ToolbarButtonMoreDialogNew.super.onDismiss(dialogInterface);
        AnonymousClass15A.POPUP.release(this.LJIILIIL);
        if (LiveCenterLayoutStyleSetting.INSTANCE.enableNewStyle()) {
            long currentTimeMillis = System.currentTimeMillis();
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("room_id", String.valueOf(Gbb.LIZ.LJIIIIZZ()));
            HmY.LIZ(new HmW("live_anchor_center_mask_will_disappear", currentTimeMillis, new KB8(jSONObject)));
            GtA LIZ2 = GtA.LJFF.LIZ("livesdk_live_center_leave");
            LIZ2.LIZ(this.LJIILIIL);
            LIZ2.LIZ("enter_type", "click_more");
            LIZ2.LIZ("duration", SystemClock.elapsedRealtime() - this.LJ);
            LIZ2.LIZLLL();
        }
        HmY.LIZIZ("anchor_center_request_room_info", this);
        HmY.LIZIZ("anchor_center_receive_flash_card", this);
        Kek kek = this.LIZJ;
        if (kek != null) {
            kek.LIZJ();
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r0v0, resolved type: com.bytedance.android.livesdk.LiveDialogFragment} */
    /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r1v11, resolved type: X.Hmc} */
    /* JADX WARNING: Multi-variable type inference failed */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final void onViewCreated(android.view.View r20, android.os.Bundle r21) {
        /*
            r19 = this;
            r10 = 10377(0x2889, float:1.4541E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r10)
            r2 = r20
            X.M12.LIZ(r2)
            r1 = r21
            r0 = r19
            com.bytedance.android.live.toolbar.ToolbarButtonMoreDialogNew.super.onViewCreated(r2, r1)
            r1 = 2131367722(0x7f0a172a, float:1.8355374E38)
            android.view.View r6 = r0.LIZ(r1)
            X.1jk r6 = (X.C40901jk) r6
            java.lang.String r5 = ""
            kotlin.h.b.n.LIZIZ(r6, r5)
            r7 = 1
            java.lang.Object[] r3 = new java.lang.Object[r7]
            r2 = 2
            java.lang.Integer r1 = java.lang.Integer.valueOf(r2)
            r4 = 0
            r3[r4] = r1
            r1 = 2131689757(0x7f0f011d, float:1.9008538E38)
            java.lang.String r1 = X.C10000b0.LIZ(r1, r2, r3)
            r6.setText(r1)
            X.15A r8 = X.AnonymousClass15A.POPUP
            com.bytedance.ies.sdk.datachannel.DataChannel r6 = r0.LJII
            r1 = 2131371331(0x7f0a2543, float:1.8362694E38)
            android.view.View r3 = r0.LIZ(r1)
            android.widget.LinearLayout r3 = (android.widget.LinearLayout) r3
            if (r3 != 0) goto L_0x0047
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r10)
            return
        L_0x0047:
            java.util.List<X.158> r2 = r0.LJFF
            X.15B r1 = X.AnonymousClass15B.ICON_TITLE_HORIZONTAL_ARROW
            r8.createHolder(r6, r3, r2, r1)
            X.15A r8 = X.AnonymousClass15A.POPUP
            com.bytedance.ies.sdk.datachannel.DataChannel r6 = r0.LJII
            r1 = 2131371332(0x7f0a2544, float:1.8362696E38)
            android.view.View r3 = r0.LIZ(r1)
            android.widget.LinearLayout r3 = (android.widget.LinearLayout) r3
            if (r3 != 0) goto L_0x0061
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r10)
            return
        L_0x0061:
            java.util.List<X.158> r2 = r0.LJI
            X.15B r1 = X.AnonymousClass15B.ICON_TITLE_HORIZONTAL_ARROW
            r8.createHolder(r6, r3, r2, r1)
            com.bytedance.android.livesdk.livesetting.broadcast.LiveCenterLayoutStyleSetting r1 = com.bytedance.android.livesdk.livesetting.broadcast.LiveCenterLayoutStyleSetting.INSTANCE
            boolean r1 = r1.enableNewStyle()
            if (r1 == 0) goto L_0x01a2
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r0.LJIILIIL
            if (r2 == 0) goto L_0x01a2
            java.lang.Class<X.Fv7> r1 = X.Fv7.class
            java.lang.Object r1 = r2.LIZIZ(r1)
            com.bytedance.android.livesdkapi.depend.model.live.Room r1 = (com.bytedance.android.livesdkapi.depend.model.live.Room) r1
            if (r1 == 0) goto L_0x01a2
            X.GIv r1 = r1.getStreamType()
            if (r1 == 0) goto L_0x01a2
            boolean r1 = X.G1a.LIZIZ(r1)
            if (r1 != r7) goto L_0x01a2
            r3 = 2131369304(0x7f0a1d58, float:1.8358582E38)
            android.view.View r1 = r0.LIZ(r3)
            android.widget.LinearLayout r1 = (android.widget.LinearLayout) r1
            kotlin.h.b.n.LIZIZ(r1, r5)
            r1.setVisibility(r4)
            com.bytedance.android.livesdk.livesetting.broadcast.BroadcastLiveCenterUrl r1 = com.bytedance.android.livesdk.livesetting.broadcast.BroadcastLiveCenterUrl.INSTANCE
            java.lang.String r1 = r1.getValue()
            android.net.Uri r1 = android.net.Uri.parse(r1)
            android.net.Uri$Builder r4 = r1.buildUpon()
            com.bytedance.ies.sdk.datachannel.DataChannel r2 = r0.LJIILIIL
            r9 = 0
            if (r2 == 0) goto L_0x01d2
            java.lang.Class<X.Fv7> r1 = X.Fv7.class
            java.lang.Object r1 = r2.LIZIZ(r1)
            com.bytedance.android.livesdkapi.depend.model.live.Room r1 = (com.bytedance.android.livesdkapi.depend.model.live.Room) r1
            if (r1 == 0) goto L_0x01d2
            long r1 = r1.getId()
            java.lang.Long r1 = java.lang.Long.valueOf(r1)
        L_0x00be:
            java.lang.String r2 = java.lang.String.valueOf(r1)
            java.lang.String r1 = "room_id"
            android.net.Uri$Builder r8 = r4.appendQueryParameter(r1, r2)
            com.bytedance.ies.sdk.datachannel.DataChannel r4 = r0.LJIILIIL
            if (r4 == 0) goto L_0x01cf
            java.lang.Class<X.Fv7> r2 = X.Fv7.class
            java.lang.Object r2 = r4.LIZIZ(r2)
            com.bytedance.android.livesdkapi.depend.model.live.Room r2 = (com.bytedance.android.livesdkapi.depend.model.live.Room) r2
            if (r2 == 0) goto L_0x01cf
            com.bytedance.android.live.base.model.user.User r2 = r2.getOwner()
            if (r2 == 0) goto L_0x01cf
            long r6 = r2.getId()
            java.lang.Long r2 = java.lang.Long.valueOf(r6)
        L_0x00e4:
            java.lang.String r4 = java.lang.String.valueOf(r2)
            java.lang.String r2 = "anchor_id"
            android.net.Uri$Builder r6 = r8.appendQueryParameter(r2, r4)
            com.bytedance.ies.sdk.datachannel.DataChannel r4 = r0.LJIILIIL
            if (r4 == 0) goto L_0x010a
            java.lang.Class<X.Fv7> r2 = X.Fv7.class
            java.lang.Object r2 = r4.LIZIZ(r2)
            com.bytedance.android.livesdkapi.depend.model.live.Room r2 = (com.bytedance.android.livesdkapi.depend.model.live.Room) r2
            if (r2 == 0) goto L_0x010a
            com.bytedance.android.livesdk.model.RoomAuthStatus r2 = r2.getRoomAuthStatus()
            if (r2 == 0) goto L_0x010a
            boolean r2 = r2.isEnableGift()
            java.lang.Boolean r9 = java.lang.Boolean.valueOf(r2)
        L_0x010a:
            java.lang.String r4 = java.lang.String.valueOf(r9)
            java.lang.String r2 = "gift_permission"
            android.net.Uri$Builder r6 = r6.appendQueryParameter(r2, r4)
            java.lang.String r4 = "is_in_native"
            java.lang.String r2 = "1"
            android.net.Uri$Builder r2 = r6.appendQueryParameter(r4, r2)
            android.net.Uri r4 = r2.build()
            java.lang.String r13 = r4.toString()
            kotlin.h.b.n.LIZIZ(r13, r5)
            java.lang.Class<com.bytedance.android.livesdkapi.host.IHostAction> r2 = com.bytedance.android.livesdkapi.host.IHostAction.class
            X.0UT r2 = X.C11100cm.LIZ(r2)
            com.bytedance.android.livesdkapi.host.IHostAction r2 = (com.bytedance.android.livesdkapi.host.IHostAction) r2
            boolean r2 = r2.hostInterceptSpark(r13)
            if (r2 == 0) goto L_0x01b1
            android.content.Context r12 = r0.getContext()
            if (r12 == 0) goto L_0x0160
            java.lang.Class<com.bytedance.android.live.browser.IHybridContainerService> r2 = com.bytedance.android.live.browser.IHybridContainerService.class
            X.0UT r11 = X.C11100cm.LIZ(r2)
            com.bytedance.android.live.browser.IHybridContainerService r11 = (com.bytedance.android.live.browser.IHybridContainerService) r11
            kotlin.h.b.n.LIZIZ(r12, r5)
            r14 = 0
            r15 = 0
            r16 = 0
            r17 = 0
            r18 = 60
            X.Kek r2 = X.AnonymousClass0ZZ.LIZ(r11, r12, r13, r14, r15, r16, r17, r18)
            r0.LIZJ = r2
            android.view.View r4 = r0.LIZ(r3)
            android.widget.LinearLayout r4 = (android.widget.LinearLayout) r4
            X.Kek r3 = r0.LIZJ
            r2 = -1
            r4.addView(r3, r2, r2)
        L_0x0160:
            long r3 = java.lang.System.currentTimeMillis()
            org.json.JSONObject r7 = new org.json.JSONObject
            r7.<init>()
            X.Gbb r2 = X.Gbb.LIZ
            long r5 = r2.LJIIIIZZ()
            java.lang.String r2 = java.lang.String.valueOf(r5)
            r7.put(r1, r2)
            X.KB8 r5 = new X.KB8
            r5.<init>(r7)
            X.HmW r2 = new X.HmW
            java.lang.String r1 = "live_anchor_center_mask_will_appear"
            r2.<init>(r1, r3, r5)
            X.HmY.LIZ(r2)
            X.GtO r2 = X.GtA.LJFF
            java.lang.String r1 = "livesdk_live_center_show"
            X.GtA r3 = r2.LIZ(r1)
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r0.LJII
            r3.LIZ(r1)
            java.lang.String r2 = "enter_type"
            java.lang.String r1 = "click_more"
            r3.LIZ(r2, r1)
            r3.LIZLLL()
            long r1 = android.os.SystemClock.elapsedRealtime()
            r0.LJ = r1
        L_0x01a2:
            r1 = r0
            java.lang.String r0 = "anchor_center_request_room_info"
            X.HmY.LIZ(r0, r1)
            java.lang.String r0 = "anchor_center_receive_flash_card"
            X.HmY.LIZ(r0, r1)
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r10)
            return
        L_0x01b1:
            X.0Ze r2 = r0.LIZIZ
            if (r2 == 0) goto L_0x0160
            java.lang.String r4 = r4.toString()
            android.view.View r6 = r0.LIZ(r3)
            android.widget.LinearLayout r6 = (android.widget.LinearLayout) r6
            kotlin.h.b.n.LIZIZ(r6, r5)
            X.1oP r7 = new X.1oP
            r7.<init>()
            java.lang.String r3 = "lynx"
            java.lang.String r5 = ""
            r2.LIZ(r3, r4, r5, r6, r7)
            goto L_0x0160
        L_0x01cf:
            r2 = r9
            goto L_0x00e4
        L_0x01d2:
            r1 = r9
            goto L_0x00be
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.live.toolbar.ToolbarButtonMoreDialogNew.onViewCreated(android.view.View, android.os.Bundle):void");
    }

    public ToolbarButtonMoreDialogNew(List<? extends AnonymousClass158> list, List<? extends AnonymousClass158> list2, DataChannel dataChannel) {
        M12.LIZ(list, list2, dataChannel);
        this.LJFF = list;
        this.LJI = list2;
        this.LJII = dataChannel;
        AnonymousClass0UT LIZ2 = C11100cm.LIZ(IBrowserService.class);
        n.LIZIZ(LIZ2, "");
        this.LIZIZ = ((IBrowserService) LIZ2).getHybridContainerManager();
    }
}
