package com.ss.android.ugc.aweme.bullet.bridge.framework;

import X.0CB;
import X.0CH;
import X.4UQ;
import X.6Is;
import X.BaY;
import X.C3459JZa;
import X.C3460JZb;
import X.C3530Jaj;
import X.Cqq;
import X.KCc;
import X.KT7;
import X.M12;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.Resources;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.bullet.bridge.BaseBridgeMethod;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class OpenLongVideoMethod extends BaseBridgeMethod implements 6Is {
    public static final C3460JZb LIZIZ = new C3460JZb((byte) 0);
    public C3530Jaj LIZJ;
    public String LIZLLL = "";
    public final String LJ = "open_long_video";
    public KCc LJFF = KCc.PRIVATE;

    static {
        Covode.recordClassIndex(55112);
    }

    public final void LIZ() {
    }

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

    public final KCc LIZIZ() {
        return this.LJFF;
    }

    public final String LIZLLL() {
        return this.LJ;
    }

    public final void LJIIIZ() {
        C3530Jaj jaj;
        Context LJ2 = LJ();
        if (LJ2 != null) {
            while (LJ2 != null) {
                if (LJ2 instanceof Activity) {
                    Activity activity = (Activity) LJ2;
                    if (activity != null && !activity.isFinishing() && (jaj = this.LIZJ) != null && jaj.isShowing()) {
                        try {
                            C3530Jaj jaj2 = this.LIZJ;
                            if (jaj2 != null) {
                                jaj2.dismiss();
                                return;
                            }
                            return;
                        } catch (Throwable unused) {
                            return;
                        }
                    } else {
                        return;
                    }
                } else if (LJ2 instanceof ContextWrapper) {
                    LJ2 = ((ContextWrapper) LJ2).getBaseContext();
                } else {
                    return;
                }
            }
        }
    }

    public final void LIZ(KCc kCc) {
        M12.LIZ(kCc);
        this.LJFF = kCc;
    }

    /* JADX INFO: super call moved to the top of the method (can break code semantics) */
    public OpenLongVideoMethod(KT7 kt7) {
        super(kt7);
        M12.LIZ(kt7);
    }

    public final void LIZ(JSONObject jSONObject, 4UQ r8) {
        M12.LIZ(jSONObject, r8);
        String str = null;
        if (!jSONObject.has("aweme_id")) {
            jSONObject = null;
        }
        if (jSONObject != null) {
            this.LIZLLL = jSONObject.optString("react_id");
            String optString = jSONObject.optString("aweme_id");
            jSONObject.optDouble("current_time");
            jSONObject.optString("enter_from");
            Context LJ2 = LJ();
            if (LJ2 != null) {
                n.LIZIZ(optString, "");
                Resources resources = LJ2.getResources();
                if (resources != null) {
                    str = resources.getString(2131826718);
                }
                C3530Jaj LIZ = C3530Jaj.LIZ(LJ2, str);
                this.LIZJ = LIZ;
                if (LIZ != null) {
                    LIZ.setIndeterminate(false);
                }
                Cqq cqq = new Cqq();
                cqq.a_(new C3459JZa(this, cqq));
                cqq.LIZ(new BaY());
                cqq.LIZ(new Object[]{optString});
            }
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("code", 1);
        r8.LIZ(jSONObject2);
    }
}
