mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 16:59:55 +00:00
Add: ManageableLiveData
This commit is contained in:
parent
aa352fe013
commit
c5821fc3e8
@ -0,0 +1,14 @@
|
|||||||
|
package com.looker.droidify.utility.extension
|
||||||
|
|
||||||
|
import androidx.lifecycle.MediatorLiveData
|
||||||
|
|
||||||
|
class ManageableLiveData<T> : MediatorLiveData<T>() {
|
||||||
|
var lastEdit: Long = 0L
|
||||||
|
|
||||||
|
fun updateValue(value: T, updateTime: Long) {
|
||||||
|
if (updateTime > lastEdit) {
|
||||||
|
lastEdit = updateTime
|
||||||
|
super.postValue(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user