예제 #1
0
    @Override
    public void run() {
      mFeedDownload =
          new HTMLDownloadCommand(
              "http://news.ycombinator.com/", "", RequestType.GET, false, null, App.getInstance());
      mFeedDownload.run();

      if (mCancelled) mErrorCode = IAPICommand.ERROR_CANCELLED_BY_USER;
      else mErrorCode = mFeedDownload.getErrorCode();

      if (!mCancelled && mErrorCode == IAPICommand.ERROR_NONE) {
        HNFeedParser feedParser = new HNFeedParser();
        try {
          mResult = feedParser.parse(mFeedDownload.getResponseContent());
          Run.inBackground(
              new Runnable() {
                public void run() {
                  FileUtil.setLastHNFeed(mResult);
                }
              });
        } catch (Exception e) {
          ExceptionUtil.sendToGoogleAnalytics(e, Const.GAN_ACTION_PARSING);
          Log.e("HNFeedTask", "HNFeed Parser Error :(", e);
        }
      }

      if (mResult == null) mResult = new HNFeed();
    }
예제 #2
0
 @Override
 public void onCancelled() {
   mFeedDownload.cancel();
 }