From f4090285eb82a46cd7f99df4d2c606e3eb723154 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 2 Jul 2017 12:43:54 -0700 Subject: Return snackbar upon creation --- library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt index 7fa7c0e..d17a11f 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ViewUtils.kt @@ -48,10 +48,11 @@ import com.mikepenz.iconics.typeface.IIcon @KauUtils fun View.isInvisible(): Boolean = visibility == View.INVISIBLE @KauUtils fun View.isGone(): Boolean = visibility == View.GONE -fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) { +fun View.snackbar(text: String, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}): Snackbar { val snackbar = Snackbar.make(this, text, duration) snackbar.builder() snackbar.show() + return snackbar } fun View.snackbar(@StringRes textId: Int, duration: Int = Snackbar.LENGTH_LONG, builder: Snackbar.() -> Unit = {}) -- cgit v1.2.3