package com.bytedance.android.livesdk.broadcast.video;

import X.0Bs;
import X.0Bv;
import X.0Bx;
import X.0By;
import X.0S6;
import X.0Uz;
import X.0VY;
import X.0aP;
import X.0b0;
import X.0cm;
import X.0ed;
import X.14D;
import X.154;
import X.158;
import X.1Mn;
import X.1f0;
import X.1hK;
import X.1jk;
import X.1kf;
import X.28O;
import X.2GD;
import X.2HN;
import X.2OJ;
import X.2sR;
import X.7vl;
import X.9c7;
import X.C0393Fed;
import X.C1064Fv7;
import X.C1430G2l;
import X.C1773GFq;
import X.C1781GFy;
import X.C1856GIv;
import X.C1872GJl;
import X.C1973GNi;
import X.C1U;
import X.C2060GQr;
import X.C2075GRg;
import X.C2078GRj;
import X.C2124GTd;
import X.C2137GTq;
import X.C2142GTv;
import X.C2143GTw;
import X.C2146GTz;
import X.C2159GUm;
import X.C2166GUt;
import X.C2289GZm;
import X.C2402Gbb;
import X.C2440GcD;
import X.C2675Gg0;
import X.C4049H5e;
import X.C4074H6d;
import X.C4307HFc;
import X.C4342HGl;
import X.C5627HmW;
import X.C5629HmY;
import X.Crj;
import X.GI0;
import X.GJG;
import X.GJU;
import X.GU0;
import X.GU1;
import X.GU5;
import X.GU6;
import X.GU9;
import X.GUA;
import X.GUB;
import X.GUC;
import X.GUD;
import X.GUG;
import X.GUI;
import X.GUV;
import X.GVD;
import X.H47;
import X.H6G;
import X.H6X;
import X.IKF;
import X.KB8;
import X.LsC;
import X.M12;
import X.Mjy;
import android.animation.ValueAnimator;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationSet;
import android.widget.FrameLayout;
import androidx.fragment.app.Fragment;
import com.bytedance.android.live.copyrightreview.helper.CopyrightViolationHelper;
import com.bytedance.android.live.function.IRoomFunctionService;
import com.bytedance.android.live.liveinteract.api.BaseLinkControlWidget;
import com.bytedance.android.livesdk.broadcast.interaction.widget.BroadcastFilterStyleWidget;
import com.bytedance.android.livesdk.broadcast.interaction.widget.live_center.LiveCenterEntranceWidget;
import com.bytedance.android.livesdk.broadcast.interaction.widget.netspeed.NetSpeedMonitorWidget;
import com.bytedance.android.livesdk.broadcast.video.layer.VideoLayeredElementManager;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveCenterLayoutStyleSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveEnableExtendedScreenSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LivePauseLiveSetting;
import com.bytedance.android.livesdk.livesetting.roomfunction.LiveWidgetSlardarSetting;
import com.bytedance.android.livesdk.model.message.RemindMessage;
import com.bytedance.android.livesdk.ui.BaseFragment;
import com.bytedance.android.livesdkapi.depend.model.live.Room;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import com.bytedance.ies.sdk.widgets.ConstraintProperty;
import com.bytedance.ies.sdk.widgets.LayeredElementManager;
import com.bytedance.ies.sdk.widgets.LayeredWidgetManager;
import com.bytedance.ies.sdk.widgets.LiveRecyclableWidget;
import com.bytedance.ies.sdk.widgets.LiveWidgetProvider;
import com.bytedance.ies.sdk.widgets.RecyclableWidgetManager;
import com.bytedance.ies.sdk.widgets.WidgetCreateTimeUtil;
import com.bytedance.sysoptimizer.ReceiverRegisterCrashOptimizer;
import com.bytedance.sysoptimizer.ReceiverRegisterLancet;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class VideoBroadcastInteractionFragment extends BaseFragment implements 1f0, C1U, C1872GJl {
    public static final GUG LJIIZILJ = new GUG((byte) 0);
    public AtomicBoolean LIZ = new AtomicBoolean(false);
    public boolean LIZIZ;
    public boolean LIZJ;
    public IKF LIZLLL;
    public BaseLinkControlWidget LJ;
    public NetSpeedMonitorWidget LJFF;
    public LiveCenterEntranceWidget LJI;
    public LiveRecyclableWidget LJII;
    public LiveRecyclableWidget LJIIIIZZ;
    public LiveRecyclableWidget LJIIIZ;
    public boolean LJIIJ;
    public boolean LJIIJJI;
    public C2166GUt LJIIL;
    public DataChannel LJIILIIL;
    public RecyclableWidgetManager LJIILJJIL;
    public Room LJIILL;
    public LayeredElementManager<1kf> LJIILLIIL;
    public boolean LJIJ;
    public BroadcastFilterStyleWidget LJIJI;
    public long LJIJJ = 500;
    public final Mjy LJIJJLI = new Mjy();
    public final Crj LJIL = 7vl.LIZ(new C2060GQr(this));
    public final Crj LJJ = 7vl.LIZ(new C2146GTz(this));
    public final Crj LJJI = 7vl.LIZ(GUA.LIZ);
    public final Crj LJJIFFI = 7vl.LIZ(new GU9(this));
    public final WidgetCreateTimeUtil LJJII = new WidgetCreateTimeUtil((LsC) null, 1, (2HN) null);
    public GVD LJJIII;
    public 14D LJJIIJ;
    public Runnable LJJIIJZLJL;
    public HashMap LJJIIZ;

    static {
        Covode.recordClassIndex(12706);
    }

    private final C1973GNi LJIILIIL() {
        return (C1973GNi) this.LJIL.getValue();
    }

    private final C2142GTv LJIILJJIL() {
        return (C2142GTv) this.LJJI.getValue();
    }

    public final void LIZ(int i) {
    }

    public final boolean LIZ(MotionEvent motionEvent, MotionEvent motionEvent2) {
        M12.LIZ(motionEvent, motionEvent2);
        return false;
    }

    public final View LIZJ(int i) {
        if (this.LJJIIZ == null) {
            this.LJJIIZ = new HashMap();
        }
        View view = (View) this.LJJIIZ.get(Integer.valueOf(i));
        if (view != null) {
            return view;
        }
        View view2 = getView();
        if (view2 == null) {
            return null;
        }
        View findViewById = view2.findViewById(i);
        this.LJJIIZ.put(Integer.valueOf(i), findViewById);
        return findViewById;
    }

    public final /* bridge */ /* synthetic */ Fragment LIZIZ() {
        return this;
    }

    public final boolean LIZ(MotionEvent motionEvent) {
        M12.LIZ(motionEvent);
        LIZJ(2131367163);
        return false;
    }

    public final boolean LIZ(MotionEvent motionEvent, MotionEvent motionEvent2, float f) {
        M12.LIZ(motionEvent, motionEvent2);
        boolean z = false;
        if (!LiveCenterLayoutStyleSetting.INSTANCE.enableNewStyle()) {
            return false;
        }
        Room room = this.LJIILL;
        if (room == null) {
            n.LIZ("");
        }
        if (LiveEnableExtendedScreenSetting.enable(room)) {
            return false;
        }
        float x = motionEvent2.getX() - motionEvent.getX();
        if (Math.abs(x) > 200.0f && Math.abs(f) > 100.0f) {
            z = true;
            C2675Gg0.LIZ().LIZ((Object) new 0VY(x > 0.0f ? 1 : 2));
        }
        return z;
    }

    public final void LJ() {
        GVD gvd = this.LJJIII;
        if (gvd == null) {
            n.LIZ("");
        }
        gvd.LIZIZ();
    }

    public final FrameLayout LJI() {
        return (FrameLayout) LIZJ(2131370664);
    }

    public final boolean LJIIIIZZ() {
        C2166GUt gUt = this.LJIIL;
        if (gUt == null) {
            n.LIZ("");
        }
        return gUt.LJIIIIZZ();
    }

    public final void LIZ() {
        C2166GUt gUt = this.LJIIL;
        if (gUt == null) {
            n.LIZ("");
        }
        gUt.LIZIZ();
    }

    public final void LIZJ() {
        GU5 gu5 = new GU5(new C2124GTd(this));
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        0ed.LIZ(gu5, dataChannel);
    }

    public final void LJIIJ() {
        RecyclableWidgetManager recyclableWidgetManager = this.LJIILJJIL;
        if (recyclableWidgetManager == null) {
            n.LIZ("");
        }
        recyclableWidgetManager.load(2131369708, GI0.LJIILL().getDonationStickerAnchorWidget());
    }

    public final void LJIIJJI() {
        RecyclableWidgetManager recyclableWidgetManager = this.LJIILJJIL;
        if (recyclableWidgetManager == null) {
            n.LIZ("");
        }
        BroadcastFilterStyleWidget broadcastFilterStyleWidget = new BroadcastFilterStyleWidget();
        this.LJIJI = broadcastFilterStyleWidget;
        recyclableWidgetManager.load(2131364877, broadcastFilterStyleWidget);
    }

    public final void LJIIL() {
        ((C0393Fed) LIZJ(2131362665)).post(new C2137GTq(this));
    }

    public final void onStop() {
        VideoBroadcastInteractionFragment.super.onStop();
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        dataChannel.LIZJ(28O.class, Float.valueOf(0.0f));
    }

    public final void onDestroy() {
        super.onDestroy();
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        dataChannel.LIZIZ((Object) this);
        C2166GUt gUt = this.LJIIL;
        if (gUt == null) {
            n.LIZ("");
        }
        gUt.LIZLLL();
        BluetoothAdapter.getDefaultAdapter().closeProfileProxy(2, 2OJ.LIZ);
        C1773GFq.LJIIIZ().LIZ();
        C2075GRg.LIZJ.LIZ(false, false);
        C2075GRg.LIZIZ = null;
    }

    public final void onDestroyView() {
        super.onDestroyView();
        this.LJJIIJZLJL = null;
        GVD gvd = this.LJJIII;
        if (gvd == null) {
            n.LIZ("");
        }
        gvd.LIZJ();
        this.LJJII.send();
        C2166GUt gUt = this.LJIIL;
        if (gUt == null) {
            n.LIZ("");
        }
        gUt.LIZJ();
        this.LJIJJLI.LIZ();
        GI0.LJIJ().releaseDrawGuess();
        C4074H6d.LIZ.LIZJ();
        HashMap hashMap = this.LJJIIZ;
        if (hashMap != null) {
            hashMap.clear();
        }
    }

    public final void onPause() {
        super.onPause();
        this.LIZ.set(true);
        try {
            Context context = getContext();
            if (context != null) {
                context.unregisterReceiver(LJIILJJIL());
            }
        } catch (Exception e) {
            0aP.LIZ(6, "VideoBroadcastInteractionFragment", "unregisterHeadsetReceiver " + e.getMessage());
        }
    }

    public final void LIZLLL() {
        LIZ(this.LJJIIJZLJL);
        long elapsedRealtime = SystemClock.elapsedRealtime();
        2sR<Long> r0 = C1781GFy.LJIIJJI;
        n.LIZIZ(r0, "");
        Long l = (Long) r0.LIZ();
        Room room = this.LJIILL;
        if (room == null) {
            n.LIZ("");
        }
        if (room.getId() > 0) {
            Room room2 = this.LJIILL;
            if (room2 == null) {
                n.LIZ("");
            }
            long id = room2.getId();
            2sR<Long> r02 = C1781GFy.LJIIJ;
            n.LIZIZ(r02, "");
            Long l2 = (Long) r02.LIZ();
            if (l2 != null && id == l2.longValue()) {
                n.LIZIZ(l, "");
                long longValue = l.longValue();
                if (1 <= longValue && elapsedRealtime > longValue) {
                    return;
                }
            }
        }
        2sR<Long> r2 = C1781GFy.LJIIJ;
        n.LIZIZ(r2, "");
        Room room3 = this.LJIILL;
        if (room3 == null) {
            n.LIZ("");
        }
        r2.LIZ(Long.valueOf(room3.getId()));
        2sR<Long> r1 = C1781GFy.LJIIJJI;
        n.LIZIZ(r1, "");
        r1.LIZ(Long.valueOf(elapsedRealtime));
    }

    public final void LJFF() {
        Context context = getContext();
        if (context != null) {
            n.LIZIZ(context, "");
            158 r2 = 158.EFFECT;
            DataChannel dataChannel = this.LJIILIIL;
            if (dataChannel == null) {
                n.LIZ("");
            }
            r2.load(dataChannel, new GJU(context));
            1hK activity = getActivity();
            if (activity != null) {
                158 r4 = 158.SHARE;
                DataChannel dataChannel2 = this.LJIILIIL;
                if (dataChannel2 == null) {
                    n.LIZ("");
                }
                154 shareBehavior = GI0.LJJ().getShareBehavior(activity, context, C1856GIv.VIDEO, this);
                n.LIZIZ(shareBehavior, "");
                r4.load(dataChannel2, shareBehavior);
            }
            if (LivePauseLiveSetting.INSTANCE.pauseLiveEnabled()) {
                158 r22 = 158.PAUSE_LIVE;
                DataChannel dataChannel3 = this.LJIILIIL;
                if (dataChannel3 == null) {
                    n.LIZ("");
                }
                r22.load(dataChannel3, new C2159GUm());
            }
        }
    }

    public final void LJII() {
        BroadcastFilterStyleWidget broadcastFilterStyleWidget;
        if (isViewValid() && (broadcastFilterStyleWidget = this.LJIJI) != null) {
            GUC LIZIZ2 = GI0.LIZLLL().LIZIZ();
            if (LIZIZ2.LIZ(GUD.HAS_SHOW_FILTER_GUIDE) || !LiveCenterLayoutStyleSetting.INSTANCE.enableNewStyle() || LiveEnableExtendedScreenSetting.enable((Room) broadcastFilterStyleWidget.dataChannel.LIZIZ(C1064Fv7.class))) {
                C1430G2l.LIZJ(broadcastFilterStyleWidget.LIZJ);
                return;
            }
            LIZIZ2.LIZIZ(GUD.HAS_SHOW_FILTER_GUIDE);
            C1430G2l.LIZIZ(broadcastFilterStyleWidget.LIZ);
            C1430G2l.LIZIZ(broadcastFilterStyleWidget.LIZIZ);
            1jk r1 = broadcastFilterStyleWidget.LIZLLL;
            if (r1 != null) {
                r1.setText(0b0.LIZ(2131834214));
            }
            View view = broadcastFilterStyleWidget.LIZJ;
            if (view != null) {
                view.setClickable(true);
                view.setVisibility(0);
                view.setOnClickListener(new GU1(view, broadcastFilterStyleWidget));
            }
        }
    }

    public final void LJIIIZ() {
        H47 h47;
        1kf layeredElementContext;
        ConstraintProperty constraintPropertyById;
        1kf layeredElementContext2;
        ConstraintProperty constraintPropertyById2;
        LayeredElementManager<1kf> layeredElementManager = this.LJIILLIIL;
        if (layeredElementManager == null || (layeredElementContext2 = layeredElementManager.getLayeredElementContext()) == null || (constraintPropertyById2 = layeredElementContext2.getConstraintPropertyById(H6G.LIZJ)) == null || constraintPropertyById2.visibility() != 8) {
            LiveRecyclableWidget liveRecyclableWidget = this.LJII;
            if (liveRecyclableWidget != null) {
                liveRecyclableWidget.show();
            }
            LiveRecyclableWidget liveRecyclableWidget2 = this.LJIIIIZZ;
            if (liveRecyclableWidget2 != null) {
                liveRecyclableWidget2.show();
            }
            LayeredElementManager<1kf> layeredElementManager2 = this.LJIILLIIL;
            if (!(layeredElementManager2 == null || (layeredElementContext = layeredElementManager2.getLayeredElementContext()) == null || (constraintPropertyById = layeredElementContext.getConstraintPropertyById(H6G.LIZJ)) == null)) {
                constraintPropertyById.visibility(8);
            }
            ((GUV) LIZJ(2131367163)).setBlockTouchEvent(true);
            LayeredElementManager<1kf> layeredElementManager3 = this.LJIILLIIL;
            if (layeredElementManager3 != null && (h47 = (H47) layeredElementManager3.getElementById(H6G.LIZIZ)) != null && !h47.LIZIZ) {
                ConstraintProperty constraintPropertyById3 = h47.LIZJ.getConstraintPropertyById(h47.getId());
                h47.LIZIZ = true;
                if (constraintPropertyById3 != null) {
                    ValueAnimator valueAnimator = (ValueAnimator) h47.LIZ.getValue();
                    valueAnimator.cancel();
                    valueAnimator.removeAllUpdateListeners();
                    valueAnimator.setFloatValues(new float[]{constraintPropertyById3.alpha(), 0.5f});
                    valueAnimator.addUpdateListener(new C2143GTw(h47, constraintPropertyById3));
                    valueAnimator.start();
                }
            }
        }
    }

    public final void onResume() {
        BluetoothAdapter defaultAdapter;
        super.onResume();
        if (this.LIZIZ) {
            DataChannel dataChannel = this.LJIILIIL;
            if (dataChannel == null) {
                n.LIZ("");
            }
            dataChannel.LIZJ(C2440GcD.class);
            this.LIZIZ = false;
        }
        this.LIZ.set(false);
        try {
            Context context = getContext();
            if (context != null) {
                C2142GTv LJIILJJIL2 = LJIILJJIL();
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("android.intent.action.HEADSET_PLUG");
                intentFilter.addAction("android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED");
                intentFilter.addAction("android.bluetooth.a2dp.profile.action.ACTIVE_DEVICE_CHANGED");
                intentFilter.addAction("android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED");
                LIZ(context, (BroadcastReceiver) LJIILJJIL2, intentFilter);
                LJIILJJIL();
                try {
                    if (!(!C2078GRj.LIZJ() || 2OJ.LIZ == null || (defaultAdapter = BluetoothAdapter.getDefaultAdapter()) == null)) {
                        defaultAdapter.getProfileProxy(context, new GU6(), 2);
                    }
                } catch (Exception e) {
                    0aP.LIZ(6, "HeadsetBroadcastReceiver", "initBluetoothA2dpProxy " + e.getMessage());
                }
            }
        } catch (IllegalArgumentException e2) {
            0aP.LIZ(6, "VideoBroadcastInteractionFragment", "registerHeadsetReceiver " + e2.getMessage());
        }
        C2078GRj.LIZ();
    }

    public final void LIZ(IKF ikf) {
        this.LIZLLL = ikf;
    }

    public static final /* synthetic */ DataChannel LIZ(VideoBroadcastInteractionFragment videoBroadcastInteractionFragment) {
        DataChannel dataChannel = videoBroadcastInteractionFragment.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        return dataChannel;
    }

    public static final /* synthetic */ RecyclableWidgetManager LIZIZ(VideoBroadcastInteractionFragment videoBroadcastInteractionFragment) {
        RecyclableWidgetManager recyclableWidgetManager = videoBroadcastInteractionFragment.LJIILJJIL;
        if (recyclableWidgetManager == null) {
            n.LIZ("");
        }
        return recyclableWidgetManager;
    }

    public final void onActivityCreated(Bundle bundle) {
        VideoBroadcastInteractionFragment.super.onActivityCreated(bundle);
        0Uz.LIZ("timer_start", String.valueOf(System.currentTimeMillis()));
        GU0 gu0 = new GU0(this, bundle);
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        0ed.LIZ(gu0, dataChannel);
    }

    public final void LIZ(RemindMessage remindMessage) {
        M12.LIZ(remindMessage);
        if (remindMessage.LIZIZ == 7 || remindMessage.LIZIZ == 6) {
            CopyrightViolationHelper copyrightViolationHelper = (CopyrightViolationHelper) this.LJJIFFI.getValue();
            Context context = getContext();
            Room room = this.LJIILL;
            if (room == null) {
                n.LIZ("");
            }
            copyrightViolationHelper.LIZ(context, remindMessage, room, this.LJIJJLI);
        }
    }

    public final void LIZIZ(int i) {
        int i2;
        NetSpeedMonitorWidget netSpeedMonitorWidget = this.LJFF;
        if (netSpeedMonitorWidget != null) {
            netSpeedMonitorWidget.LIZ(i);
        }
        LiveCenterEntranceWidget liveCenterEntranceWidget = this.LJI;
        if (liveCenterEntranceWidget != null) {
            if (i == 1 || i == 2) {
                i2 = liveCenterEntranceWidget.LIZLLL;
            } else if (i == 3) {
                i2 = liveCenterEntranceWidget.LJ;
            } else if (i == 4 || i == 5) {
                i2 = liveCenterEntranceWidget.LJFF;
            } else {
                i2 = 0;
            }
            if (liveCenterEntranceWidget.LIZ == 9c7.NONE) {
                liveCenterEntranceWidget.LIZIZ = liveCenterEntranceWidget.LJFF;
            } else if (i2 != 0) {
                liveCenterEntranceWidget.LIZIZ = i2;
            }
            C2675Gg0.LIZ().LIZ((Object) new GUI(liveCenterEntranceWidget.LIZIZ));
            if (liveCenterEntranceWidget.LIZJ != i2) {
                long currentTimeMillis = System.currentTimeMillis();
                JSONObject jSONObject = new JSONObject();
                jSONObject.put("room_id", String.valueOf(C2402Gbb.LIZ.LJIIIIZZ()));
                jSONObject.put("quality", i2);
                C5629HmY.LIZ(new C5627HmW("anchor_center_net_quality_changed", currentTimeMillis, new KB8(jSONObject)));
                liveCenterEntranceWidget.LIZJ = i2;
            }
        }
    }

    public final void LIZ(Runnable runnable) {
        if (getView() == null || runnable == null) {
            this.LJJIIJZLJL = runnable;
            return;
        }
        this.LJJIIJZLJL = null;
        View view = getView();
        if (view != null) {
            view.post(new GUB(runnable));
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:24:0x0062, code lost:
        if (r1 > ((float) r0.getBottom())) goto L_0x0064;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final boolean LIZIZ(android.view.MotionEvent r9) {
        /*
            r8 = this;
            X.M12.LIZ(r9)
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r8.LJIILIIL
            java.lang.String r5 = ""
            if (r0 != 0) goto L_0x000c
            kotlin.h.b.n.LIZ(r5)
        L_0x000c:
            com.bytedance.android.livesdkapi.depend.model.live.Room r0 = X.C1430G2l.LIZ((com.bytedance.ies.sdk.datachannel.DataChannel) r0)
            boolean r0 = X.0Zr.LIZ(r0)
            r2 = 0
            r7 = 1
            r6 = 2131368358(0x7f0a19a6, float:1.8356664E38)
            if (r0 == 0) goto L_0x00b2
            com.bytedance.ies.sdk.datachannel.DataChannel r0 = r8.LJIILIIL
            if (r0 != 0) goto L_0x0022
            kotlin.h.b.n.LIZ(r5)
        L_0x0022:
            boolean r0 = X.C1430G2l.LIZJ((com.bytedance.ies.sdk.datachannel.DataChannel) r0)
            if (r0 == 0) goto L_0x00b2
            boolean r0 = r8.LJIIJJI
            if (r0 == 0) goto L_0x00b2
            boolean r0 = r8.LJIIJ
            if (r0 == 0) goto L_0x0031
            return r7
        L_0x0031:
            int r0 = r9.getAction()
            if (r0 != 0) goto L_0x0043
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r8.LJIILIIL
            if (r1 != 0) goto L_0x003e
            kotlin.h.b.n.LIZ(r5)
        L_0x003e:
            java.lang.Class<X.28z> r0 = X.28z.class
            r1.LIZJ(r0)
        L_0x0043:
            com.bytedance.android.livesdk.livesetting.roomfunction.LiveDrawGuessGameAreaSettingSetting r0 = com.bytedance.android.livesdk.livesetting.roomfunction.LiveDrawGuessGameAreaSettingSetting.INSTANCE
            boolean r0 = r0.drawWithinDrawArea()
            if (r0 == 0) goto L_0x0065
            float r1 = r9.getY()
            r0 = 2131366100(0x7f0a10d4, float:1.8352084E38)
            android.view.View r0 = r8.LIZJ(r0)
            X.H5b r0 = (X.C4046H5b) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r0 = r0.getBottom()
            float r0 = (float) r0
            int r0 = (r1 > r0 ? 1 : (r1 == r0 ? 0 : -1))
            if (r0 <= 0) goto L_0x0065
        L_0x0064:
            return r7
        L_0x0065:
            X.GNi r0 = r8.LJIILIIL()
            boolean r0 = r0.LIZ()
            if (r0 == 0) goto L_0x0064
            X.GNi r4 = r8.LJIILIIL()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r3 = r0.getWidth()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r2 = r0.getHeight()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r1 = r0.getTop()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r0 = r0.getLeft()
            r4.LIZ(r3, r2, r1, r0)
            X.GNi r0 = r8.LJIILIIL()
            r0.LIZ((android.view.MotionEvent) r9)
            goto L_0x0064
        L_0x00b2:
            X.GNi r0 = r8.LJIILIIL()
            boolean r0 = r0.LIZ()
            if (r0 == 0) goto L_0x00ff
            X.GNi r4 = r8.LJIILIIL()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r3 = r0.getWidth()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r2 = r0.getHeight()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r1 = r0.getTop()
            android.view.View r0 = r8.LIZJ(r6)
            X.GZm r0 = (X.C2289GZm) r0
            kotlin.h.b.n.LIZIZ(r0, r5)
            int r0 = r0.getLeft()
            r4.LIZ(r3, r2, r1, r0)
            X.GNi r0 = r8.LJIILIIL()
            r0.LIZ((android.view.MotionEvent) r9)
            return r7
        L_0x00ff:
            com.bytedance.ies.sdk.datachannel.DataChannel r1 = r8.LJIILIIL
            if (r1 != 0) goto L_0x0106
            kotlin.h.b.n.LIZ(r5)
        L_0x0106:
            java.lang.Class<X.GPI> r0 = X.GPI.class
            java.lang.Object r1 = r1.LIZIZ(r0)
            X.GUh r0 = X.C2154GUh.DISMISS
            if (r1 != r0) goto L_0x011f
            X.Crj r0 = r8.LJJ
            java.lang.Object r0 = r0.getValue()
            android.view.ScaleGestureDetector r0 = (android.view.ScaleGestureDetector) r0
            boolean r0 = r0.onTouchEvent(r9)
            if (r0 != 0) goto L_0x011f
            return r7
        L_0x011f:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: com.bytedance.android.livesdk.broadcast.video.VideoBroadcastInteractionFragment.LIZIZ(android.view.MotionEvent):boolean");
    }

    public final void LIZ(boolean z) {
        this.LIZJ = z;
        BaseLinkControlWidget baseLinkControlWidget = this.LJ;
        if (baseLinkControlWidget != null) {
            baseLinkControlWidget.a_(z);
        }
    }

    public final void LIZ(DataChannel dataChannel, 14D r5) {
        M12.LIZ(dataChannel, r5);
        this.LJIILIIL = dataChannel;
        this.LJJIIJ = r5;
        Object LIZIZ2 = dataChannel.LIZIZ(C1064Fv7.class);
        if (LIZIZ2 == null) {
            n.LIZIZ();
        }
        this.LJIILL = (Room) LIZIZ2;
        DataChannel dataChannel2 = this.LJIILIIL;
        if (dataChannel2 == null) {
            n.LIZ("");
        }
        dataChannel2.LIZ(C4307HFc.class, C1856GIv.VIDEO);
    }

    /* JADX WARNING: type inference failed for: r9v0, types: [com.bytedance.ies.sdk.widgets.LayeredElementManager<X.1kf>, com.bytedance.android.livesdk.broadcast.video.layer.VideoLayeredElementManager, com.bytedance.ies.sdk.widgets.LayeredElementManager] */
    public final void onViewCreated(View view, Bundle bundle) {
        View view2 = view;
        M12.LIZ(view2);
        super.onViewCreated(view2, bundle);
        Context context = getContext();
        C4049H5e h5e = (C4049H5e) view2;
        DataChannel dataChannel = this.LJIILIIL;
        if (dataChannel == null) {
            n.LIZ("");
        }
        ? videoLayeredElementManager = new VideoLayeredElementManager(context, this, h5e, dataChannel);
        this.LJIILJJIL = LayeredWidgetManager.Companion.of(this, view2, false, LiveWidgetProvider.Companion.getInstance(), 1Mn.LIZ, videoLayeredElementManager);
        this.LJIILLIIL = videoLayeredElementManager;
        if (LiveWidgetSlardarSetting.INSTANCE.getValue()) {
            if (GI0.LIZIZ().isLocalTest()) {
                RecyclableWidgetManager recyclableWidgetManager = this.LJIILJJIL;
                if (recyclableWidgetManager == null) {
                    n.LIZ("");
                }
                recyclableWidgetManager.addRecyclableWidgetEventListener(new H6X());
            }
            RecyclableWidgetManager recyclableWidgetManager2 = this.LJIILJJIL;
            if (recyclableWidgetManager2 == null) {
                n.LIZ("");
            }
            recyclableWidgetManager2.addRecyclableWidgetEventListener(C4074H6d.LIZ.LIZ());
            RecyclableWidgetManager recyclableWidgetManager3 = this.LJIILJJIL;
            if (recyclableWidgetManager3 == null) {
                n.LIZ("");
            }
            recyclableWidgetManager3.addWidgetEventListener(C4074H6d.LIZ.LIZIZ());
        }
        Context context2 = getContext();
        RecyclableWidgetManager recyclableWidgetManager4 = this.LJIILJJIL;
        if (recyclableWidgetManager4 == null) {
            n.LIZ("");
        }
        C2166GUt gUt = new C2166GUt(context2, this, this, view2, recyclableWidgetManager4);
        DataChannel dataChannel2 = this.LJIILIIL;
        if (dataChannel2 == null) {
            n.LIZ("");
        }
        14D r1 = this.LJJIIJ;
        if (r1 == null) {
            n.LIZ("");
        }
        gUt.LIZ(dataChannel2, r1);
        gUt.LIZ(view2);
        this.LJIIL = gUt;
        Room room = this.LJIILL;
        if (room == null) {
            n.LIZ("");
        }
        Context context3 = getContext();
        DataChannel dataChannel3 = this.LJIILIIL;
        if (dataChannel3 == null) {
            n.LIZ("");
        }
        GVD gvd = new GVD(room, this, view2, context3, dataChannel3);
        gvd.LIZ();
        this.LJJIII = gvd;
        GUV guv = (GUV) LIZJ(2131367163);
        DataChannel dataChannel4 = this.LJIILIIL;
        if (dataChannel4 == null) {
            n.LIZ("");
        }
        guv.setDataChannel(dataChannel4);
        DataChannel dataChannel5 = this.LJIILIIL;
        if (dataChannel5 == null) {
            n.LIZ("");
        }
        C2075GRg.LIZIZ = dataChannel5;
        if (!LiveCenterLayoutStyleSetting.INSTANCE.enableNewStyle()) {
            ((GUV) LIZJ(2131367163)).setGestureDetectLayout((C2289GZm) LIZJ(2131368358));
        }
        IRoomFunctionService LIZ2 = 0cm.LIZ(IRoomFunctionService.class);
        0Bx LIZ3 = 0By.LIZ(this, (0Bv) null);
        if (2GD.LIZ) {
            0Bs.LIZ(LIZ3, this);
        }
        n.LIZIZ(LIZ3, "");
        GJG provideDialogDispatcher = LIZ2.provideDialogDispatcher(LIZ3);
        DataChannel dataChannel6 = this.LJIILIIL;
        if (dataChannel6 == null) {
            n.LIZ("");
        } else {
            dataChannel6.LIZ(C4342HGl.class, provideDialogDispatcher);
        }
    }

    public final void LIZ(String str, boolean z) {
        BroadcastFilterStyleWidget broadcastFilterStyleWidget;
        AnimationSet animationSet;
        if (isViewValid() && str != null && str.length() != 0) {
            if (!(!this.LJIJ || (broadcastFilterStyleWidget = this.LJIJI) == null || !broadcastFilterStyleWidget.isViewValid || str == null || str.length() == 0)) {
                1jk r0 = broadcastFilterStyleWidget.LIZLLL;
                if (r0 != null) {
                    r0.setText(str);
                }
                View view = broadcastFilterStyleWidget.LIZJ;
                if (view != null) {
                    view.clearAnimation();
                }
                View view2 = broadcastFilterStyleWidget.LIZJ;
                if (view2 != null) {
                    if (z) {
                        animationSet = (AnimationSet) broadcastFilterStyleWidget.LJ.getValue();
                    } else {
                        animationSet = (AnimationSet) broadcastFilterStyleWidget.LJFF.getValue();
                    }
                    view2.startAnimation(animationSet);
                }
            }
            this.LJIJ = true;
        }
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        C2166GUt gUt = this.LJIIL;
        if (gUt == null) {
            n.LIZ("");
        }
        gUt.LIZ(i, i2, intent);
    }

    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        M12.LIZ(layoutInflater);
        return 0S6.LIZ(0S6.LJFF, 2131561737, viewGroup);
    }

    public static Intent LIZ(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter) {
        if (ReceiverRegisterCrashOptimizer.fixedOpen()) {
            ReceiverRegisterCrashOptimizer.doHWReceiverFix();
        }
        try {
            if (ReceiverRegisterCrashOptimizer.doRegisterHandler()) {
                return context.registerReceiver(broadcastReceiver, intentFilter, (String) null, ReceiverRegisterLancet.sReceiverHandler);
            }
            return context.registerReceiver(broadcastReceiver, intentFilter);
        } catch (Exception e) {
            if (ReceiverRegisterCrashOptimizer.fixedOpen()) {
                return ReceiverRegisterCrashOptimizer.registerReceiver(broadcastReceiver, intentFilter);
            }
            throw e;
        }
    }
}
