MCPcopy Create free account
hub / github.com/M66B/FairEmail / onChanged

Function onChanged

app/src/main/java/androidx/lifecycle/Transformations.kt:166–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 var liveData: LiveData<Y>? = null
165
166 override fun onChanged(value: X) {
167 val newLiveData = switchMapFunction.apply(value)
168 if (liveData === newLiveData) {
169 return
170 }
171 if (liveData != null) {
172 result.removeSource(liveData!!)
173 }
174 liveData = newLiveData
175 if (liveData != null) {
176 result.addSource(liveData!!) { y -> result.setValue(y) }
177 }
178 }
179 },
180 )
181 return result

Callers

nothing calls this directly

Calls 4

addSourceMethod · 0.80
setValueMethod · 0.65
applyMethod · 0.45
removeSourceMethod · 0.45

Tested by

no test coverage detected