From 15e77962960b043c657bd8ee1b719dbd41e636fb Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 15 Jun 2017 20:25:40 -0700 Subject: Add changelog customizer --- library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'library') 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 b7b1586..77238f1 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -123,17 +123,18 @@ fun Context.resolveString(@AttrRes attr: Int, fallback: String = ""): String { return if (theme.resolveAttribute(attr, v, true)) v.string.toString() else fallback } -fun Context.showChangelog(@XmlRes xmlRes: Int) { +fun Context.showChangelog(@XmlRes xmlRes: Int, customize: MaterialDialog.Builder.() -> Unit = {}) { val mHandler = Handler() Thread(Runnable { val items = parse(this, xmlRes) mHandler.post(object : TimerTask() { override fun run() { - MaterialDialog.Builder(this@showChangelog) + val builder = MaterialDialog.Builder(this@showChangelog) .title(R.string.kau_changelog) .positiveText(R.string.kau_great) .adapter(ChangelogAdapter(items), null) - .show() + builder.customize() + builder.show() } }) }).start() -- cgit v1.2.3