package com.kwad.sdk.core.config.item; import android.content.SharedPreferences; import android.text.TextUtils; import com.kwad.sdk.core.b; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public final class o extends b<a> { private String apI; public static final class a implements b { public List<String> aUA = new ArrayList(); public List<String> aUB = new ArrayList(); public int aUC; private JSONObject aUD; public Map<Integer, String> aUy = new HashMap(); public List<String> aUz = new ArrayList(); @Override // com.kwad.sdk.core.b public final void parseJson(JSONObject jSONObject) { if (jSONObject != null) { this.aUD = jSONObject; JSONObject optJSONObject = jSONObject.optJSONObject("platformInfo"); if (optJSONObject != null) { Iterator<String> keys = optJSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); this.aUy.put(Integer.valueOf(next), optJSONObject.optString(next)); } } JSONArray optJSONArray = jSONObject.optJSONArray("keyStacks"); if (optJSONArray != null) { for (int i = 0; i < optJSONArray.length(); i++) { this.aUz.add(optJSONArray.optString(i)); } } JSONArray optJSONArray2 = jSONObject.optJSONArray("extendClassNames"); if (optJSONArray2 != null) { for (int i2 = 0; i2 < optJSONArray2.length(); i2++) { this.aUA.add(optJSONArray2.optString(i2)); } } JSONArray optJSONArray3 = jSONObject.optJSONArray("keyNames"); if (optJSONArray3 != null) { for (int i3 = 0; i3 < optJSONArray3.length(); i3++) { this.aUB.add(optJSONArray3.optString(i3)); } } this.aUC = jSONObject.optInt("handleType"); } } @Override // com.kwad.sdk.core.b public final JSONObject toJson() { return this.aUD; } } public o() { super("sdkPackInfo", null); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences.Editor editor) { editor.putString("sdkPackInfo", cK(this.apI)); } @Override // com.kwad.sdk.core.config.item.b public final void a(SharedPreferences sharedPreferences) { String cL = cL(sharedPreferences.getString("sdkPackInfo", null)); this.apI = cL; try { if (!TextUtils.isEmpty(cL)) { JSONObject jSONObject = new JSONObject(this.apI); a aVar = new a(); aVar.parseJson(jSONObject); setValue(aVar); } } catch (JSONException e) { e.printStackTrace(); } } @Override // com.kwad.sdk.core.config.item.b public final void e(JSONObject jSONObject) { JSONObject optJSONObject = jSONObject.optJSONObject("sdkPackInfo"); if (optJSONObject != null) { this.apI = optJSONObject.toString(); a aVar = new a(); aVar.parseJson(optJSONObject); setValue(aVar); } } }