Example #1
0
 private void init() {
   showLoading();
   mCacheKey = "info" + ToolUtil.getDayStr();
   mTodayVideoPath = PhoneUtil.getAppFilePath() + ToolUtil.getDayStr() + ".mp4";
   if (PhoneUtil.isFileExit(mTodayVideoPath)
       && CacheUtil.getCache(getActivity(), mCacheKey) != null) {
     mAfternoonInfo.setText((String) CacheUtil.getCache(getActivity(), mCacheKey));
     prepareVideoEnd(0);
   } else {
     new HttpUtil().excute(mHandler, Constant.AFTERNOON_URL);
   }
 }
Example #2
0
  private void prepareVideo(String url, String info) {

    // 下载视频
    mAfternoonInfo.setText(info);

    CacheUtil.saveCache(getActivity(), mCacheKey, info);
    if (PhoneUtil.isFileExit(mTodayVideoPath)) {
      prepareVideoEnd(0);

    } else {
      new DownloadUtil()
          .excute(mHandler, url, PhoneUtil.getAppFilePath(), ToolUtil.getDayStr() + ".mp4");
    }
  }