net / com.drake.net.time / Interval
class Interval :
Serializable
轮循器
操作
回调: 允许多次订阅同一个轮循器
end
- 结束值
period
- 事件间隔
unit
- 事件单位
initialDelay
- 第一次事件的间隔时间
start
- 开始值, 当start]比end值大, 且end不等于-1时, 即为倒计时
Name | Summary |
---|---|
<init> | Interval(period: Long , unit: TimeUnit , initialDelay: Long = 0) 轮循器 Interval(end: Long , period: Long , unit: TimeUnit , start: Long = 0, initialDelay: Long = 0) |
Name | Summary |
---|---|
count | 轮循器的计数var count: Long |
end | 结束值var end: Long |
state | 轮循器当前状态var state: IntervalStatus |
Name | Summary |
---|---|
finish | 轮循器完成fun finish(block: ( Long ) -> Unit ): Interval |
life | 绑定生命周期, 在指定生命周期发生时取消轮循器fun life(lifecycleOwner: LifecycleOwner, lifeEvent: Event = Lifecycle.Event.ON_STOP): Interval |
pause | 暂停fun pause(): Unit |
reset | 重置fun reset(): Unit |
resume | 继续fun resume(): Unit |
start | 开始fun start(): Unit |
stop | 停止fun stop(): Unit |
subscribe | 订阅轮循器fun subscribe(block: ( Long ) -> Unit ): Interval |
switch | 开关fun switch(): Unit |