Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package com .liulishuo .filedownloader ;
18
18
19
+ import java .util .ArrayList ;
19
20
import java .util .List ;
20
21
21
22
/**
@@ -27,6 +28,7 @@ public class FileDownloadQueueSet {
27
28
private boolean isSerial ;
28
29
29
30
31
+ private List <BaseDownloadTask .FinishListener > taskFinishListenerList ;
30
32
private Integer autoRetryTimes ;
31
33
private Boolean syncCallback ;
32
34
private Boolean isForceReDownload ;
@@ -122,6 +124,12 @@ public void start() {
122
124
task .setTag (tag );
123
125
}
124
126
127
+ if (taskFinishListenerList != null ) {
128
+ for (BaseDownloadTask .FinishListener finishListener : taskFinishListenerList ) {
129
+ task .addFinishListener (finishListener );
130
+ }
131
+ }
132
+
125
133
task .ready ();
126
134
}
127
135
@@ -172,4 +180,17 @@ public FileDownloadQueueSet setTag(final Object tag) {
172
180
return this ;
173
181
}
174
182
183
+ /**
184
+ * @see BaseDownloadTask#addFinishListener(BaseDownloadTask.FinishListener)
185
+ */
186
+ public FileDownloadQueueSet addTaskFinishListener (
187
+ final BaseDownloadTask .FinishListener finishListener ) {
188
+ if (this .taskFinishListenerList == null ) {
189
+ this .taskFinishListenerList = new ArrayList <>();
190
+ }
191
+
192
+ this .taskFinishListenerList .add (finishListener );
193
+ return this ;
194
+ }
195
+
175
196
}
0 commit comments