123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package com.yyrh.constant;
- import android.text.TextUtils;
- import com.yyrh.utils.YYLog;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- public class InitConfig {
- public String fristShowPage = "";
- public String agreement_privacy = "";
- public String service_center = "";
- public String access_token = "";
- public String agreement_user = "";
- public JSONObject links = null;
- public JSONArray reg_tabs = null;
- public int sdk_login = 1;
- public int bswitch = 0;
- public int rn_bh = 1800;
- 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");
- initConfig.access_token = json.optString("access_token");
- initConfig.rn_bh = json.optInt("rn_bh",1800);
- 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");
- }
- YYLog.i(initConfig.toString());
- return initConfig;
- }
- @Override
- public String toString() {
- return "InitConfig{" +
- "agreement_privacy='" + agreement_privacy + '\'' +
- ", service_center='" + service_center + '\'' +
- ", access_token='" + access_token + '\'' +
- ", agreement_user='" + agreement_user + '\'' +
- ", links=" + links +
- ", reg_tabs=" + reg_tabs +
- ", sdk_login=" + sdk_login +
- ", bswitch=" + bswitch +
- ", rn_bh=" + rn_bh +
- '}';
- }
- }
|