aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-06-07 15:29:53 -0400
committerAllan Wang <me@allanwang.ca>2019-06-07 15:29:53 -0400
commitdb3b6c08b42470bd77b1e8d867a708ca3466baef (patch)
tree310cb6d08f53a0be870f2aa16705f61d8f82b50e
parent29dcfc378bfd1466578a15c5f3b039a4a2d28927 (diff)
downloadkau-db3b6c08b42470bd77b1e8d867a708ca3466baef.tar.gz
kau-db3b6c08b42470bd77b1e8d867a708ca3466baef.tar.bz2
kau-db3b6c08b42470bd77b1e8d867a708ca3466baef.zip
Return md from materialDialog func
-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 =