Open HeQuanLi opened 1 week ago
In Fragment :
GDownload.init(lifecycle) val ctx = context ?: return val downloadList = mutableListOf<Download>() downloadList.add( Download( System.nanoTime(), "https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk", "15.jpg" ) ) downloadList.add( Download( System.nanoTime(), "https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk", "151.jpg" ) ) downloadList.add( Download( System.nanoTime(), "https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk", "152.jpg" ) ) downloadList.add( Download( System.nanoTime(), "https://cdn.llscdn.com/yy/files/xs8qmxn8-lls-LLS-5.8-800-20171207-111607.apk", "5MB.mp4" ) ) GDownload.freeGroup(ctx) { groupLoopTimeMilliSecs = 5_00 getGroup()?.apply { start() // start group thread. as group has it's dedicated thread addAll(downloadList) { // enqueue downloads in the group but don't issue the start command startDownloads(it) // start group downloads } addGroupProgressListener(object : GroupListener { override fun onAdded( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onAdded(groupId, download, groupState) Log.d("TAG_HQL", "onAdded: ") } override fun onDownloading( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onDownloading(groupId, download, groupState) Log.d("TAG_HQL", "onDownloading: ") } override fun onEnqueued( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onEnqueued(groupId, download, groupState) Log.d("TAG_HQL", "onEnqueued: ") } override fun onFailure( groupId: Long, errorMessage: String?, download: DownloadInfo, groupState: GroupState ) { super.onFailure(groupId, errorMessage, download, groupState) Log.d("TAG_HQL", "onFailure: ") } override fun onPaused( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onPaused(groupId, download, groupState) Log.d("TAG_HQL", "onPaused: ") } override fun onStarting( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onStarting(groupId, download, groupState) Log.d("TAG_HQL", "onStarting: ") } override fun onStopped( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onStopped(groupId, download, groupState) Log.d("TAG_HQL", "onStopped: ") } override fun onSuccess( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onSuccess(groupId, download, groupState) Log.d("TAG_HQL", "onSuccess: ") } override fun onWaitingForTurn( groupId: Long, download: DownloadInfo, groupState: GroupState ) { super.onWaitingForTurn(groupId, download, groupState) Log.d("TAG_HQL", "onWaitingForTurn: ") } }) }
this code dont work.
Will look into it shortly
In Fragment :
this code dont work.