@Override
 public void onDownloadProgress(long finished, long length) {
   mStatus = DownloadStatus.STATUS_PROGRESS;
   // calculate percent
   final int percent = (int) (finished * 100 / length);
   mResponse.onDownloadProgress(finished, length, percent);
 }
 @Override
 public void onDownloadFailed(DownloadException de) {
   if (isAllFailed()) {
     mStatus = DownloadStatus.STATUS_FAILED;
     mResponse.onDownloadFailed(de);
     onDestroy();
   }
 }
 @Override
 public void onDownloadPaused() {
   if (isAllPaused()) {
     mStatus = DownloadStatus.STATUS_PAUSED;
     mResponse.onDownloadPaused();
     onDestroy();
   }
 }
 @Override
 public void onDownloadCanceled() {
   if (isAllCanceled()) {
     deleteFromDB();
     mStatus = DownloadStatus.STATUS_CANCELED;
     mResponse.onDownloadCanceled();
     onDestroy();
   }
 }
 @Override
 public void onDownloadCompleted() {
   if (isAllComplete()) {
     deleteFromDB();
     mStatus = DownloadStatus.STATUS_COMPLETED;
     mResponse.onDownloadCompleted();
     onDestroy();
   }
 }
  @Override
  public void onConnected(long time, long length, boolean isAcceptRanges) {
    mStatus = DownloadStatus.STATUS_CONNECTED;
    mResponse.onConnected(time, length, isAcceptRanges);

    mDownloadInfo.setAcceptRanges(isAcceptRanges);
    mDownloadInfo.setLength(length);
    download(length, isAcceptRanges);
  }
 @Override
 public void start() {
   mStatus = DownloadStatus.STATUS_STARTED;
   mResponse.onStarted();
   connect();
 }
 @Override
 public void onConnectCanceled() {
   mStatus = DownloadStatus.STATUS_CANCELED;
   mResponse.onConnectCanceled();
   onDestroy();
 }
 @Override
 public void onConnectFailed(DownloadException de) {
   mStatus = DownloadStatus.STATUS_FAILED;
   mResponse.onConnectFailed(de);
   onDestroy();
 }
 @Override
 public void onConnecting() {
   mStatus = DownloadStatus.STATUS_CONNECTING;
   mResponse.onConnecting();
 }