From e3a8afc8ec7e99899303de5dc715a1c4ef8fb675 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 13:06:27 -0400 Subject: Remove custom colors for changelog --- core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'core/src/main/kotlin/ca') diff --git a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt index 2e66a97..9adcbf4 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/xml/Changelog.kt @@ -21,7 +21,6 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.TextView -import androidx.annotation.ColorInt import androidx.annotation.LayoutRes import androidx.annotation.XmlRes import androidx.recyclerview.widget.RecyclerView @@ -41,13 +40,13 @@ import org.xmlpull.v1.XmlPullParser * * Easy changelog loader */ -fun Context.showChangelog(@XmlRes xmlRes: Int, @ColorInt textColor: Int? = null, customize: MaterialDialog.() -> Unit = {}) { - ctxCoroutine.launch { - val items = withContext(Dispatchers.Default) { parse(this@showChangelog, xmlRes) } +fun Context.showChangelog(@XmlRes xmlRes: Int, customize: MaterialDialog.() -> Unit = {}) { + ctxCoroutine.launch(Dispatchers.Main) { + val items = withContext(Dispatchers.IO) { parse(this@showChangelog, xmlRes) } materialDialog { title(R.string.kau_changelog) positiveButton(R.string.kau_great) - customListAdapter(ChangelogAdapter(items, textColor), null) + customListAdapter(ChangelogAdapter(items), null) customize() } } @@ -57,7 +56,7 @@ fun Context.showChangelog(@XmlRes xmlRes: Int, @ColorInt textColor: Int? = null, * Internals of the changelog dialog * Contains an mainAdapter for each item, as well as the tags to parse */ -internal class ChangelogAdapter(val items: List>, @ColorInt val textColor: Int? = null) : +internal class ChangelogAdapter(val items: List>) : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ChangelogVH( @@ -67,10 +66,6 @@ internal class ChangelogAdapter(val items: List>, @C override fun onBindViewHolder(holder: ChangelogVH, position: Int) { holder.text.text = items[position].first - if (textColor != null) { - holder.text.setTextColor(textColor) - holder.bullet?.setTextColor(textColor) - } } override fun getItemId(position: Int) = position.toLong() @@ -81,7 +76,6 @@ internal class ChangelogAdapter(val items: List>, @C internal class ChangelogVH(itemView: View) : RecyclerView.ViewHolder(itemView) { val text: TextView = itemView.findViewById(R.id.kau_changelog_text) - val bullet: TextView? = itemView.findViewById(R.id.kau_changelog_bullet) } } -- cgit v1.2.3