Ejemplo n.º 1
0
 /**
  * 用户收�列表
  *
  * @param type 0:全部收� 1:软件 2:�题 3:�客 4:新闻 5:代�
  * @param pageIndex 页�索引 0表示第一�
  * @return
  * @throws AppException
  */
 public FavoriteList getFavoriteList(int type, int pageIndex, boolean isRefresh)
     throws AppException {
   FavoriteList list = null;
   String key = "favoritelist_" + loginUid + "_" + type + "_" + pageIndex + "_" + PAGE_SIZE;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       list = ApiClient.getFavoriteList(this, loginUid, type, 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 = (FavoriteList) readObject(key);
       if (list == null) throw e;
     }
   } else {
     list = (FavoriteList) readObject(key);
     if (list == null) list = new FavoriteList();
   }
   return list;
 }