Exemple #1
0
 @Override
 public void download(
     String url, String savePath, String saveName, int requestId, ILNetworkCallback callback) {
   LDownload task = mDownloadThreads.get(requestId);
   if (task == null || task.getState() == LReqState.FINISHED) {
     task = new LDownload(url, savePath, saveName, requestId, callback, this);
     task.execute();
     mDownloadThreads.put(requestId, task);
   } else {
     L.i(TAG, "requestId " + requestId + " thread is running!");
   }
 }
Exemple #2
0
 @Override
 public void request(LReqEntity reqEntity, int requestId, ILNetworkCallback callback) {
   if (reqEntity == null) {
     throw new NullPointerException(
         "The network requests the LReqEntity parameter cannot be empty!");
   }
   if (callback == null) {
     throw new NullPointerException(
         "This is an invalid request,because you did not realize the callback interface!");
   }
   LRequest task = mRequestThreads.get(requestId);
   if (task == null || task.getState() == LReqState.FINISHED) {
     task = new LRequest(reqEntity, requestId, callback, this);
     task.execute();
     mRequestThreads.put(requestId, task);
   } else {
     L.i(TAG, "requestId " + requestId + " thread is running!");
   }
 }