mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
23 lines
No EOL
899 B
Kotlin
23 lines
No EOL
899 B
Kotlin
package com.lagradost.cloudstream3.services
|
|
|
|
import android.app.IntentService
|
|
import android.content.Intent
|
|
import com.lagradost.cloudstream3.utils.VideoDownloadManager
|
|
|
|
class VideoDownloadService : IntentService("VideoDownloadService") {
|
|
override fun onHandleIntent(intent: Intent?) {
|
|
if (intent != null) {
|
|
val id = intent.getIntExtra("id", -1)
|
|
val type = intent.getStringExtra("type")
|
|
if (id != -1 && type != null) {
|
|
val state = when (type) {
|
|
"resume" -> VideoDownloadManager.DownloadActionType.Resume
|
|
"pause" -> VideoDownloadManager.DownloadActionType.Pause
|
|
"stop" -> VideoDownloadManager.DownloadActionType.Stop
|
|
else -> return
|
|
}
|
|
VideoDownloadManager.downloadEvent.invoke(Pair(id, state))
|
|
}
|
|
}
|
|
}
|
|
} |