This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun String.waitForBroadcast( | |
context: Context, | |
trigger: (() -> Unit)? = null) = | |
suspendCoroutine<Boolean> { continuation -> | |
var broadcastReceiver: BroadcastReceiver? = null | |
try | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suspend fun RecyclerView.awaitScrollToPositionWithOffset(position: Int, offset: Int) = suspendCoroutine<Unit> { | |
val layoutManager = layoutManager as? LinearLayoutManager ?: return@suspendCoroutine it.resume(Unit) | |
addOnScrollListener(object : RecyclerView.OnScrollListener() | |
{ | |
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) | |
{ | |
super.onScrollStateChanged(recyclerView, newState) |