Skip to content

Instantly share code, notes, and snippets.

@JoseAlcerreca
Created May 24, 2019 12:31
Show Gist options
  • Save JoseAlcerreca/9a5cac2e2d07acc3e2b1c7518e7fe14d to your computer and use it in GitHub Desktop.
Save JoseAlcerreca/9a5cac2e2d07acc3e2b1c7518e7fe14d to your computer and use it in GitHub Desktop.
fun View.showSnackbar(snackbarText: String, timeLength: Int) {
Snackbar.make(this, snackbarText, timeLength).run {
addCallback(object: Snackbar.Callback() {
override fun onShown(sb: Snackbar?) {
EspressoIdlingResource.increment()
}
override fun onDismissed(transientBottomBar: Snackbar?, event: Int) {
EspressoIdlingResource.decrement()
}
})
show()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment