ansman
04/15/2019, 10:17 PMwithTimeoutOrNull(100) {
suspendCoroutine<Unit> { cont ->
(context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)
.hideSoftInputFromWindow(windowToken, 0, object : ResultReceiver(handler) {
override fun onReceiveResult(resultCode: Int, resultData: Bundle?) {
cont.resume(Unit)
}
})
}
}
louiscad
04/16/2019, 6:09 AMsuspenCancellableCoroutine
and unregister the receiver in a finally block, or in cont.invokeOnClose.ansman
04/16/2019, 10:50 AMsuspendCoroutine
exist, why not only have suspendCancellableCoroutine
louiscad
04/16/2019, 4:10 PMansman
04/16/2019, 4:57 PMlouiscad
04/16/2019, 7:00 PM