diff options
Diffstat (limited to 'library/src/main')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index f5361c3..eeaa93c 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -135,10 +135,14 @@ fun Context.showChangelog(@XmlRes xmlRes: Int) { /** * Wrapper function for the MaterialDialog builder - * Must end with build() to return the dialog - * Don't forget to call show() on the result to display the dialog + * There is no need to call build() or show() as those are done by default */ -fun Context.materialDialog(action: MaterialDialog.Builder.() -> MaterialDialog): MaterialDialog = MaterialDialog.Builder(this).action() +fun Context.materialDialog(action: MaterialDialog.Builder.() -> Unit): MaterialDialog { + val builder = MaterialDialog.Builder(this) + builder.action() + builder.build() + return builder.show() +} val Context.isNetworkAvailable: Boolean get() { |