package com.kwad.sdk.core.config.item; import android.content.Context; import android.content.SharedPreferences; import com.kwad.sdk.api.KsAdSDK; import com.kwad.sdk.core.e.b; import org.json.JSONObject; public final class c extends b<Integer> { public c() { super("batchReportCacheType", 2); } public static int bl(Context context) { SharedPreferences sharedPreferences; b.d("batchReportCacheType", "loadBatchReportCacheType"); if (context == null || (sharedPreferences = context.getSharedPreferences("ksadsdk_rep", 0)) == null) { return 2; } return sharedPreferences.getInt("batchReportCacheType", 2); } private static void h(Context context, int i) { SharedPreferences sharedPreferences; b.d("batchReportCacheType", "saveBatchReportCacheType"); if (context != null && (sharedPreferences = context.getSharedPreferences("ksadsdk_rep", 0)) != null) { SharedPreferences.Editor edit = sharedPreferences.edit(); edit.putInt("batchReportCacheType", i); edit.apply(); } } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences.Editor editor) { h(KsAdSDK.getContext(), ((Integer) getValue()).intValue()); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences sharedPreferences) { setValue(Integer.valueOf(bl(KsAdSDK.getContext()))); } @Override // com.kwad.sdk.core.config.item.b public final void e(JSONObject jSONObject) { setValue(jSONObject != null ? Integer.valueOf(jSONObject.optInt(getKey(), ((Integer) Lw()).intValue())) : Lw()); } }