Skip to content

Commit

Permalink
opt DownloadHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
heaven7 committed Aug 11, 2020
1 parent 7d61037 commit 4fd71d8
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ private boolean query(long id, Integer downloadFlags, boolean callback){
if(params == null){
return false;
}
if(query0(id, downloadFlags, params.task)){
if(callback){
params.callback.onQueryResult(mContext, params.task);
}
return true;
if(!query0(id, downloadFlags, params.task)){
params.task.setStatus(DownloadHelper.STATUS_FAILED);
}
if(callback){
params.callback.onQueryResult(mContext, params.task);
}
return false;
return true;
}
private boolean query0(long id, Integer downloadFlags, DownloadTask task){
DownloadManager.Query query = new DownloadManager.Query();
Expand Down Expand Up @@ -208,11 +208,12 @@ private boolean query0(long id, Integer downloadFlags, DownloadTask task){
}
}catch (Exception e){
e.printStackTrace();
return false;
}
finally {
cursor.close();
}
return false;
return true;
}
private void dispatchNotificationClicked(long id){
Params params = mCallbacks.get(id);
Expand Down

0 comments on commit 4fd71d8

Please sign in to comment.