@Deprecated public class UnPeekLiveDataV3<T> extends ProtectedUnPeekLiveDataV3<T>
https://juejin.im/post/5dafc49b6fb9a04e17209922
本类参考了官方 SingleEventLive 的非入侵设计,
TODO:并创新性地引入了 "延迟清空消息" 的设计, 如此可确保: 1.一条消息能被多个观察者消费 2.延迟期结束,不再能够收到旧消息的推送 3.并且旧消息在延迟期结束时能从内存中释放,避免内存溢出等问题 4.让非入侵设计成为可能,遵循开闭原则
TODO:增加一层 ProtectedUnPeekLiveData, 用于限制从 Activity/Fragment 篡改来自 "数据层" 的数据,数据层的数据务必通过唯一可信源来分发, 如果这样说还不理解,详见: https://xiaozhuanlan.com/topic/6719328450 和 https://xiaozhuanlan.com/topic/0168753249
Create by KunMinX at 2020/7/21
| 限定符和类型 | 类和说明 |
|---|---|
static class |
UnPeekLiveDataV3.Builder<T>
已过时。
|
DELAY_TO_CLEAR_EVENT, isAllowNullValue, isAllowToClear| 构造器和说明 |
|---|
UnPeekLiveDataV3()
已过时。
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
postValue(T value)
已过时。
|
void |
setValue(T value)
已过时。
重写的 setValue 方法,默认不接收 null
可通过 Builder 配置允许接收
可通过 Builder 配置消息延时清理的时间
override setValue, do not receive null by default
You can configure to allow receiving through Builder
And also, You can configure the delay time of message clearing through Builder
|
observe, observeForeverpublic void setValue(T value)
ProtectedUnPeekLiveDataV3override setValue, do not receive null by default You can configure to allow receiving through Builder And also, You can configure the delay time of message clearing through Builder
setValue 在类中 ProtectedUnPeekLiveDataV3<T>