pull/1194/head
parent
38e262393e
commit
94d4d15e7d
@ -1,25 +1,23 @@ |
||||
package io.legado.app.service.help |
||||
|
||||
import android.content.Context |
||||
import android.content.Intent |
||||
import io.legado.app.constant.IntentAction |
||||
import io.legado.app.service.DownloadService |
||||
import io.legado.app.utils.startService |
||||
|
||||
object Download { |
||||
|
||||
fun start(context: Context, downloadId: Long, fileName: String) { |
||||
Intent(context, DownloadService::class.java).let { |
||||
it.action = IntentAction.start |
||||
it.putExtra("downloadId", downloadId) |
||||
it.putExtra("fileName", fileName) |
||||
context.startService(it) |
||||
context.startService<DownloadService> { |
||||
action = IntentAction.start |
||||
putExtra("downloadId", downloadId) |
||||
putExtra("fileName", fileName) |
||||
} |
||||
} |
||||
|
||||
fun stop(context: Context) { |
||||
Intent(context, DownloadService::class.java).let { |
||||
it.action = IntentAction.stop |
||||
context.startService(it) |
||||
context.startService<DownloadService> { |
||||
action = IntentAction.stop |
||||
} |
||||
} |
||||
|
||||
|
Loading…
Reference in new issue