コード例 #1
0
 /**
  * 软件列表
  *
  * @param searchTag 软件分类 推荐:recommend 最新:time 热门:view 国产:list_cn
  * @param pageIndex
  * @return
  * @throws AppException
  */
 public SoftwareList getSoftwareList(String searchTag, int pageIndex, boolean isRefresh)
     throws AppException {
   SoftwareList list = null;
   String key = "softwarelist_" + searchTag + "_" + pageIndex + "_" + PAGE_SIZE;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       list = ApiClient.getSoftwareList(this, searchTag, pageIndex, PAGE_SIZE);
       if (list != null && pageIndex == 0) {
         Notice notice = list.getNotice();
         list.setNotice(null);
         list.setCacheKey(key);
         saveObject(list, key);
         list.setNotice(notice);
       }
     } catch (AppException e) {
       list = (SoftwareList) readObject(key);
       if (list == null) throw e;
     }
   } else {
     list = (SoftwareList) readObject(key);
     if (list == null) list = new SoftwareList();
   }
   return list;
 }