bohsen
09/03/2019, 8:59 AMFlow
from a custom view or could this cause leaks?gildor
09/03/2019, 9:24 AMbohsen
09/03/2019, 9:40 AMkotlin
@ExperimentalCoroutinesApi
val textWatcher: Flow<CharSequence> = callbackFlow {
custom_inputview_text_input_edit_text.addOnTextChangedListener {
afterTextChanged { s -> Timber.d("AfterTextChanged: $s") }
beforeTextChanged { text, start, count, after -> Timber.d("BeforeTextChanged: $text") }
onTextChanged { text, start, before, count -> Timber.d("Within $text, the $count characters beginning at $start have just replaced old text that had length $before.") }
}
}
bohsen
09/03/2019, 10:16 AMPresenter
that is attached to a Fragment
in onActivityCreated()
and detached in onDestroy()
gildor
09/03/2019, 10:17 AMgildor
09/03/2019, 10:17 AMgildor
09/03/2019, 10:18 AMbohsen
09/03/2019, 10:55 AMsubscribe after onViewCreated and detach onDestroyViewAfraid this will lead to other issues.
gildor
09/03/2019, 11:42 AMgildor
09/03/2019, 11:42 AMgildor
09/03/2019, 11:43 AMrkeazor
09/03/2019, 12:02 PMbohsen
09/03/2019, 12:22 PMPresenter
would implement (Default)LifecycleObserver
and start observing viewLifecycle
of the Fragment
it would be possible to avoid leaking the view?bohsen
09/03/2019, 12:22 PMcollect
when the `Fragment`s view gets destroyed?gildor
09/03/2019, 2:31 PMgildor
09/03/2019, 2:32 PMbohsen
09/03/2019, 7:28 PMviewLifecycleObserver.coroutineScope
Do you mean the new lifecycleOwner.lifecycleScope
-API that is released in lifecycle-runtime-ktx:2.2.0-alpha01?gildor
09/03/2019, 11:24 PMbohsen
09/04/2019, 5:40 AM