From d377eca31a9c9623c525f181a32c588a31dc5737 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 12:45:59 -0400 Subject: Update migration docs --- .../main/groovy/ca/allanwang/kau/Versions.groovy | 57 ---------------------- docs/Migration.md | 3 ++ 2 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy deleted file mode 100644 index d767a8a..0000000 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy +++ /dev/null @@ -1,57 +0,0 @@ -package ca.allanwang.kau - -class Versions { - static def coreMinSdk = 19 - static def minSdk = 21 - static def targetSdk = 28 - - // https://developer.android.com/studio/releases/build-tools - static def buildTools = '28.0.3' - - // https://developer.android.com/topic/libraries/support-library/revisions - static def supportLibs = '28.0.0' - - // https://kotlinlang.org/docs/reference/using-gradle.html - static def kotlin = '1.2.71' - - // https://github.com/mikepenz/AboutLibraries/releases - static def aboutLibraries = '6.1.1' - - // https://github.com/Kotlin/anko/releases - static def anko = '0.10.5' - - // https://github.com/wasabeef/Blurry/releases - static def blurry = '2.1.1' - - // https://dl.google.com/dl/android/maven2/com/android/support/constraint/group-index.xml - static def constraintLayout = '1.1.3' - - // https://github.com/mikepenz/FastAdapter#using-maven - static def fastAdapter = '3.2.9' - static def fastAdapterCommons = fastAdapter - - // https://github.com/bumptech/glide/releases - static def glide = '4.8.0' - - // https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency - static def iconics = '3.0.4' - static def iconicsGoogle = '3.0.1.2' - static def iconicsMaterial = '2.2.0.4' - static def iconicsCommunity = '2.0.46.1' - - // https://github.com/afollestad/material-dialogs/releases - static def materialDialog = '0.9.6.0' - - static def espresso = '3.0.1' - static def junit = '4.12' - static def testRunner = '1.0.1' - - static def gradlePlugin = '3.2.1' - static def mavenPlugin = '2.1' - static def playPublishPlugin = '1.2.2' - - // https://github.com/KeepSafe/dexcount-gradle-plugin/releases - static def dexCountPlugin = '0.8.4' - // https://github.com/gladed/gradle-android-git-version/releases - static def gitVersionPlugin = '0.4.5' -} \ No newline at end of file diff --git a/docs/Migration.md b/docs/Migration.md index 593056e..b8d5715 100644 --- a/docs/Migration.md +++ b/docs/Migration.md @@ -12,6 +12,9 @@ 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. + ## Update ProgressAnimator `ProgressAnimator` has been completely rewritten to be an extension of `ValueAnimator`. -- cgit v1.2.3 From 013f08f9061ad0dea803e5e63f24480a138a05b2 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 12:48:07 -0400 Subject: Clean up changelog config --- .../main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 14 ++------------ sample/src/main/res/values/colors.xml | 6 +++--- 2 files changed, 5 insertions(+), 15 deletions(-) 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 d9586c4..2c3bf23 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -260,12 +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) { - // TODO MD Color -// titleColor(KPrefSample.textColor) -// backgroundColor(KPrefSample.bgColor) -// positiveColor(KPrefSample.accentColor) - } + showChangelog(R.xml.kau_changelog, KPrefSample.textColor) } supportActionBar?.apply { setDisplayHomeAsUpEnabled(false) @@ -298,12 +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) { - // TODO MD Color -// titleColor(KPrefSample.textColor) -// backgroundColor(KPrefSample.bgColor) -// positiveColor(KPrefSample.accentColor) - } + R.id.action_changelog -> showChangelog(R.xml.kau_changelog, KPrefSample.textColor) R.id.action_settings -> startActivity() R.id.action_email -> sendEmail(R.string.your_email, R.string.your_subject) else -> return super.onOptionsItemSelected(item) diff --git a/sample/src/main/res/values/colors.xml b/sample/src/main/res/values/colors.xml index 3ab3e9c..12363c4 100644 --- a/sample/src/main/res/values/colors.xml +++ b/sample/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ - #3F51B5 - #303F9F - #FF4081 + #2196F3 + #1976D2 + #FF5722 -- cgit v1.2.3 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 --- artifacts.gradle | 27 +++++++++++++++++---------- core-ui/src/main/res-public/values/public.xml | 2 +- core/src/main/res-public/values/public.xml | 2 +- docs/Changelog.md | 4 ++++ 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/artifacts.gradle b/artifacts.gradle index ab291f7..4471d37 100644 --- a/artifacts.gradle +++ b/artifacts.gradle @@ -31,16 +31,23 @@ artifacts { // We assume resources within res-public are public task generatepublicxml { - def resDir = project.projectDir.absolutePath + "/src/main/res-public" - - def publicFolder = file(resDir + "/values") - if (!publicFolder.exists()) publicFolder.mkdirs() + def resDir = project.projectDir.absolutePath + "/src/main/res" + def publicDir = resDir + "-public" + def resFolder = file(resDir + "/values") + def publicFolder = file(publicDir + "/values") + if (!publicFolder.exists()) { + // No res; no need for contents + if (!resFolder.exists()) { + return + } + publicFolder.mkdirs() + } // Include the desired res types // Note: we don't need the qualified resource directories, // since those resources will already be defined in the unqualified directories // however, there are special cases like transition-v21 that is only available on lollipop and up - def tree = fileTree(dir: resDir, + def tree = fileTree(dir: publicDir, includes: ['**/anim/*.xml', '**/color/*.xml', '**/drawable/*.xml', @@ -54,12 +61,12 @@ task generatepublicxml { println "Generating public XML: ${project.name}" // Create new public.xml with writer - file(resDir + "/values/public.xml").withWriter { writer -> + file(publicDir + "/values/public.xml").withWriter { writer -> // Create MarkupBuilder with 4 space indent - def destXml = new MarkupBuilder(new IndentPrinter(writer, " ", true)); - def destXmlMkp = destXml.getMkp(); + def destXml = new MarkupBuilder(new IndentPrinter(writer, " ", true)) + def destXmlMkp = destXml.getMkp() - // GIST NOTE: our project needed the ResourceName suppression, but its not needed in general + // GIST NOTE: our project needed the ResourceName suppression, but it's not needed in general destXml.resources( 'xmlns:tools': 'http://schemas.android.com/tools', 'tools:ignore': 'ResourceName' @@ -74,7 +81,7 @@ task generatepublicxml { tree.each { resFile -> // use the directory name to get the type - def type = resFile.getParentFile().getName() + String type = resFile.getParentFile().getName() if (type == "values") { // Resource files under values. Parse the file, and pull out the resource definitions diff --git a/core-ui/src/main/res-public/values/public.xml b/core-ui/src/main/res-public/values/public.xml index f46b3eb..af7ce44 100644 --- a/core-ui/src/main/res-public/values/public.xml +++ b/core-ui/src/main/res-public/values/public.xml @@ -1,5 +1,5 @@ - + 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 @@ - + diff --git a/docs/Changelog.md b/docs/Changelog.md index a2c38e1..61e5fb7 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## v5.0.0 +* :core: Update Material Dialogs to 3.x +* :colorpicker: Strip down to just the interface; unless you require the accent palette, it may be fine to just use MD's color extension + ## v4.1.0 * :core: Deprecate NetworkUtils, as the underlying functions are deprecated * :core: Permission manager no longer synchronized, as all actions should occur in the main thread -- 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(-) 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(-) 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 From 6e37f118bfa98c07699d1d610a1549923d446ebe Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 7 Jun 2019 13:18:39 -0400 Subject: Enforce java 1.8 to fix build problems --- .idea/misc.xml | 2 +- android-lib.gradle | 5 +++++ sample/build.gradle | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 51fa3e5..cc04cd3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -35,7 +35,7 @@ - + diff --git a/android-lib.gradle b/android-lib.gradle index e8a4c6d..28fc945 100644 --- a/android-lib.gradle +++ b/android-lib.gradle @@ -61,6 +61,11 @@ android { pickFirst 'META-INF/library_release.kotlin_module' } + compileOptions { + sourceCompatibility '1.8' + targetCompatibility '1.8' + } + sourceSets { main.java.srcDirs += 'src/main/kotlin' test.java.srcDirs += 'src/test/kotlin' diff --git a/sample/build.gradle b/sample/build.gradle index bb7cab0..d11e5bd 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -80,6 +80,11 @@ android { pickFirst 'META-INF/library_release.kotlin_module' } + compileOptions { + sourceCompatibility '1.8' + targetCompatibility '1.8' + } + sourceSets { main.java.srcDirs += 'src/main/kotlin' test.java.srcDirs += 'src/test/kotlin' -- cgit v1.2.3