Esempio n. 1
0
    @Override
    public void run() {
      startCache();

      String rootPath = FileUtil.getPath();
      long startTime = System.currentTimeMillis();
      LogFileUtil.v("rootPath = " + rootPath + ",startTime = " + startTime);

      if (null != rootPath) {
        final File rootFile = new File(rootPath);
        long size = getDirSize(rootFile);

        LogFileUtil.v(TAG, "DirSize = " + FileSizeUtil.formatFileAutoSize(size));
      } else {
        IApplication.toast("内存空间不存在");
        LogFileUtil.v(TAG, "rootPath is null");
      }

      LogFileUtil.v(
          TAG,
          "ReadTime = "
              + (System.currentTimeMillis() - startTime)
              + ",fileNumber = "
              + resultBean.size());
      startTime = System.currentTimeMillis();

      DbFileBeanManager.getInstance().insertAtSameMoment(resultBean);
      LogFileUtil.v(TAG, "WriteTime = " + (System.currentTimeMillis() - startTime));

      endCache();
    }
Esempio n. 2
0
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    // 判断是否进行 加载文件
    boolean isStartCache = isStartCache();
    LogFileUtil.v("isStartCache = " + isStartCache);
    if (isStartCache) {
      new Thread(new FileLoadRunnable()).start();
    }

    return super.onStartCommand(intent, flags, startId);
  }