package com.kwad.components.ct.home.config.item; import android.content.SharedPreferences; import android.text.TextUtils; import com.kwad.sdk.core.config.item.b; import com.kwad.sdk.utils.s; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.entity.RewardPlus; import org.json.JSONException; import org.json.JSONObject; public final class a extends b<C0126a> { private final String apH; private String apI; /* renamed from: com.kwad.components.ct.home.config.item.a$a reason: collision with other inner class name */ public static final class C0126a implements com.kwad.sdk.core.b { public String apJ; public String iconUrl; public String pv; C0126a() { this.iconUrl = ""; this.apJ = ""; this.pv = ""; } C0126a(String str, String str2, String str3) { this.iconUrl = str; this.apJ = str2; this.pv = str3; } @Override // com.kwad.sdk.core.b public final void parseJson(JSONObject jSONObject) { if (jSONObject != null) { this.iconUrl = jSONObject.optString("iconUrl", this.iconUrl); this.apJ = jSONObject.optString("nightIconUrl", this.apJ); this.pv = jSONObject.optString(CampaignEx.JSON_KEY_DESC, this.pv); } } @Override // com.kwad.sdk.core.b public final JSONObject toJson() { JSONObject jSONObject = new JSONObject(); s.putValue(jSONObject, RewardPlus.ICON, this.iconUrl); s.putValue(jSONObject, "nightIconUrl", this.apJ); s.putValue(jSONObject, CampaignEx.JSON_KEY_DESC, this.pv); return jSONObject; } } public a(String str, String str2) { super(str, new C0126a("", "", str2)); this.apH = str2; } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences.Editor editor) { editor.putString(getKey(), this.apI); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences sharedPreferences) { String string = sharedPreferences.getString(getKey(), null); this.apI = string; if (!TextUtils.isEmpty(string)) { try { JSONObject jSONObject = new JSONObject(this.apI); C0126a aVar = new C0126a(); aVar.parseJson(jSONObject); setValue(aVar); } catch (JSONException e) { com.kwad.sdk.core.e.b.printStackTrace(e); } } } @Override // com.kwad.sdk.core.config.item.b public final void e(JSONObject jSONObject) { JSONObject optJSONObject = jSONObject.optJSONObject(getKey()); if (optJSONObject != null) { this.apI = optJSONObject.toString(); C0126a aVar = new C0126a(); aVar.parseJson(optJSONObject); setValue(aVar); } } public final String zO() { C0126a aVar = (C0126a) getValue(); return aVar != null ? aVar.pv : this.apH; } public final String zP() { C0126a aVar = (C0126a) getValue(); return aVar != null ? aVar.iconUrl : ""; } public final String zQ() { C0126a aVar = (C0126a) getValue(); return aVar != null ? aVar.apJ : ""; } }