翰林优商.apk(点击下载) / j.java


package com.kwad.sdk.core.config.item;

import android.content.SharedPreferences;
import com.kwad.sdk.core.e.b;
import org.json.JSONException;
import org.json.JSONObject;

public final class j extends b<a> {

    public static class a extends com.kwad.sdk.core.response.kwai.a {
        public int aUu = 180000;
        public int aUv = 90000;
    }

    public j(String str) {
        super(str, new a());
    }

    public final int LA() {
        if (getValue() != null) {
            return ((a) getValue()).aUu;
        }
        return 180000;
    }

    public final int LB() {
        if (getValue() != null) {
            return ((a) getValue()).aUv;
        }
        return 90000;
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void a(SharedPreferences.Editor editor) {
        String key;
        String str;
        if (getValue() == null || ((a) getValue()).toJson() == null) {
            key = getKey();
            str = "";
        } else {
            key = getKey();
            str = ((a) getValue()).toJson().toString();
        }
        editor.putString(key, str);
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void a(SharedPreferences sharedPreferences) {
        a aVar = (a) getValue();
        if (aVar == null) {
            aVar = new a();
        }
        JSONObject jSONObject = null;
        try {
            jSONObject = new JSONObject(sharedPreferences.getString(getKey(), ""));
        } catch (JSONException e) {
            b.printStackTraceOnly(e);
        }
        if (jSONObject != null) {
            aVar.parseJson(jSONObject);
        }
        setValue(aVar);
    }

    @Override // com.kwad.sdk.core.config.item.b
    public final void e(JSONObject jSONObject) {
        JSONObject optJSONObject;
        if (jSONObject == null || (optJSONObject = jSONObject.optJSONObject(getKey())) == null) {
            setValue(Lw());
            return;
        }
        a aVar = new a();
        aVar.parseJson(optJSONObject);
        setValue(aVar);
    }
}