@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_file_detail);
    ButterKnife.bind(this);

    fileOpenTip = (TextView) findViewById(R.id.fileOpenTip);
    fileLocalTip = (TextView) findViewById(R.id.fileLocalTip);
    downloadDB = DownloadDB.getInstance(getApplicationContext());

    mFile = getIntent().getParcelableExtra("file");

    tvTitle.setText(mFile.getCourse());
    tvFileName.setText(mFile.getName());
    tvFileSize.setText(mFile.getSize());

    imgFileIcon.setImageResource(PaperFileUtils.parseImageResource(mFile.getType()));

    String type = mFile.getType().toLowerCase();

    btnDownload.setText(mFile.isDownload() ? "打开文件" : "下载到手机");
    fileOpenTip.setVisibility(mFile.isDownload() ? View.VISIBLE : View.INVISIBLE);
    fileLocalTip.setVisibility(mFile.isDownload() ? View.INVISIBLE : View.VISIBLE);
    tvDelete.setVisibility(mFile.isDownload() ? View.VISIBLE : View.INVISIBLE);
  }
  private void sendToComputer() {

    try {

      // 发送paperurl到我的电脑;
      Intent intent = new Intent(Intent.ACTION_SEND);
      intent.setType("text/plain");
      intent.setPackage("com.tencent.mobileqq");
      intent.putExtra(Intent.EXTRA_SUBJECT, "分享");
      intent.putExtra(
          Intent.EXTRA_TEXT,
          (mFile.isDownload() ? downloadDB.getFileName(mFile.getUrl()) : mFile.getName())
              + ": "
              + UrlUnicode.encode(mFile.getUrl()));
      intent.putExtra(Intent.EXTRA_TITLE, "发至电脑");
      intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(Intent.createChooser(intent, "选择\"发送到我的电脑\""));
    } catch (Exception e) {
      Toast.makeText(getApplicationContext(), "你没有安装QQ", Toast.LENGTH_LONG).show();
    }
  }
  private void startDownloadProcess() {
    if (!mFile.isDownload()) {

      // 未下载 执行下载进程
      setDownloadViewVisiablity();
      downloadTask =
          DownLoader.downloadPaperFile(
              mFile.getUrl(),
              SDCardUtils.getDownloadPath() + mFile.getName(),
              new DownLoader.DownloadTaskCallback() {
                @Override
                public void onProgress(final int hasWrite, final int totalExpected) {

                  runOnUiThread(
                      new Runnable() {
                        @Override
                        public void run() {

                          pbProgress.setProgress(
                              (int) ((double) hasWrite / (double) totalExpected * 100));
                          tvProgress.setText(
                              "下载中...("
                                  + PaperFileUtils.sizeWithDouble(hasWrite / 1024.0)
                                  + ""
                                  + "/"
                                  + mFile.getSize()
                                  + ")");
                        }
                      });
                }

                @Override
                public void onSuccess(final String successName) {
                  runOnUiThread(
                      new Runnable() {
                        @Override
                        public void run() {

                          setResult(RESULT_OK);

                          LogUtils.d(Tag, "下载完成: " + successName);
                          fileName = successName;
                          mFile.setName(successName);
                          mFile.setDownload(true);

                          downloadDB.addDownloadInfo(mFile);

                          setDownloadViewVisiablity();
                          downloadTask = null;
                        }
                      });
                }

                @Override
                public void onFailure(Exception e) {

                  runOnUiThread(
                      new Runnable() {
                        @Override
                        public void run() {

                          ToastUtils.showShort(FileDetailActivity.this, "下载发生错误");
                          setDownloadViewVisiablity();
                        }
                      });
                }

                @Override
                public void onInterruption() {
                  runOnUiThread(
                      new Runnable() {
                        @Override
                        public void run() {
                          pbProgress.setProgress(0);
                          setDownloadViewVisiablity();
                        }
                      });
                }
              });
      downloadTask.start();

    } else {

      //            Uri uri = Uri.fromFile(new File(SDCardUtils.getDownloadPath() +
      // downloadDB.getFileName(mFile.getUrl())));
      //            Intent intent = new Intent(Intent.ACTION_VIEW);
      //            intent.setData(uri);
      //            startActivity(intent);

      File file = new File(SDCardUtils.getDownloadPath() + downloadDB.getFileName(mFile.getUrl()));
      openFile(file);
    }
  }