package com.ss.android.ugc.aweme.fe.method;

import X.0CB;
import X.0CH;
import X.1hK;
import X.2Ue;
import X.6Is;
import X.AGn;
import X.C5570Hlb;
import X.C5571Hlc;
import X.CqM;
import X.FIu;
import X.HVE;
import X.KKi;
import android.content.Context;
import android.os.Bundle;
import com.bytedance.covode.number.Covode;
import com.ss.android.ugc.aweme.fe.base.BaseCommonJavaMethod;
import com.ss.android.ugc.aweme.live.ILiveOuterService;
import com.ss.android.ugc.aweme.live.LiveOuterService;
import kotlin.h.b.n;
import org.json.JSONObject;

public final class OpenRechargePanel extends BaseCommonJavaMethod implements 6Is {
    static {
        Covode.recordClassIndex(76130);
    }

    public OpenRechargePanel(byte b) {
        this();
    }

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

    public /* synthetic */ OpenRechargePanel() {
        this((KKi) null);
    }

    public OpenRechargePanel(KKi kKi) {
        super(kKi);
    }

    public final void handle(JSONObject jSONObject, FIu fIu) {
        long j;
        String str;
        JSONObject jSONObject2;
        Bundle bundle = new Bundle();
        int i = 0;
        if (jSONObject != null) {
            i = jSONObject.optInt("key_bundle_charge_source", 0);
        }
        long j2 = 0;
        if (jSONObject != null) {
            j = jSONObject.optLong("diamond_count", 0);
            j2 = jSONObject.optLong("total_diamond_acount_needed", 0);
        } else {
            j = 0;
        }
        if (jSONObject != null) {
            str = jSONObject.optString("charge_reason");
            jSONObject2 = jSONObject.optJSONObject("track_info");
        } else {
            str = null;
            jSONObject2 = null;
        }
        bundle.putInt("key_bundle_charge_source", i);
        bundle.putString("key_charge_reason", str);
        bundle.putLong("key_bundle_need_coins", j);
        bundle.putLong("key_bundle_total_coins", j2);
        if (i == 5 || this.mContextRef == null) {
            CqM.LIZ(new 2Ue(new C5571Hlc(this), bundle, 2Ue.LIZLLL.LIZ(jSONObject2)));
        } else {
            1hK r3 = (Context) this.mContextRef.get();
            if (r3 instanceof 1hK) {
                AGn aGn = new AGn();
                aGn.LIZ(2Ue.LIZLLL.LIZ(jSONObject2));
                ILiveOuterService LJJI = LiveOuterService.LJJI();
                n.LIZIZ(LJJI, "");
                1hK r32 = r3;
                LJJI.LJ().LIZ(r32, (HVE) new C5570Hlb(this), bundle, aGn).showNow(r32.getSupportFragmentManager(), getClass().getSimpleName());
            } else {
                return;
            }
        }
        if (fIu != null) {
            fIu.LIZ((Object) null);
        }
    }
}
