From 3293b5f4e2060f3ae22bdd941b8654bde70c9939 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 12:56:33 -0400 Subject: Update public xml script to ignore modules without res items --- core/src/main/res-public/values/public.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/src') diff --git a/core/src/main/res-public/values/public.xml b/core/src/main/res-public/values/public.xml index ea8ed73..9761199 100644 --- a/core/src/main/res-public/values/public.xml +++ b/core/src/main/res-public/values/public.xml @@ -1,5 +1,5 @@ - + -- cgit v1.2.3 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 +++++----------- core/src/main/res/layout/kau_changelog_content.xml | 2 ++ 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'core/src') 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) } } diff --git a/core/src/main/res/layout/kau_changelog_content.xml b/core/src/main/res/layout/kau_changelog_content.xml index ab94956..1fea88d 100644 --- a/core/src/main/res/layout/kau_changelog_content.xml +++ b/core/src/main/res/layout/kau_changelog_content.xml @@ -10,6 +10,7 @@ Date: Fri, 7 Jun 2019 13:11:45 -0400 Subject: Add deprecation annotations for network utils --- core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt | 3 +++ docs/Migration.md | 2 +- sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt index 32cf084..39d689b 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/NetworkUtils.kt @@ -22,6 +22,7 @@ import android.net.ConnectivityManager /** * Created by Allan Wang on 2017-07-07. */ +@Suppress("DEPRECATION") @Deprecated("Applications should make use of network callbacks instead of individual queries") inline val Context.isNetworkAvailable: Boolean @SuppressLint("MissingPermission") @@ -31,6 +32,7 @@ inline val Context.isNetworkAvailable: Boolean return activeNetworkInfo?.isConnectedOrConnecting ?: false } +@Suppress("DEPRECATION") @Deprecated("Applications should make use of network callbacks instead of individual queries") inline val Context.isWifiConnected: Boolean @SuppressLint("MissingPermission") @@ -40,6 +42,7 @@ inline val Context.isWifiConnected: Boolean return (activeNetworkInfo?.type ?: -1) == ConnectivityManager.TYPE_WIFI } +@Suppress("DEPRECATION") @Deprecated("Applications should make use of network callbacks instead of individual queries") inline val Context.isMobileDataConnected: Boolean @SuppressLint("MissingPermission") diff --git a/docs/Migration.md b/docs/Migration.md index b8d5715..203dc1d 100644 --- a/docs/Migration.md +++ b/docs/Migration.md @@ -13,7 +13,7 @@ Please refer to [MD's documents](https://github.com/afollestad/material-dialogs/ Alongside such changes, `:colorpicker` is no longer as necessary. It exists mainly to provide an internal interface for other submodules. After Material Dialog 2.x, a decision was made to enforce theming through xml styles only to avoid reflection. -As a result, options to supply custom dialog colors are now removed. +As a result, options to supply custom dialog colors are now removed (ie in the changelog dialog and color picker kprefs). ## Update ProgressAnimator diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 2c3bf23..9ce3f42 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -260,7 +260,7 @@ class MainActivity : KPrefActivity() { if (KPrefSample.version < BuildConfig.VERSION_CODE) { KPrefSample.version = BuildConfig.VERSION_CODE if (!BuildConfig.DEBUG) - showChangelog(R.xml.kau_changelog, KPrefSample.textColor) + showChangelog(R.xml.kau_changelog) } supportActionBar?.apply { setDisplayHomeAsUpEnabled(false) @@ -293,7 +293,7 @@ class MainActivity : KPrefActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { - R.id.action_changelog -> showChangelog(R.xml.kau_changelog, KPrefSample.textColor) + R.id.action_changelog -> showChangelog(R.xml.kau_changelog) R.id.action_settings -> startActivity() R.id.action_email -> sendEmail(R.string.your_email, R.string.your_subject) else -> return super.onOptionsItemSelected(item) -- cgit v1.2.3