コード例 #1
0
 @Override
 protected String doInBackground(Void... params) {
   BaseRecycleViewFragment instance = mInstance.get();
   if (instance == null) return null;
   try {
     ListEntity data = instance.parseList(new ByteArrayInputStream(responseData));
     if (!fromCache) {
       // ////////////// 此处需要发送广播时间,通知用户现在有新的消息
     }
     if (!fromCache
         && instance.mCurrentPage == 0
         && !TextUtils.isEmpty(instance.getCacheKey())) {
       CacheManager.setCache(
           instance.getCacheKey(),
           responseData,
           instance.getCacheExpire(),
           CacheManager.TYPE_INTERNAL);
       // Logger.e(TAG, "cache write success:" + instance.getCacheKey());
     }
     list = data.getList();
   } catch (Exception e) {
     e.printStackTrace();
     parseError = true;
   }
   return null;
 }
コード例 #2
0
    @Override
    protected byte[] doInBackground(BaseRecycleViewFragment target, Void... params) {
      if (target == null) {
        return null;
      }
      if (TextUtils.isEmpty(target.getCacheKey())) {
        return null;
      }
      byte[] data = CacheManager.getCache(target.getCacheKey());
      if (data == null) {
        Logger.e(TAG, "cache data is empty. :" + target.getCacheKey());
        return null;
      }
      Logger.e(TAG, "exist cache: " + target.getCacheKey() + "data:" + data);
      return null;
      //	return data;

    }