aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt9
1 files changed, 6 insertions, 3 deletions
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 =