TransformationMutableLiveData

class TransformationMutableLiveData<T>(transformation: (T) -> T) : MutableLiveData<T>

A LiveData that applies a transformation to the value before setting it.

For transformations when reading LiveData, Transformations.map is more suitable. With two-way data binding that is not possible however and this class can be used.

For example this can be useful to restrict the value applied in the LiveData between a min and max value.

Constructors

Link copied to clipboard
fun <T> TransformationMutableLiveData(value: T, transformation: (T) -> T)
Link copied to clipboard
fun <T> TransformationMutableLiveData(transformation: (T) -> T)

Inherited properties

Link copied to clipboard
val mActiveCount: Int
Link copied to clipboard
val mDataLock: Any
Link copied to clipboard
val mPendingData: Any

Functions

Link copied to clipboard
open override fun postValue(value: T)
Link copied to clipboard
open override fun setValue(value: T)

Inherited functions

Link copied to clipboard
open fun changeActiveCounter(p0: Int)
Link copied to clipboard
open fun dispatchingValue(@Nullable p0: LiveData.ObserverWrapper<T>?)
Link copied to clipboard
open fun getValue(): T?
Link copied to clipboard
open fun getVersion(): Int
Link copied to clipboard
open fun hasActiveObservers(): Boolean
Link copied to clipboard
open fun hasObservers(): Boolean
Link copied to clipboard
open fun observe(@NonNull p0: LifecycleOwner, @NonNull p1: Observer<in T>)
Link copied to clipboard
open fun observeForever(@NonNull p0: Observer<in T>)
Link copied to clipboard
open fun onActive()
Link copied to clipboard
open fun onInactive()
Link copied to clipboard
open fun removeObserver(@NonNull p0: Observer<in T>)
Link copied to clipboard
open fun removeObservers(@NonNull p0: LifecycleOwner)