12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.yyrh.constant;
- import android.text.TextUtils;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- public class InitConfig {
- public static String fristShowPage = "";
- public String agreement_privacy = "";
- public String service_center = "";
- public String agreement_user = "";
- public JSONObject links = null;
- public JSONArray reg_tabs = null;
- public int sdk_login = 1;
- public int bswitch = 0;
- public static InitConfig toBean(JSONObject json){
- if (TextUtils.isEmpty(json.toString())) {
- return null;
- }
- InitConfig initConfig = new InitConfig();
- initConfig.reg_tabs = json.optJSONArray("reg_tabs");
- initConfig.sdk_login = json.optInt("sdk_login", 100);
- initConfig.bswitch = json.optInt("bswitch");
- if (initConfig.reg_tabs != null){
- try {
- if (initConfig.reg_tabs.get(0).toString().equals("phone")){
- InitConfig.fristShowPage = "phone";
- }
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- initConfig.links = json.optJSONObject("links");
- if (initConfig.links != null){
- initConfig.agreement_privacy = initConfig.links.optString("agreement_privacy");
- initConfig.service_center = initConfig.links.optString("service_center");
- initConfig.agreement_user= initConfig.links.optString("agreement_user");
- }
- return initConfig;
- }
- @Override
- public String toString() {
- return "InitConfig{" +
- "agreement_privacy='" + agreement_privacy + '\'' +
- ", service_center='" + service_center + '\'' +
- ", agreement_user='" + agreement_user + '\'' +
- ", links=" + links +
- ", reg_tabs=" + reg_tabs +
- ", sdk_login=" + sdk_login +
- ", bswitch=" + bswitch +
- '}';
- }
- }
|