package com.bytedance.android.livesdk.broadcast.preview.widget;

import X.0AA;
import X.0CB;
import X.0CH;
import X.0aP;
import X.0b0;
import X.0bI;
import X.0cm;
import X.1hK;
import X.6Is;
import X.C1376G0j;
import X.C1393G1a;
import X.C1856GIv;
import X.C2206GWh;
import X.C3463Gsi;
import X.C3491GtA;
import X.C3547Gu4;
import X.C3598Gut;
import X.C3935H0u;
import X.GAS;
import X.GGC;
import X.GI0;
import X.LsC;
import X.M12;
import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import com.bytedance.android.live.browser.IHybridContainerService;
import com.bytedance.android.live.core.widget.BaseDialogFragment;
import com.bytedance.android.livesdk.broadcast.preview.base.PreviewToolBaseWidget;
import com.bytedance.android.livesdk.livesetting.broadcast.BroadcastHelpNewUrlSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.BroadcastInteractionLibraSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastBannerHelpPageScheme;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveNewGameBroadcastTeachHelpPageSetting;
import com.bytedance.android.livesdk.livesetting.broadcast.LiveObsHelpPageSetting;
import com.bytedance.covode.number.Covode;
import com.bytedance.ies.sdk.datachannel.DataChannel;
import kotlin.h.b.n;

public final class PreviewHelpWidget extends PreviewToolBaseWidget implements 6Is {
    public static final GAS LIZIZ = new GAS((byte) 0);
    public final int LIZJ;
    public final int LIZLLL;

    static {
        Covode.recordClassIndex(12283);
    }

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

    public final int LIZ() {
        return this.LIZJ;
    }

    public final int LIZIZ() {
        return this.LIZLLL;
    }

    public PreviewHelpWidget() {
        int i;
        int i2;
        if (LiveNewGameBroadcastTeachHelpPageSetting.INSTANCE.enable()) {
            i = 2131828826;
        } else {
            i = 2131829384;
        }
        this.LIZJ = i;
        if (LiveNewGameBroadcastTeachHelpPageSetting.INSTANCE.enable()) {
            i2 = 2131234835;
        } else {
            i2 = 2131234834;
        }
        this.LIZLLL = i2;
    }

    public final void onCreate() {
        super.onCreate();
        View view = getView();
        if (view == null) {
            return;
        }
        if (0b0.LJI()) {
            ImageView imageView = (ImageView) view.findViewById(2131373121);
            n.LIZIZ(imageView, "");
            imageView.setScaleX(-1.0f);
            return;
        }
        ImageView imageView2 = (ImageView) view.findViewById(2131373121);
        n.LIZIZ(imageView2, "");
        imageView2.setScaleX(1.0f);
    }

    public final void LIZ(View view) {
        C1856GIv gIv;
        M12.LIZ(view);
        DataChannel dataChannel = this.dataChannel;
        if (dataChannel != null && (gIv = (C1856GIv) dataChannel.LIZIZ(C1376G0j.class)) != null) {
            if (C1393G1a.LJ(gIv)) {
                0AA r5 = null;
                if (LiveNewGameBroadcastTeachHelpPageSetting.INSTANCE.enable()) {
                    String value = LiveNewGameBroadcastBannerHelpPageScheme.INSTANCE.getValue();
                    if (value.length() > 0) {
                        C2206GWh LIZJ2 = C2206GWh.LIZ.LIZJ(value);
                        LIZJ2.LIZJ("bottom");
                        LIZJ2.LJ("bottom");
                        LIZJ2.LIZ(-16777216);
                        String uri = LIZJ2.LJIIJ().toString();
                        n.LIZIZ(uri, "");
                        Context context = this.context;
                        n.LIZIZ(context, "");
                        0cm.LIZ(IHybridContainerService.class).openSparkContainer(context, uri, (LsC) null);
                        return;
                    }
                    0aP.LIZ(6, "PreviewHelpWidget", "open LiveNewGameBroadcastBannerHelpPageScheme but scheme is empty!");
                } else if (BroadcastInteractionLibraSetting.INSTANCE.isExperimentGroup()) {
                    String value2 = BroadcastHelpNewUrlSetting.INSTANCE.getValue();
                    if (value2.length() == 0) {
                        0aP.LIZ(6, "PreviewHelpWidget", "url is empty.");
                        return;
                    }
                    1hK LIZIZ2 = 0bI.LIZIZ(this.context);
                    float LJ = 0b0.LJ((int) (((double) 0b0.LIZ(LIZIZ2).heightPixels) * 0.73d));
                    float LJ2 = 0b0.LJ(0b0.LIZJ());
                    C3463Gsi LIZ = C3598Gut.LIZ(value2);
                    LIZ.LJJ = 0b0.LIZ(2131829384);
                    LIZ.LIZJ = (int) LJ;
                    LIZ.LIZIZ = (int) LJ2;
                    LIZ.LJIIIZ = 80;
                    LIZ.LIZ(8, 8, 0, 0);
                    BaseDialogFragment LIZ2 = GI0.LJI().webViewManager().LIZ(LIZ);
                    if (LIZ2 != null) {
                        if (LIZIZ2 != null) {
                            r5 = LIZIZ2.getSupportFragmentManager();
                        }
                        LIZ2.show(r5, "HelpDialog");
                    }
                } else {
                    C3935H0u webViewManager = GI0.LJI().webViewManager();
                    Context context2 = getContext();
                    C3547Gu4 LIZIZ3 = C3598Gut.LIZIZ("https://ttlive.tiktok.com/falcon/webcast_mt/page/screen_share_intro/index.html");
                    LIZIZ3.LIZIZ = 0b0.LIZ(2131829384);
                    LIZIZ3.LJIIIIZZ = false;
                    webViewManager.LIZ(context2, LIZIZ3);
                }
            } else {
                C3935H0u webViewManager2 = GI0.LJI().webViewManager();
                Context context3 = this.context;
                C3547Gu4 LIZIZ4 = C3598Gut.LIZIZ(LiveObsHelpPageSetting.INSTANCE.getValue());
                LIZIZ4.LIZIZ = 0b0.LIZ(2131833984);
                webViewManager2.LIZ(context3, LIZIZ4);
                C3491GtA LIZ3 = C3491GtA.LJFF.LIZ("thirdparty_take_guide");
                LIZ3.LIZ(this.dataChannel);
                LIZ3.LIZJ("live_take");
                LIZ3.LIZLLL("click");
                GGC.LIZIZ(LIZ3, "live_start");
                LIZ3.LIZLLL();
            }
        }
    }
}
