From db3b6c08b42470bd77b1e8d867a708ca3466baef Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 15:29:53 -0400 Subject: Return md from materialDialog func --- core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/src/main') diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index 82d5608..e8680dc 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -203,12 +203,15 @@ fun Context.resolveString(@AttrRes attr: Int, fallback: String = ""): String { inline fun Context.materialDialog( dialogBehavior: DialogBehavior = ModalDialog, action: MaterialDialog.() -> Unit -) { +): MaterialDialog { val dialog = MaterialDialog(this, dialogBehavior) + dialog.action() if (isFinishing) { - return KL.d { "Material Dialog triggered from finishing context; did not show" } + KL.d { "Material Dialog triggered from finishing context; did not show" } + } else { + dialog.show() } - dialog.show(action) + return dialog } fun Context.getDip(value: Float): Float = -- cgit v1.2.3