kotlin / com.liulishuo.okdownload.kotlin.listener

Package com.liulishuo.okdownload.kotlin.listener

Types

onBlockEnd

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4.blockEnd

typealias onBlockEnd = (task: DownloadTask, blockIndex: Int, info: BlockInfo) -> Unit

onBlockEndWithSpeed

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4WithSpeed.blockEnd

typealias onBlockEndWithSpeed = (task: DownloadTask, blockIndex: Int, info: BlockInfo, blockSpeed: SpeedCalculator) -> Unit

onCanceled

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener3.canceled.

typealias onCanceled = taskCallback

onCompleted

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener3.completed.

typealias onCompleted = taskCallback

onConnected

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener1.connected.

typealias onConnected = (task: DownloadTask, blockCount: Int, currentOffset: Long, totalLength: Long) -> Unit

onConnectEnd

Correspond to com.liulishuo.okdownload.DownloadListener.connectEnd

typealias onConnectEnd = (task: DownloadTask, blockIndex: Int, responseCode: Int, responseHeaderFields: Map<String, List<String>>) -> Unit

onConnectStart

Correspond to com.liulishuo.okdownload.DownloadListener.connectStart

typealias onConnectStart = (task: DownloadTask, blockIndex: Int, requestHeaderFields: Map<String, List<String>>) -> Unit

onConnectTrialEnd

Correspond to com.liulishuo.okdownload.DownloadListener.connectTrialEnd

typealias onConnectTrialEnd = (task: DownloadTask, responseCode: Int, responseHeaderFields: Map<String, List<String>>) -> Unit

onConnectTrialStart

Correspond to com.liulishuo.okdownload.DownloadListener.connectTrialStart

typealias onConnectTrialStart = (task: DownloadTask, requestHeaderFields: Map<String, List<String>>) -> Unit

onDownloadFromBeginning

Correspond to com.liulishuo.okdownload.DownloadListener.downloadFromBeginning

typealias onDownloadFromBeginning = (task: DownloadTask, info: BreakpointInfo, cause: ResumeFailedCause) -> Unit

onDownloadFromBreakpoint

Correspond to com.liulishuo.okdownload.DownloadListener.downloadFromBreakpoint

typealias onDownloadFromBreakpoint = (task: DownloadTask, info: BreakpointInfo) -> Unit

onError

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener3.error.

typealias onError = (task: DownloadTask, e: Exception) -> Unit

onFetchEnd

Correspond to com.liulishuo.okdownload.DownloadListener.fetchEnd

typealias onFetchEnd = onFetchStart

onFetchProgress

Correspond to com.liulishuo.okdownload.DownloadListener.fetchProgress

typealias onFetchProgress = (task: DownloadTask, blockIndex: Int, increaseBytes: Long) -> Unit

onFetchStart

Correspond to com.liulishuo.okdownload.DownloadListener.fetchStart

typealias onFetchStart = (task: DownloadTask, blockIndex: Int, contentLength: Long) -> Unit

onInfoReady

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4.infoReady

typealias onInfoReady = (task: DownloadTask, info: BreakpointInfo, fromBreakpoint: Boolean, model: Listener4Model) -> Unit

onInfoReadyWithSpeed

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4WithSpeed.taskStart

typealias onInfoReadyWithSpeed = (task: DownloadTask, info: BreakpointInfo, fromBreakpoint: Boolean, model: Listener4SpeedModel) -> Unit

onProgress

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener1.progress.

typealias onProgress = (task: DownloadTask, currentOffset: Long, totalLength: Long) -> Unit

onProgressBlock

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4.progressBlock

typealias onProgressBlock = (task: DownloadTask, blockIndex: Int, currentBlockOffset: Long) -> Unit

onProgressBlockWithSpeed

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4WithSpeed.progressBlock

typealias onProgressBlockWithSpeed = (task: DownloadTask, blockIndex: Int, currentBlockOffset: Long, blockSpeed: SpeedCalculator) -> Unit

onProgressWithoutTotalLength

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4.progress

typealias onProgressWithoutTotalLength = (task: DownloadTask, currentOffset: Long) -> Unit

onProgressWithSpeed

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4WithSpeed.progress

typealias onProgressWithSpeed = (task: DownloadTask, currentOffset: Long, taskSpeed: SpeedCalculator) -> Unit

onQueueEnd

Correspond to com.liulishuo.okdownload.DownloadContextListener.queueEnd.

typealias onQueueEnd = (context: DownloadContext) -> Unit

onQueueTaskEnd

Correspond to com.liulishuo.okdownload.DownloadContextListener.taskEnd.

typealias onQueueTaskEnd = (context: DownloadContext, task: DownloadTask, cause: EndCause, realException: Exception?, remainCount: Int) -> Unit

onRetry

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener1.retry.

typealias onRetry = (task: DownloadTask, cause: ResumeFailedCause) -> Unit

onStarted

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener3.started.

typealias onStarted = taskCallback

onTaskEnd

Correspond to com.liulishuo.okdownload.DownloadListener.taskEnd

typealias onTaskEnd = (task: DownloadTask, cause: EndCause, realCause: Exception?) -> Unit

onTaskEndWithListener4Model

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4.taskEnd

typealias onTaskEndWithListener4Model = (task: DownloadTask, cause: EndCause, realCause: Exception?, model: Listener4Model) -> Unit

onTaskEndWithModel

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener1.taskEnd.

typealias onTaskEndWithModel = (task: DownloadTask, cause: EndCause, realCause: Exception?, model: Listener1Model) -> Unit

onTaskEndWithSpeed

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener4WithSpeed.taskEnd

typealias onTaskEndWithSpeed = (task: DownloadTask, cause: EndCause, realCause: Exception?, taskSpeed: SpeedCalculator) -> Unit

onTaskStart

Correspond to com.liulishuo.okdownload.DownloadListener.taskStart

typealias onTaskStart = (task: DownloadTask) -> Unit

onTaskStartWithModel

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener1.taskStart.

typealias onTaskStartWithModel = (task: DownloadTask, model: Listener1Model) -> Unit

onWarn

Correspond to com.liulishuo.okdownload.core.listener.DownloadListener3.warn.

typealias onWarn = taskCallback

taskCallback

typealias taskCallback = (task: DownloadTask) -> Unit

Extensions for External Classes

com.liulishuo.okdownload.DownloadListener

Functions

createDownloadContextListener

A concise way to create a DownloadContextListener, only the DownloadContextListener.queueEnd is necessary.

fun createDownloadContextListener(onQueueTaskEnd: onQueueTaskEnd? = null, onQueueEnd: onQueueEnd): DownloadContextListener

createListener

A concise way to create a DownloadListener, only the DownloadListener.taskEnd is necessary.

fun createListener(onTaskStart: onTaskStart? = null, onConnectTrialStart: onConnectTrialStart? = null, onConnectTrialEnd: onConnectTrialEnd? = null, onDownloadFromBeginning: onDownloadFromBeginning? = null, onDownloadFromBreakpoint: onDownloadFromBreakpoint? = null, onConnectStart: onConnectStart? = null, onConnectEnd: onConnectEnd? = null, onFetchStart: onFetchStart? = null, onFetchProgress: onFetchProgress? = null, onFetchEnd: onFetchEnd? = null, onTaskEnd: onTaskEnd): DownloadListener

createListener1

A concise way to create a DownloadListener1, only the DownloadListener1.taskEnd is necessary.

fun createListener1(taskStart: onTaskStartWithModel? = null, retry: onRetry? = null, connected: onConnected? = null, progress: onProgress? = null, taskEnd: onTaskEndWithModel): DownloadListener1

createListener2

A concise way to create a DownloadListener2, only the DownloadListener2.taskEnd is necessary.

fun createListener2(onTaskStart: onTaskStart = {}, onTaskEnd: onTaskEnd): DownloadListener2

createListener3

fun createListener3(onStarted: onStarted? = null, onConnected: onConnected? = null, onProgress: onProgress? = null, onCompleted: onCompleted? = null, onCanceled: onCanceled? = null, onWarn: onWarn? = null, onRetry: onRetry? = null, onError: onError? = null, onTerminal: () -> Unit = {}): DownloadListener3

createListener4

A concise way to create a DownloadListener4, only the DownloadListener4.taskEnd is necessary.

fun createListener4(onTaskStart: onTaskStart? = null, onConnectStart: onConnectStart? = null, onConnectEnd: onConnectEnd? = null, onInfoReady: onInfoReady? = null, onProgressBlock: onProgressBlock? = null, onProgressWithoutTotalLength: onProgressWithoutTotalLength? = null, onBlockEnd: onBlockEnd? = null, onTaskEndWithListener4Model: onTaskEndWithListener4Model): DownloadListener4

createListener4WithSpeed

A concise way to create a DownloadListener4WithSpeed, only the DownloadListener4WithSpeed.taskEnd is necessary.

fun createListener4WithSpeed(onTaskStart: onTaskStart? = null, onConnectStart: onConnectStart? = null, onConnectEnd: onConnectEnd? = null, onInfoReadyWithSpeed: onInfoReadyWithSpeed? = null, onProgressBlockWithSpeed: onProgressBlockWithSpeed? = null, onProgressWithSpeed: onProgressWithSpeed? = null, onBlockEndWithSpeed: onBlockEndWithSpeed? = null, onTaskEndWithSpeed: onTaskEndWithSpeed): DownloadListener4WithSpeed