/** 从服务端获取小报数据 */ public void getTabloidDataFromServer() { CxTabloidApi tabloidApi = new CxTabloidApi(); TabloidDao dao = new TabloidDao(CxTabloidActivity.this); String[] arr = dao.getCategorieIdsAndTabloidIds(); String categorie_ids = arr[0]; String tabloid_ids = arr[1]; CxLog.e(TAG, "categorie_ids:" + categorie_ids + " tabloid_ids:" + tabloid_ids); tabloidApi.getCategoryList(getTabloidDataCaller, categorie_ids, tabloid_ids); }
private void init() { // 获取小报类型列表(先从本地获取,然后再从网络中获取。从网络中获取后,更新本地的数据,下次进入时生效) CxTabloidApi tabloidApi = new CxTabloidApi(); // 获取本地缓存的数据 TabloidDao dao = new TabloidDao(CxTabloidActivity.this); String version = dao.getVersion(); TabloidCateConfData pubConf = dao.getPubConf(); // 得到全局的配置,没有分类配置数据 List<TabloidCateConfObj> confList = dao.getCateConfList(0); // 分类的配置数据 if (pubConf != null && confList.size() > 0) { pubConf.setConfig(confList); // 将全局配置和分类配置合并 buildView(pubConf); } else { tabloidApi.getCategoryConfig(getCateConfCaller, version); } }