From 19020070cc073c81bfe397454f2314d37a78ed31 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 8 Oct 2018 01:46:36 -0400 Subject: Enhancement/kpref (#170) * Deprecate kpref double * Update kpref tests and migration * Fix kpref file * Update changelog * Replace changelog angle brackets --- docs/Migration.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/Migration.md b/docs/Migration.md index 721cd0d..ff89f87 100644 --- a/docs/Migration.md +++ b/docs/Migration.md @@ -6,9 +6,22 @@ Below are some highlights on major refactoring/breaking changes Along with the update to support Android Studio 3.1, a lot of changes have occurred with other dependencies and with lint. -* Resource ids can be negatives due to the bit overflow. Instead, `INVALID_ID` has been introduced to signify an unset or invalid id. +## Invalid Resource Id Equality + +Resource ids can be negatives due to the bit overflow. +Instead, `INVALID_ID` has been introduced to signify an unset or invalid id. Methods such as `Context.string(id, fallback)` now check against `INVALID_ID` through equality rather than using an inequality to address this. +## Deprecate Kotterknife + +Kotterknife has been deprecated in favour of `kotlin-android-extensions`. +See [official docs](https://kotlinlang.org/docs/tutorials/android-plugin.html#view-binding). + +## Update KPref + +KPref has been slightly refactored internally. +Preferences backed by `StringSet` can now go back to `Set` + # v3.6.0 ## startActivity -- cgit v1.2.3 From 9dd6249d634c8b70d152907a4cda80da1626cddc Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 18 Oct 2018 00:30:47 -0400 Subject: Fix/kprefseekbar builder (#174) * Convert seekbar fields to getters * Make getters inline * Add spacing in readme, resolves #173 * Placeholder commit --- .travis.yml | 4 ++-- README.md | 4 ++-- .../src/main/groovy/ca/allanwang/kau/Versions.groovy | 2 +- docs/Changelog.md | 3 ++- .../allanwang/kau/kpref/activity/items/KPrefSeekbar.kt | 16 ++++++++-------- 5 files changed, 15 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/.travis.yml b/.travis.yml index 22743c3..721eb72 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,9 @@ jdk: - oraclejdk8 env: global: - - ANDROID_API=27 + - ANDROID_API=28 - EMULATOR_API=24 - - ANDROID_BUILD_TOOLS=27.0.3 + - ANDROID_BUILD_TOOLS=28.0.3 android: components: - tools diff --git a/README.md b/README.md index 4c0963c..edf6878 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ Note that if you use any particular submodule, it will automatically include all ```gradle dependencies { - //All submodules extend this + // all submodules extend this implementation "ca.allanwang.kau:core:$KAU" - //All submodules with extensive ui extend this + // all submodules with extensive ui extend this implementation "ca.allanwang.kau:core-ui:$KAU" implementation "ca.allanwang.kau:about:$KAU" diff --git a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy index e055c46..55fc646 100644 --- a/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy +++ b/buildSrc/src/main/groovy/ca/allanwang/kau/Versions.groovy @@ -46,7 +46,7 @@ class Versions { static def junit = '4.12' static def testRunner = '1.0.1' - static def gradlePlugin = '3.2.0' + static def gradlePlugin = '3.2.1' static def mavenPlugin = '2.1' static def playPublishPlugin = '1.2.2' diff --git a/docs/Changelog.md b/docs/Changelog.md index a93b4c8..a5f24f4 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -4,8 +4,9 @@ * Update everything to Android Studio 3.1 * Fix new lint issues (see Migration for resource related methods) * :adapter: Add more IAdapter functions to help retrieve selections -* :core: Add deprecation warning to bindView for fragment based extensions; use bindViewResettable instead +* :core: Deprecate Kotterknife; use kotlin_android_extensions * :kpref-activity: Fix seekbar increment +* :core: Make KPref use Set vs StringSet ## v3.7.1 * Update appcompat to 27.1.0 diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt index 78f4f80..ce61e8f 100644 --- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt +++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefSeekbar.kt @@ -15,14 +15,9 @@ import ca.allanwang.kau.utils.tint */ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase(builder) { - protected val min = builder.min - protected val max = builder.max - protected val increment = builder.increments - - init { - if (increment <= 0) - throw IllegalArgumentException("Seekbar must increment by at least 1") - } + protected inline val min get() = builder.min + protected inline val max get() = builder.max + protected inline val increment get() = builder.increments override fun KClick.defaultOnClick() = Unit @@ -83,6 +78,11 @@ open class KPrefSeekbar(val builder: KPrefSeekbarContract) : KPrefItemBase( override var max: Int = 100 override var increments: Int = 1 + set(value) { + if (value <= 0) + throw IllegalArgumentException("Seekbar must increment by at least 1") + field = value + } override var toText: (Int) -> String = Int::toString -- cgit v1.2.3