예제 #1
0
 /** Pause all task */
 public void pauseAll() {
   FileDownloadEventPool.getImpl().shutdownSendPool();
   final BaseDownloadTask[] downloadList = FileDownloadList.getImpl().copy();
   synchronized (pauseLock) {
     for (BaseDownloadTask baseDownloadTask : downloadList) {
       baseDownloadTask.pause();
     }
   }
   // double check, for case: File Download progress alive but ui progress has died and relived,
   // so FileDownloadList not always contain all running task exactly.
   if (FileDownloadServiceUIGuard.getImpl().isConnected()) {
     FileDownloadServiceUIGuard.getImpl().pauseAllTasks();
   } else {
     if (pauseAllRunnable == null) {
       pauseAllRunnable =
           new Runnable() {
             @Override
             public void run() {
               FileDownloadServiceUIGuard.getImpl().pauseAllTasks();
             }
           };
     }
     FileDownloadServiceUIGuard.getImpl()
         .bindStartByContext(FileDownloadHelper.getAppContext(), pauseAllRunnable);
   }
 }
예제 #2
0
 /**
  * Unbind & stop ':filedownloader' process manually(Do not need, will unbind & stop automatically
  * by System if leave unused period)
  */
 public void unBindService() {
   if (isServiceConnected()) {
     FileDownloadServiceUIGuard.getImpl().unbindByContext(FileDownloadHelper.getAppContext());
   }
 }
예제 #3
0
 /**
  * Bind & start ':filedownloader' process manually(Do not need, will bind & start automatically by
  * Download Engine if real need)
  */
 public void bindService() {
   if (!isServiceConnected()) {
     FileDownloadServiceUIGuard.getImpl().bindStartByContext(FileDownloadHelper.getAppContext());
   }
 }