예제 #1
0
 /**
  * 获取动弹详情
  *
  * @param tweet_id
  * @return
  * @throws AppException
  */
 public Tweet getTweet(int tweet_id, boolean isRefresh) throws AppException {
   Tweet tweet = null;
   String key = "tweet_" + tweet_id;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       tweet = ApiClient.getTweetDetail(this, tweet_id);
       if (tweet != null) {
         Notice notice = tweet.getNotice();
         tweet.setNotice(null);
         tweet.setCacheKey(key);
         saveObject(tweet, key);
         tweet.setNotice(notice);
       }
     } catch (AppException e) {
       tweet = (Tweet) readObject(key);
       if (tweet == null) throw e;
     }
   } else {
     tweet = (Tweet) readObject(key);
     if (tweet == null) tweet = new Tweet();
   }
   return tweet;
 }