aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt12
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutBinder.kt8
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt22
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt8
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt8
-rw-r--r--about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt8
-rw-r--r--buildSrc/src/main/kotlin/kau/Versions.kt39
-rw-r--r--colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt99
-rw-r--r--core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt2
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt11
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt6
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/utils/UtilsAndroidTest.kt2
-rw-r--r--core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt2
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt20
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt20
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt11
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt9
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt8
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt30
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/CoroutineUtils.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt4
-rw-r--r--core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt2
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/kotlin/CoroutineTest.kt4
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt2
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/kotlin/LazyResettableTest.kt4
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt2
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/ui/ProgressAnimatorTest.kt2
-rw-r--r--core/src/test/kotlin/ca/allanwang/kau/utils/UtilsTest.kt2
-rw-r--r--docs/Changelog.md5
-rw-r--r--fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt12
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt2
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt3
-rw-r--r--fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt3
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt14
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt42
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt4
-rw-r--r--kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt3
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt22
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt11
-rw-r--r--mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt12
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt6
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt2
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt3
-rw-r--r--sample/src/main/AndroidManifest.xml4
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt10
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt3
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt32
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt44
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt13
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt3
-rw-r--r--sample/src/main/res/xml/kau_changelog.xml6
-rw-r--r--searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt92
-rw-r--r--spotless.gradle2
55 files changed, 419 insertions, 289 deletions
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
index 286d95e..59c3eb2 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutActivityBase.kt
@@ -101,13 +101,13 @@ abstract class AboutActivityBase(val rClass: Class<*>?) :
aboutIndicator.setViewPager(aboutPager)
aboutDraggableFrame.addListener(object :
ElasticDragDismissFrameLayout.SystemChromeFader(this@AboutActivityBase) {
- override fun onDragDismissed() {
- window.returnTransition = TransitionInflater.from(this@AboutActivityBase)
+ override fun onDragDismissed() {
+ window.returnTransition = TransitionInflater.from(this@AboutActivityBase)
.inflateTransition(if (aboutDraggableFrame.translationY > 0) R.transition.kau_exit_slide_bottom else R.transition.kau_exit_slide_top)
- panels[currentPage].recycler?.stopScroll()
- finishAfterTransition()
- }
- })
+ panels[currentPage].recycler?.stopScroll()
+ finishAfterTransition()
+ }
+ })
panels.forEachIndexed { index, contract -> contract.loadItems(this@AboutActivityBase, index) }
}
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutBinder.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutBinder.kt
index 1183113..89715e2 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutBinder.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutBinder.kt
@@ -27,6 +27,8 @@ import ca.allanwang.kau.utils.withSceneTransitionAnimation
* About activity launcher
*/
inline fun <reified T : AboutActivityBase> Context.kauLaunchAbout() =
- startActivity<T>(bundleBuilder = {
- withSceneTransitionAnimation(this@kauLaunchAbout)
- })
+ startActivity<T>(
+ bundleBuilder = {
+ withSceneTransitionAnimation(this@kauLaunchAbout)
+ }
+ )
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
index 1d9b2b0..ad8a7f4 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/AboutPanelDelegate.kt
@@ -35,10 +35,10 @@ import ca.allanwang.kau.utils.withMarginDecoration
import ca.allanwang.kau.xml.kauParseFaq
import com.mikepenz.aboutlibraries.Libs
import com.mikepenz.fastadapter.GenericItem
-import java.lang.reflect.Field
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
+import java.lang.reflect.Field
/**
* Created by Allan Wang on 2017-08-02.
@@ -154,16 +154,18 @@ open class AboutPanelMain : AboutPanelRecycler() {
with(activity) {
adapter = FastItemThemedAdapter(configs)
recycler = fullLinearRecycler(adapter)
- adapter.add(CutoutIItem {
- with(configs) {
- text = string(cutoutTextRes, cutoutText)
- drawable = drawable(cutoutDrawableRes, cutoutDrawable)
- if (configs.cutoutForeground != null) foregroundColor =
- configs.cutoutForeground!!
+ adapter.add(
+ CutoutIItem {
+ with(configs) {
+ text = string(cutoutTextRes, cutoutText)
+ drawable = drawable(cutoutDrawableRes, cutoutDrawable)
+ if (configs.cutoutForeground != null) foregroundColor =
+ configs.cutoutForeground!!
+ }
+ }.apply {
+ themeEnabled = configs.cutoutForeground == null
}
- }.apply {
- themeEnabled = configs.cutoutForeground == null
- })
+ )
postInflateMainPage(adapter)
return recycler!!
}
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt
index 2a1588c..addbe5f 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/CutoutIItem.kt
@@ -27,9 +27,11 @@ import ca.allanwang.kau.ui.views.CutoutView
*
* Just a cutout item with some defaults in [R.layout.kau_iitem_cutout]
*/
-class CutoutIItem(val config: CutoutView.() -> Unit = {}) : KauIItem<CutoutIItem.ViewHolder>(
- R.layout.kau_iitem_cutout, ::ViewHolder, R.id.kau_item_cutout
-), ThemableIItem by ThemableIItemDelegate() {
+class CutoutIItem(val config: CutoutView.() -> Unit = {}) :
+ KauIItem<CutoutIItem.ViewHolder>(
+ R.layout.kau_iitem_cutout, ::ViewHolder, R.id.kau_item_cutout
+ ),
+ ThemableIItem by ThemableIItemDelegate() {
override var isSelectable: Boolean
get() = false
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
index ddb9a18..4495cc1 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/FaqIItem.kt
@@ -37,9 +37,11 @@ import com.mikepenz.fastadapter.select.getSelectExtension
/**
* Created by Allan Wang on 2017-08-02.
*/
-class FaqIItem(val content: FaqItem) : KauIItem<FaqIItem.ViewHolder>(
- R.layout.kau_iitem_faq, ::ViewHolder, R.id.kau_item_faq
-), ThemableIItem by ThemableIItemDelegate() {
+class FaqIItem(val content: FaqItem) :
+ KauIItem<FaqIItem.ViewHolder>(
+ R.layout.kau_iitem_faq, ::ViewHolder, R.id.kau_item_faq
+ ),
+ ThemableIItem by ThemableIItemDelegate() {
companion object {
fun bindEvents(fastAdapter: FastAdapter<GenericItem>) {
diff --git a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
index c64fe4e..1c9a8b3 100644
--- a/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
+++ b/about/src/main/kotlin/ca/allanwang/kau/about/LibraryIItem.kt
@@ -35,9 +35,11 @@ import com.mikepenz.fastadapter.select.getSelectExtension
/**
* Created by Allan Wang on 2017-06-27.
*/
-class LibraryIItem(val lib: Library) : KauIItem<LibraryIItem.ViewHolder>(
- R.layout.kau_iitem_library, ::ViewHolder, R.id.kau_item_library
-), ThemableIItem by ThemableIItemDelegate() {
+class LibraryIItem(val lib: Library) :
+ KauIItem<LibraryIItem.ViewHolder>(
+ R.layout.kau_iitem_library, ::ViewHolder, R.id.kau_item_library
+ ),
+ ThemableIItem by ThemableIItemDelegate() {
companion object {
fun bindEvents(fastAdapter: FastAdapter<GenericItem>) {
diff --git a/buildSrc/src/main/kotlin/kau/Versions.kt b/buildSrc/src/main/kotlin/kau/Versions.kt
index d77f71a..28a24d6 100644
--- a/buildSrc/src/main/kotlin/kau/Versions.kt
+++ b/buildSrc/src/main/kotlin/kau/Versions.kt
@@ -5,15 +5,15 @@ import org.gradle.api.JavaVersion
object Versions {
const val coreMinSdk = 19
const val minSdk = 21
- const val targetSdk = 30
+ const val targetSdk = 31
val java = JavaVersion.VERSION_1_8
// https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google
- const val appcompat = "1.3.0-rc01"
+ const val appcompat = "1.4.0-beta01"
// https://mvnrepository.com/artifact/com.google.android.material/material
- const val googleMaterial = "1.3.0"
+ const val googleMaterial = "1.4.0"
// https://mvnrepository.com/artifact/androidx.recyclerview/recyclerview
const val recyclerView = "1.2.0"
@@ -25,19 +25,19 @@ object Versions {
const val cardView = "1.0.0"
// https://mvnrepository.com/artifact/androidx.constraintlayout/constraintlayout
- const val constraintLayout = "2.1.0"
+ const val constraintLayout = "2.1.1"
// https://mvnrepository.com/artifact/androidx.core/core-ktx
- const val coreKtx = "1.6.0"
+ const val coreKtx = "1.7.0-rc01"
// https://kotlinlang.org/docs/reference/using-gradle.html
- const val kotlin = "1.5.30"
+ const val kotlin = "1.5.31"
// https://github.com/Kotlin/kotlinx.coroutines/releases
- const val coroutines = "1.5.0"
+ const val coroutines = "1.5.2"
// https://github.com/mikepenz/AboutLibraries/releases
- const val aboutLibraries = "8.9.0"
+ const val aboutLibraries = "8.9.4"
// Keep old version
// https://github.com/wasabeef/Blurry/releases
@@ -50,8 +50,8 @@ object Versions {
const val glide = "4.12.0"
// https://github.com/mikepenz/Android-Iconics#1-provide-the-gradle-dependency
- const val iconics = "5.3.0"
- const val iconicsGoogle = "4.0.0.1"
+ const val iconics = "5.3.2"
+ const val iconicsGoogle = "4.0.0.2"
const val iconicsMaterial = "2.2.0.8"
const val iconicsCommunity = "5.8.55.0"
@@ -60,7 +60,7 @@ object Versions {
// https://github.com/google/dagger/releases
// https://mvnrepository.com/artifact/com.google.dagger/hilt-android
- const val hilt = "2.37"
+ const val hilt = "2.39.1"
// https://mvnrepository.com/artifact/androidx.ui/ui-core?repo=google
const val compose = "0.1.0-dev14"
@@ -69,7 +69,7 @@ object Versions {
const val leakCanary = "2.7"
// https://mvnrepository.com/artifact/androidx.test.espresso/espresso-core?repo=google
- const val espresso = "3.3.0"
+ const val espresso = "3.4.0"
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
const val junit = "4.13"
@@ -78,25 +78,28 @@ object Versions {
const val testRunner = "1.1.2"
// https://mvnrepository.com/artifact/androidx.test/rules?repo=google
- const val testRules = "1.3.0"
+ const val testRules = "1.4.0"
// https://github.com/diffplug/spotless/blob/master/plugin-gradle/CHANGES.md
- const val spotless = "5.7.0"
+ const val spotless = "5.14.3"
+
+ // https://github.com/pinterest/ktlint/releases
+ const val ktlint = "0.41.0"
// https://github.com/bugsnag/bugsnag-android/releases
- const val bugsnag = "5.12.0"
+ const val bugsnag = "5.14.0"
// https://github.com/bugsnag/bugsnag-android-gradle-plugin/releases
- const val bugsnagPlugin = "7.0.0"
+ const val bugsnagPlugin = "7.1.0"
// https://mvnrepository.com/artifact/com.android.tools.build/gradle?repo=google
const val gradlePlugin = "7.1.0-beta01"
// https://github.com/Triple-T/gradle-play-publisher/releases
- const val playPublishPlugin = "3.4.0-agp7.0"
+ const val playPublishPlugin = "3.5.0-agp7.0"
// https://github.com/KeepSafe/dexcount-gradle-plugin/releases
- const val dexCountPlugin = "3.0.0"
+ const val dexCountPlugin = "3.0.1"
// https://github.com/gladed/gradle-android-git-version/releases
const val gitVersionPlugin = "0.4.14"
diff --git a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt
index 113020c..0060227 100644
--- a/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt
+++ b/colorpicker/src/main/kotlin/ca/allanwang/kau/colorpicker/ColorPalette.kt
@@ -61,7 +61,8 @@ internal object ColorPalette {
"#D32F2F",
"#C62828",
"#B71C1C"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FCE4EC",
"#F8BBD0",
"#F48FB1",
@@ -72,7 +73,8 @@ internal object ColorPalette {
"#C2185B",
"#AD1457",
"#880E4F"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#F3E5F5",
"#E1BEE7",
"#CE93D8",
@@ -83,7 +85,8 @@ internal object ColorPalette {
"#7B1FA2",
"#6A1B9A",
"#4A148C"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#EDE7F6",
"#D1C4E9",
"#B39DDB",
@@ -94,7 +97,8 @@ internal object ColorPalette {
"#512DA8",
"#4527A0",
"#311B92"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E8EAF6",
"#C5CAE9",
"#9FA8DA",
@@ -105,7 +109,8 @@ internal object ColorPalette {
"#303F9F",
"#283593",
"#1A237E"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E3F2FD",
"#BBDEFB",
"#90CAF9",
@@ -116,7 +121,8 @@ internal object ColorPalette {
"#1976D2",
"#1565C0",
"#0D47A1"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E1F5FE",
"#B3E5FC",
"#81D4FA",
@@ -127,7 +133,8 @@ internal object ColorPalette {
"#0288D1",
"#0277BD",
"#01579B"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E0F7FA",
"#B2EBF2",
"#80DEEA",
@@ -138,7 +145,8 @@ internal object ColorPalette {
"#0097A7",
"#00838F",
"#006064"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E0F2F1",
"#B2DFDB",
"#80CBC4",
@@ -149,7 +157,8 @@ internal object ColorPalette {
"#00796B",
"#00695C",
"#004D40"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#E8F5E9",
"#C8E6C9",
"#A5D6A7",
@@ -160,7 +169,8 @@ internal object ColorPalette {
"#388E3C",
"#2E7D32",
"#1B5E20"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#F1F8E9",
"#DCEDC8",
"#C5E1A5",
@@ -171,7 +181,8 @@ internal object ColorPalette {
"#689F38",
"#558B2F",
"#33691E"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#F9FBE7",
"#F0F4C3",
"#E6EE9C",
@@ -182,7 +193,8 @@ internal object ColorPalette {
"#AFB42B",
"#9E9D24",
"#827717"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFFDE7",
"#FFF9C4",
"#FFF59D",
@@ -193,7 +205,8 @@ internal object ColorPalette {
"#FBC02D",
"#F9A825",
"#F57F17"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFF8E1",
"#FFECB3",
"#FFE082",
@@ -204,7 +217,8 @@ internal object ColorPalette {
"#FFA000",
"#FF8F00",
"#FF6F00"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFF3E0",
"#FFE0B2",
"#FFCC80",
@@ -215,7 +229,8 @@ internal object ColorPalette {
"#F57C00",
"#EF6C00",
"#E65100"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FBE9E7",
"#FFCCBC",
"#FFAB91",
@@ -226,7 +241,8 @@ internal object ColorPalette {
"#E64A19",
"#D84315",
"#BF360C"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#EFEBE9",
"#D7CCC8",
"#BCAAA4",
@@ -237,7 +253,8 @@ internal object ColorPalette {
"#5D4037",
"#4E342E",
"#3E2723"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FAFAFA",
"#F5F5F5",
"#EEEEEE",
@@ -248,7 +265,8 @@ internal object ColorPalette {
"#616161",
"#424242",
"#212121"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#ECEFF1",
"#CFD8DC",
"#B0BEC5",
@@ -291,77 +309,92 @@ internal object ColorPalette {
"#FF5252",
"#FF1744",
"#D50000"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FF80AB",
"#FF4081",
"#F50057",
"#C51162"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#EA80FC",
"#E040FB",
"#D500F9",
"#AA00FF"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#B388FF",
"#7C4DFF",
"#651FFF",
"#6200EA"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#8C9EFF",
"#536DFE",
"#3D5AFE",
"#304FFE"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#82B1FF",
"#448AFF",
"#2979FF",
"#2962FF"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#80D8FF",
"#40C4FF",
"#00B0FF",
"#0091EA"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#84FFFF",
"#18FFFF",
"#00E5FF",
"#00B8D4"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#A7FFEB",
"#64FFDA",
"#1DE9B6",
"#00BFA5"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#B9F6CA",
"#69F0AE",
"#00E676",
"#00C853"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#CCFF90",
"#B2FF59",
"#76FF03",
"#64DD17"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#F4FF81",
"#EEFF41",
"#C6FF00",
"#AEEA00"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFFF8D",
"#FFFF00",
"#FFEA00",
"#FFD600"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFE57F",
"#FFD740",
"#FFC400",
"#FFAB00"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FFD180",
"#FFAB40",
"#FF9100",
"#FF6D00"
- ), colorArrayOf(
+ ),
+ colorArrayOf(
"#FF9E80",
"#FF6E40",
"#FF3D00",
diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
index e948f29..d698a07 100644
--- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
+++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/activities/ElasticRecyclerActivity.kt
@@ -68,7 +68,7 @@ abstract class ElasticRecyclerActivity : KauBaseActivity() {
kauDraggable.addListener(object : ElasticDragDismissFrameLayout.SystemChromeFader(this@ElasticRecyclerActivity) {
override fun onDragDismissed() {
window.returnTransition = TransitionInflater.from(this@ElasticRecyclerActivity)
- .inflateTransition(if (kauDraggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
+ .inflateTransition(if (kauDraggable.translationY > 0) configs.exitTransitionBottom else configs.exitTransitionTop)
kauRecycler.stopScroll()
finishAfterTransition()
}
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
index 70558df..77a3b62 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt
@@ -20,10 +20,10 @@ import android.content.SharedPreferences
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import ca.allanwang.kau.context
-import kotlin.test.assertEquals
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2017-08-01.
@@ -45,9 +45,12 @@ class KPrefTest {
var two by kpref("two", 2f)
- var `true` by kpref("true", true, postSetter = {
- postSetterCount++
- })
+ var `true` by kpref(
+ "true", true,
+ postSetter = {
+ postSetterCount++
+ }
+ )
var hello by kpref("hello", "hello")
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
index 5e4688b..96ebd3a 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/KotterknifeTest.kt
@@ -22,12 +22,12 @@ import android.widget.TextView
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import androidx.test.platform.app.InstrumentationRegistry
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertNull
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
+import kotlin.test.assertEquals
+import kotlin.test.assertNotNull
+import kotlin.test.assertNull
/**
* Created by Allan Wang on 2017-07-30.
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/UtilsAndroidTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/UtilsAndroidTest.kt
index ffd903c..665e0b2 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/utils/UtilsAndroidTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/utils/UtilsAndroidTest.kt
@@ -17,9 +17,9 @@ package ca.allanwang.kau.utils
import android.graphics.Color
import androidx.test.ext.junit.runners.AndroidJUnit4
-import kotlin.test.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2018-12-24.
diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
index a98e254..7ec2a41 100644
--- a/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
+++ b/core/src/androidTest/kotlin/ca/allanwang/kau/xml/FaqTest.kt
@@ -20,9 +20,9 @@ import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.MediumTest
import ca.allanwang.kau.test.R
-import kotlin.test.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2017-08-01.
diff --git a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
index 6fb8f1f..cb8f4bf 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/internal/KauBaseActivity.kt
@@ -19,10 +19,10 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import ca.allanwang.kau.permissions.kauOnRequestPermissionsResult
import ca.allanwang.kau.utils.ContextHelper
-import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
+import kotlin.coroutines.CoroutineContext
/**
* Created by Allan Wang on 2017-08-01.
diff --git a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
index a9a97b7..1475720 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/logging/KauLogger.kt
@@ -113,14 +113,18 @@ class KauLoggerExtension(val tag: String, val logger: KauLogger) {
}
inline fun log(priority: Int, message: () -> Any?, t: Throwable? = null) =
- logger.log(priority, {
- val msg = message()?.toString()
- if (msg == null) {
- null
- } else {
- "$tag: $msg"
- }
- }, t)
+ logger.log(
+ priority,
+ {
+ val msg = message()?.toString()
+ if (msg == null) {
+ null
+ } else {
+ "$tag: $msg"
+ }
+ },
+ t
+ )
inline fun checkThread(id: Int) {
d {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt
index e3baa94..78bf253 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt
@@ -48,14 +48,18 @@ internal class RelativeSlider(var curPage: SwipeBackPage) : SwipeListener {
return
}
when (edgeFlag) {
- SWIPE_EDGE_LEFT -> page.swipeBackLayout.x =
- min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f)
- SWIPE_EDGE_RIGHT -> page.swipeBackLayout.x =
- min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f)
- SWIPE_EDGE_TOP -> page.swipeBackLayout.y =
- min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f)
- SWIPE_EDGE_BOTTOM -> page.swipeBackLayout.y =
- min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f)
+ SWIPE_EDGE_LEFT ->
+ page.swipeBackLayout.x =
+ min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f)
+ SWIPE_EDGE_RIGHT ->
+ page.swipeBackLayout.x =
+ min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f)
+ SWIPE_EDGE_TOP ->
+ page.swipeBackLayout.y =
+ min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f)
+ SWIPE_EDGE_BOTTOM ->
+ page.swipeBackLayout.y =
+ min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f)
}
}
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
index c8c8b34..0c1475a 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/AnimUtils.kt
@@ -166,10 +166,13 @@ fun View.fadeOut(
@KauUtils
fun TextView.setTextWithFade(text: String, duration: Long = 200, onFinish: (() -> Unit)? = null) {
- fadeOut(duration = duration, onFinish = {
- setText(text)
- fadeIn(duration = duration, onFinish = onFinish)
- })
+ fadeOut(
+ duration = duration,
+ onFinish = {
+ setText(text)
+ fadeIn(duration = duration, onFinish = onFinish)
+ }
+ )
}
@KauUtils
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
index b857eb0..6dab5cf 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/BundleUtils.kt
@@ -93,9 +93,12 @@ fun bundleOf(vararg params: kotlin.Pair<String, Any?>): Bundle {
* create a scene transition animation
*/
fun Bundle.withSceneTransitionAnimation(parent: View, data: Map<Int, String>) =
- withSceneTransitionAnimation(parent.context, data.mapKeys { (id, _) ->
- parent.findViewById<View>(id)
- })
+ withSceneTransitionAnimation(
+ parent.context,
+ data.mapKeys { (id, _) ->
+ parent.findViewById<View>(id)
+ }
+ )
/**
* Given a mapping of views to tags,
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
index 0131302..29c0919 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ColorUtils.kt
@@ -89,9 +89,11 @@ fun Int.isColorVisibleOn(
@IntRange(from = 0L, to = 255L) minAlpha: Int = 50
): Boolean =
if (Color.alpha(this) < minAlpha) false
- else !(abs(Color.red(this) - Color.red(color)) < delta &&
- abs(Color.green(this) - Color.green(color)) < delta &&
- abs(Color.blue(this) - Color.blue(color)) < delta)
+ else !(
+ abs(Color.red(this) - Color.red(color)) < delta &&
+ abs(Color.green(this) - Color.green(color)) < delta &&
+ abs(Color.blue(this) - Color.blue(color)) < delta
+ )
@ColorInt
fun Context.getDisabledColor(): Int {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
index 7d4a934..e797cfc 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt
@@ -57,9 +57,9 @@ inline fun <reified T : Activity> Context.startActivity(
) = startActivity(T::class.java, clearStack, bundleBuilder, intentBuilder)
@Deprecated(
- "Use reified generic instead of passing class",
- ReplaceWith("startActivity<T>(clearStack, bundleBuilder, intentBuilder)"),
- DeprecationLevel.WARNING
+ "Use reified generic instead of passing class",
+ ReplaceWith("startActivity<T>(clearStack, bundleBuilder, intentBuilder)"),
+ DeprecationLevel.WARNING
)
inline fun <T : Activity> Context.startActivity(
clazz: Class<T>,
@@ -120,13 +120,13 @@ fun Context.startLink(@StringRes url: Int): Boolean = startLink(string(url))
// Toast helpers
inline fun View.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) =
- context.toast(id, duration, log)
+ context.toast(id, duration, log)
inline fun Context.toast(@StringRes id: Int, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) =
- toast(this.string(id), duration, log)
+ toast(this.string(id), duration, log)
inline fun View.toast(text: String, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) =
- context.toast(text, duration, log)
+ context.toast(text, duration, log)
inline fun Context.toast(text: String, duration: Int = Toast.LENGTH_LONG, log: Boolean = false) {
Toast.makeText(this, text, duration).show()
@@ -139,10 +139,10 @@ const val INVALID_ID = 0
inline fun Context.string(@StringRes id: Int): String = getString(id)
inline fun Context.string(@StringRes id: Int, fallback: String?): String? =
- if (id != INVALID_ID) string(id) else fallback
+ if (id != INVALID_ID) string(id) else fallback
inline fun Context.string(@StringRes id: Int, fallback: () -> String?): String? =
- if (id != INVALID_ID) string(id) else fallback()
+ if (id != INVALID_ID) string(id) else fallback()
inline fun Context.color(@ColorRes id: Int): Int = ContextCompat.getColor(this, id)
inline fun Context.boolean(@BoolRes id: Int): Boolean = resources.getBoolean(id)
@@ -150,13 +150,13 @@ inline fun Context.integer(@IntegerRes id: Int): Int = resources.getInteger(id)
inline fun Context.dimen(@DimenRes id: Int): Float = resources.getDimension(id)
inline fun Context.dimenPixelSize(@DimenRes id: Int): Int = resources.getDimensionPixelSize(id)
inline fun Context.drawable(@DrawableRes id: Int): Drawable = ContextCompat.getDrawable(this, id)
- ?: throw KauException("Drawable with id $id not found")
+ ?: throw KauException("Drawable with id $id not found")
inline fun Context.drawable(@DrawableRes id: Int, fallback: Drawable?): Drawable? =
- if (id != INVALID_ID) drawable(id) else fallback
+ if (id != INVALID_ID) drawable(id) else fallback
inline fun Context.drawable(@DrawableRes id: Int, fallback: () -> Drawable?): Drawable? =
- if (id != INVALID_ID) drawable(id) else fallback()
+ if (id != INVALID_ID) drawable(id) else fallback()
inline fun Context.interpolator(@InterpolatorRes id: Int) = AnimationUtils.loadInterpolator(this, id)!!
inline fun Context.animation(@AnimRes id: Int) = AnimationUtils.loadAnimation(this, id)!!
@@ -165,7 +165,7 @@ inline fun Context.animation(@AnimRes id: Int) = AnimationUtils.loadAnimation(th
* Returns plural form of res. The quantity is also passed to the formatter as an int
*/
inline fun Context.plural(@PluralsRes id: Int, quantity: Number) =
- resources.getQuantityString(id, quantity.toInt(), quantity.toInt())
+ resources.getQuantityString(id, quantity.toInt(), quantity.toInt())
// Attr retrievers
fun Context.resolveColor(@AttrRes attr: Int, @ColorInt fallback: Int = 0): Int {
@@ -221,7 +221,7 @@ inline fun Context.materialDialog(
}
fun Context.getDip(value: Float): Float =
- TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, resources.displayMetrics)
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, resources.displayMetrics)
inline val Context.isRtl: Boolean
get() = resources.configuration.layoutDirection == View.LAYOUT_DIRECTION_RTL
@@ -239,8 +239,8 @@ inline val Context.isNavBarOnBottom: Boolean
}
fun Context.hasPermission(permissions: String) = !buildIsMarshmallowAndUp || ContextCompat.checkSelfPermission(
- this,
- permissions
+ this,
+ permissions
) == PackageManager.PERMISSION_GRANTED
fun Context.copyToClipboard(text: String?, label: String = "Copied Text", showToast: Boolean = true) {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/CoroutineUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/CoroutineUtils.kt
index 741f4e2..4d6ee54 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/CoroutineUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/CoroutineUtils.kt
@@ -19,14 +19,14 @@ import android.content.Context
import android.os.Handler
import android.os.Looper
import ca.allanwang.kau.internal.KauBaseActivity
-import kotlin.coroutines.CoroutineContext
-import kotlin.coroutines.EmptyCoroutineContext
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.android.asCoroutineDispatcher
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
+import kotlin.coroutines.CoroutineContext
+import kotlin.coroutines.EmptyCoroutineContext
object ContextHelper : CoroutineScope {
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
index 7c3e3cb..fac9421 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/Kotterknife.kt
@@ -34,14 +34,14 @@ import android.app.Dialog
import android.app.DialogFragment
import android.app.Fragment
import android.view.View
-import androidx.fragment.app.DialogFragment as SupportDialogFragment
-import androidx.fragment.app.Fragment as SupportFragment
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.ViewHolder
import java.util.Collections
import java.util.WeakHashMap
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
+import androidx.fragment.app.DialogFragment as SupportDialogFragment
+import androidx.fragment.app.Fragment as SupportFragment
fun <V : View> View.bindView(id: Int): ReadOnlyProperty<View, V> = required(id, viewFinder)
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
index 3e4a26a..523a586 100644
--- a/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
+++ b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt
@@ -21,9 +21,9 @@ import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.annotation.TransitionRes
import androidx.transition.AutoTransition
-import androidx.transition.Transition as SupportTransition
import androidx.transition.TransitionInflater
import androidx.transition.TransitionManager
+import androidx.transition.Transition as SupportTransition
/**
* Created by Allan Wang on 2017-06-24.
diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/CoroutineTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/CoroutineTest.kt
index 6c09a3e..1e86305 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/CoroutineTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/CoroutineTest.kt
@@ -15,14 +15,14 @@
*/
package ca.allanwang.kau.kotlin
-import kotlin.test.assertEquals
-import kotlin.test.fail
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import org.junit.Test
+import kotlin.test.assertEquals
+import kotlin.test.fail
/**
* Tests geared towards coroutines
diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
index 530f766..bc45ba5 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/DebounceTest.kt
@@ -15,9 +15,9 @@
*/
package ca.allanwang.kau.kotlin
-import kotlin.test.assertEquals
import org.junit.Ignore
import org.junit.Test
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2017-08-05.
diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/LazyResettableTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/LazyResettableTest.kt
index 556979f..eaaaacb 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/LazyResettableTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/LazyResettableTest.kt
@@ -15,10 +15,10 @@
*/
package ca.allanwang.kau.kotlin
-import kotlin.test.assertEquals
-import kotlin.test.assertNotEquals
import org.junit.Before
import org.junit.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertNotEquals
/**
* Created by Allan Wang on 2017-07-29.
diff --git a/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt b/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt
index f2d7fd6..e3d4e5b 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/kotlin/StreamsTest.kt
@@ -15,8 +15,8 @@
*/
package ca.allanwang.kau.kotlin
-import kotlin.test.assertEquals
import org.junit.Test
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2017-08-05.
diff --git a/core/src/test/kotlin/ca/allanwang/kau/ui/ProgressAnimatorTest.kt b/core/src/test/kotlin/ca/allanwang/kau/ui/ProgressAnimatorTest.kt
index a7edb05..8b99f3c 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/ui/ProgressAnimatorTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/ui/ProgressAnimatorTest.kt
@@ -15,11 +15,11 @@
*/
package ca.allanwang.kau.ui
+import org.junit.Test
import kotlin.math.min
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertTrue
-import org.junit.Test
class ProgressAnimatorTest {
diff --git a/core/src/test/kotlin/ca/allanwang/kau/utils/UtilsTest.kt b/core/src/test/kotlin/ca/allanwang/kau/utils/UtilsTest.kt
index 4aa2f25..b9c200a 100644
--- a/core/src/test/kotlin/ca/allanwang/kau/utils/UtilsTest.kt
+++ b/core/src/test/kotlin/ca/allanwang/kau/utils/UtilsTest.kt
@@ -16,8 +16,8 @@
package ca.allanwang.kau.utils
import android.graphics.Color
-import kotlin.test.assertEquals
import org.junit.Test
+import kotlin.test.assertEquals
/**
* Created by Allan Wang on 2017-06-23.
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 33a8a31..c93a67d 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -1,5 +1,10 @@
# Changelog
+## v6.4.0
+* Add support for Bumblebee 2021.1.1
+* Remove Koin
+* Many version bumps
+
## v6.3.0
* Add support for Arctic Fox 2020.3.1
* Move to new maven release system
diff --git a/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt b/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt
index ff694f0..a289dc8 100644
--- a/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt
+++ b/fastadapter-viewbinding/src/main/kotlin/ca/allanwang/fastadapter/viewbinding/BindingItem.kt
@@ -42,8 +42,8 @@ interface BindingLayout<Binding : ViewBinding> {
}
abstract class BindingItem<Binding : ViewBinding>(open val data: Any?) :
- AbstractItem<BindingItem.ViewHolder>(),
- BindingLayout<Binding> {
+ AbstractItem<BindingItem.ViewHolder>(),
+ BindingLayout<Binding> {
override val type: Int
get() = layoutRes
@@ -81,7 +81,7 @@ abstract class BindingItem<Binding : ViewBinding>(open val data: Any?) :
open fun Binding.unbindView(holder: ViewHolder) {}
final override fun getViewHolder(v: View): ViewHolder =
- ViewHolder(v, layoutRes)
+ ViewHolder(v, layoutRes)
override fun failedToRecycle(holder: ViewHolder): Boolean {
KL.e { "Failed to recycle" }
@@ -97,7 +97,7 @@ abstract class BindingItem<Binding : ViewBinding>(open val data: Any?) :
override fun hashCode(): Int = data.hashCode()
class ViewHolder(itemView: View, internal val layoutRes: Int) :
- RecyclerView.ViewHolder(itemView) {
+ RecyclerView.ViewHolder(itemView) {
/**
* Retrieves a binding.
@@ -119,7 +119,7 @@ abstract class BindingItem<Binding : ViewBinding>(open val data: Any?) :
}
abstract class BindingClickEventHook<Binding : ViewBinding, Item : BindingItem<Binding>>(val identifier: BindingLayout<Binding>) :
- ClickEventHook<Item>() {
+ ClickEventHook<Item>() {
private fun RecyclerView.ViewHolder.binding(): Binding? {
val holder = this as? BindingItem.ViewHolder ?: return null
@@ -146,7 +146,7 @@ abstract class BindingClickEventHook<Binding : ViewBinding, Item : BindingItem<B
}
open fun Binding.onBindMany(viewHolder: RecyclerView.ViewHolder): List<View>? =
- super.onBindMany(viewHolder)
+ super.onBindMany(viewHolder)
final override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<Item>, item: Item) {
BindingItem.getBinding<Binding>(v).onClick(v, position, fastAdapter, item)
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
index 32806f2..711db52 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/adapters/FastItemThemedAdapter.kt
@@ -161,7 +161,7 @@ class ThemableIItemDelegate : ThemableIItem, ThemableIItemColors by ThemableIIte
override fun bindBackgroundRipple(vararg views: View?) {
val background = backgroundColor ?: return
val foreground = accentColor ?: textColor ?: backgroundColor
- ?: return // default to normal background
+ ?: return // default to normal background
val ripple = createSimpleRippleDrawable(foreground, background)
views.forEach { it?.background = ripple }
}
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
index 41663c9..ce75f0f 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/CardIItem.kt
@@ -48,7 +48,8 @@ class CardIItem(
val builder: Config.() -> Unit = {}
) : KauIItem< CardIItem.ViewHolder>(
R.layout.kau_iitem_card, ::ViewHolder, R.id.kau_item_card
-), ThemableIItem by ThemableIItemDelegate() {
+),
+ ThemableIItem by ThemableIItemDelegate() {
companion object {
fun bindClickEvents(fastAdapter: FastAdapter<GenericItem>) {
diff --git a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
index 15ceb31..2e87b99 100644
--- a/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
+++ b/fastadapter/src/main/kotlin/ca/allanwang/kau/iitems/HeaderIItem.kt
@@ -36,7 +36,8 @@ class HeaderIItem(
var textRes: Int = INVALID_ID
) : KauIItem<HeaderIItem.ViewHolder>(
R.layout.kau_iitem_header, { ViewHolder(it) }, R.id.kau_item_header_big_margin_top
-), ThemableIItem by ThemableIItemDelegate() {
+),
+ ThemableIItem by ThemableIItemDelegate() {
var text: String = text ?: "Header Placeholder"
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1acc777..a0f7639 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
index 70b40e7..15bb008 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefActivity.kt
@@ -31,10 +31,10 @@ import ca.allanwang.kau.ui.views.RippleCanvas
import ca.allanwang.kau.utils.*
import com.mikepenz.fastadapter.adapters.FastItemAdapter
import com.mikepenz.fastadapter.select.getSelectExtension
-import java.util.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
+import java.util.*
abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract {
@@ -52,14 +52,14 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract {
private val recyclerAnimatorNext: KauAnimator by lazyUi {
KauAnimator(
- SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f),
- SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f)
+ SlideAnimatorAdd(KAU_RIGHT, itemDelayFactor = 0f),
+ SlideAnimatorRemove(KAU_LEFT, itemDelayFactor = 0f)
)
}
private val recyclerAnimatorPrev: KauAnimator by lazyUi {
KauAnimator(
- SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f),
- SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f)
+ SlideAnimatorAdd(KAU_LEFT, itemDelayFactor = 0f),
+ SlideAnimatorRemove(KAU_RIGHT, itemDelayFactor = 0f)
)
}
@@ -94,7 +94,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract {
insets
}
window.decorView.systemUiVisibility =
- View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
statusBarColor = 0x30000000
kauToolbarRipple.set(resolveColor(R.attr.colorPrimary))
kauRipple.set(resolveColor(android.R.attr.colorBackground))
@@ -115,7 +115,7 @@ abstract class KPrefActivity : KauBaseActivity(), KPrefActivityContract {
}
override fun showNextPrefs(@StringRes toolbarTitleRes: Int, builder: KPrefAdapterBuilder.() -> Unit) =
- binding.showNextPrefs(toolbarTitleRes, builder, false)
+ binding.showNextPrefs(toolbarTitleRes, builder, false)
private fun KauPrefActivityBinding.showNextPrefs(
@StringRes toolbarTitleRes: Int,
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
index 764831e..f349c33 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/KPrefBinder.kt
@@ -86,8 +86,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
setter: KPrefItemActions.(value: Boolean) -> Unit,
builder: KPrefItemBase.BaseContract<Boolean>.() -> Unit = {}
) = list.add(
- KPrefCheckbox(KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter)
- .apply { builder() })
+ KPrefCheckbox(
+ KPrefItemBase.BaseBuilder(globalOptions, title, getter, setter)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -97,8 +99,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefColorPicker.KPrefColorContract.() -> Unit = {}
) = list.add(
- KPrefColorPicker(KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter)
- .apply { builder() })
+ KPrefColorPicker(
+ KPrefColorPicker.KPrefColorBuilder(globalOptions, title, getter, setter)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -108,8 +112,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
setter: KPrefItemActions.(value: T) -> Unit,
builder: KPrefText.KPrefTextContract<T>.() -> Unit = {}
) = list.add(
- KPrefText(KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter)
- .apply { builder() })
+ KPrefText(
+ KPrefText.KPrefTextBuilder(globalOptions, title, getter, setter)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -118,8 +124,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
itemBuilder: KPrefAdapterBuilder.() -> Unit,
builder: KPrefSubItems.KPrefSubItemsContract.() -> Unit
) = list.add(
- KPrefSubItems(KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder)
- .apply { builder() })
+ KPrefSubItems(
+ KPrefSubItems.KPrefSubItemsBuilder(globalOptions, title, itemBuilder)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -127,8 +135,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
@StringRes title: Int,
builder: KPrefItemBase.BaseContract<Unit>.() -> Unit = {}
) = list.add(
- KPrefPlainText(KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title)
- .apply { builder() })
+ KPrefPlainText(
+ KPrefPlainText.KPrefPlainTextBuilder(globalOptions, title)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -138,8 +148,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefSeekbar.KPrefSeekbarContract.() -> Unit = {}
) = list.add(
- KPrefSeekbar(KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter)
- .apply { builder() })
+ KPrefSeekbar(
+ KPrefSeekbar.KPrefSeekbarBuilder(globalOptions, title, getter, setter)
+ .apply { builder() }
+ )
)
@KPrefMarker
@@ -149,8 +161,10 @@ class KPrefAdapterBuilder(val globalOptions: GlobalOptions) {
setter: KPrefItemActions.(value: Int) -> Unit,
builder: KPrefTimePicker.KPrefTimeContract.() -> Unit = {}
) = list.add(
- KPrefTimePicker(KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter)
- .apply { builder() })
+ KPrefTimePicker(
+ KPrefTimePicker.KPrefTimeBuilder(globalOptions, title, getter, setter)
+ .apply { builder() }
+ )
)
@KPrefMarker
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
index 0aaa2d3..8e1d9db 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefItemCore.kt
@@ -48,7 +48,9 @@ import com.mikepenz.iconics.typeface.IIcon
* Core class containing nothing but the view items
*/
-abstract class KPrefItemCore(val core: CoreContract) : AbstractItem<KPrefItemCore.ViewHolder>(), KPrefItemActions by core,
+abstract class KPrefItemCore(val core: CoreContract) :
+ AbstractItem<KPrefItemCore.ViewHolder>(),
+ KPrefItemActions by core,
ThemableIItem by ThemableIItemDelegate() {
final override fun getViewHolder(v: View) = ViewHolder(v)
diff --git a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
index 318b630..1270d78 100644
--- a/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
+++ b/kpref-activity/src/main/kotlin/ca/allanwang/kau/kpref/activity/items/KPrefTimePicker.kt
@@ -33,7 +33,8 @@ import java.util.Locale
*/
open class KPrefTimePicker(override val builder: KPrefTimeContract) : KPrefText<Int>(builder) {
- interface KPrefTimeContract : KPrefText.KPrefTextContract<Int>,
+ interface KPrefTimeContract :
+ KPrefText.KPrefTextContract<Int>,
TimePickerDialog.OnTimeSetListener {
var use24HourFormat: Boolean
}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
index fe25d97..0bd240b 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerActivityBase.kt
@@ -54,10 +54,10 @@ abstract class MediaPickerActivityBase(
private fun KauActivityImagePickerBinding.init() {
kauSelectionCount.setCompoundDrawables(
- null,
- null,
- GoogleMaterial.Icon.gmd_image.toDrawable(this@MediaPickerActivityBase, 18),
- null
+ null,
+ null,
+ GoogleMaterial.Icon.gmd_image.toDrawable(this@MediaPickerActivityBase, 18),
+ null
)
setSupportActionBar(kauToolbar)
@@ -65,10 +65,10 @@ abstract class MediaPickerActivityBase(
setDisplayHomeAsUpEnabled(true)
setDisplayShowHomeEnabled(true)
setHomeAsUpIndicator(
- GoogleMaterial.Icon.gmd_close.toDrawable(
- this@MediaPickerActivityBase,
- 18
- )
+ GoogleMaterial.Icon.gmd_close.toDrawable(
+ this@MediaPickerActivityBase,
+ 18
+ )
)
}
kauToolbar.setNavigationOnClickListener { onBackPressed() }
@@ -117,7 +117,7 @@ abstract class MediaPickerActivityBase(
val params = kauToolbar.layoutParams as AppBarLayout.LayoutParams
if (scrollable) {
params.scrollFlags = AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS or
- AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
+ AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
} else {
params.scrollFlags = 0
}
@@ -126,8 +126,8 @@ abstract class MediaPickerActivityBase(
override fun onLoadFinished(loader: Loader<Cursor>, data: Cursor?) {
super.onLoadFinished(loader, data)
binding.setToolbarScrollable(
- (binding.kauRecyclerview.layoutManager as LinearLayoutManager)
- .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1
+ (binding.kauRecyclerview.layoutManager as LinearLayoutManager)
+ .findLastCompletelyVisibleItemPosition() < adapter.adapterItemCount - 1
)
}
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt
index ac43f9f..ca6122b 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerBinder.kt
@@ -35,10 +35,13 @@ import com.bumptech.glide.request.RequestOptions
* Image picker launchers
*/
inline fun <reified T : MediaPickerCore<*>> Activity.kauLaunchMediaPicker(requestCode: Int) {
- startActivityForResult<T>(requestCode, bundleBuilder = {
- if (MediaPickerActivityOverlayBase::class.java.isAssignableFrom(T::class.java))
- withSceneTransitionAnimation(this@kauLaunchMediaPicker)
- })
+ startActivityForResult<T>(
+ requestCode,
+ bundleBuilder = {
+ if (MediaPickerActivityOverlayBase::class.java.isAssignableFrom(T::class.java))
+ withSceneTransitionAnimation(this@kauLaunchMediaPicker)
+ }
+ )
}
/**
diff --git a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
index e65cab2..4b0e9d6 100644
--- a/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
+++ b/mediapicker/src/main/kotlin/ca/allanwang/kau/mediapicker/MediaPickerCore.kt
@@ -50,9 +50,9 @@ import com.mikepenz.fastadapter.adapters.ItemAdapter
import com.mikepenz.iconics.dsl.iconicsDrawable
import com.mikepenz.iconics.typeface.IIcon
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
+import kotlinx.coroutines.CancellationException
import java.io.File
import kotlin.math.min
-import kotlinx.coroutines.CancellationException
/**
* Created by Allan Wang on 2017-07-23.
@@ -324,11 +324,13 @@ abstract class MediaPickerCore<T : GenericItem>(
} else if (data != null) {
val clip = data.clipData
if (clip != null) {
- items.addAll((0 until clip.itemCount).map {
- clip.getItemAt(it).uri.apply {
- KL.v { "Media picker clip uri $path" }
+ items.addAll(
+ (0 until clip.itemCount).map {
+ clip.getItemAt(it).uri.apply {
+ KL.v { "Media picker clip uri $path" }
+ }
}
- })
+ )
}
}
if (items.isEmpty()) return KL.d { "Media picker empty intent" }
diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt
index fb360b9..b589800 100644
--- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt
+++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/KPrefViewTest.kt
@@ -28,9 +28,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import ca.allanwang.kau.sample.test.BaseTest
import dagger.hilt.android.testing.HiltAndroidTest
-import javax.inject.Inject
-import kotlin.test.assertFalse
-import kotlin.test.assertTrue
import org.hamcrest.BaseMatcher
import org.hamcrest.Description
import org.hamcrest.Matcher
@@ -41,6 +38,9 @@ import org.junit.Test
import org.junit.rules.RuleChain
import org.junit.rules.TestRule
import org.junit.runner.RunWith
+import javax.inject.Inject
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
/**
* Created by Allan Wang on 21/12/2018.
diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt
index 1cba88f..0c63897 100644
--- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt
+++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/BaseTest.kt
@@ -16,8 +16,8 @@
package ca.allanwang.kau.sample.test
import dagger.hilt.android.testing.HiltAndroidRule
-import kotlin.test.BeforeTest
import org.junit.Rule
+import kotlin.test.BeforeTest
abstract class BaseTest {
@Suppress("LeakingThis")
diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt
index 1615d2f..aef1060 100644
--- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt
+++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/test/TestModules.kt
@@ -26,7 +26,8 @@ import dagger.hilt.testing.TestInstallIn
@Module
@TestInstallIn(
components = [SingletonComponent::class],
- replaces = [PrefFactoryModule::class])
+ replaces = [PrefFactoryModule::class]
+)
object PrefFactoryTestModule {
@Provides
fun factory(): KPrefFactory = KPrefFactoryInMemory
diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml
index b205c51..aa94481 100644
--- a/sample/src/main/AndroidManifest.xml
+++ b/sample/src/main/AndroidManifest.xml
@@ -16,7 +16,7 @@
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
- android:label="@string/app_name"
+ android:exported="true"
android:theme="@style/AppTheme.NoActionBar.Transparent">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -59,7 +59,7 @@
</provider>
<meta-data
android:name="com.bugsnag.android.API_KEY"
- android:value="0a09e498a253b98237500fb5f948e5c6"/>
+ android:value="0a09e498a253b98237500fb5f948e5c6" />
</application>
</manifest> \ No newline at end of file
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
index 59f1c92..cb907c6 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AboutActivity.kt
@@ -36,9 +36,11 @@ class AboutActivity : AboutActivityBase(R.string::class.java) {
}
override fun postInflateMainPage(adapter: FastItemThemedAdapter<GenericItem>) {
- adapter.add(CardIItem {
- title = "About KAU"
- descRes = R.string.about_kau
- })
+ adapter.add(
+ CardIItem {
+ title = "About KAU"
+ descRes = R.string.about_kau
+ }
+ )
}
}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
index b166210..cb38f29 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt
@@ -59,7 +59,8 @@ class AdapterActivity : ElasticRecyclerActivity() {
titleRes = R.string.kau_text_copied
button = "Test"
buttonClick = { toast("HI") }
- })
+ }
+ )
)
setOutsideTapListener { finishAfterTransition() }
return true
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
index b3560c5..30fcc45 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AnimActivity.kt
@@ -46,17 +46,21 @@ class AnimActivity : KauBaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val adapter = SingleFastAdapter()
- setContentView(fullLinearRecycler(adapter).apply {
- setBackgroundColor(
- pref.bgColor.withAlpha(255)
- )
- })
+ setContentView(
+ fullLinearRecycler(adapter).apply {
+ setBackgroundColor(
+ pref.bgColor.withAlpha(255)
+ )
+ }
+ )
- adapter.add(listOf(
- PERMISSION_ACCESS_COARSE_LOCATION,
- PERMISSION_ACCESS_FINE_LOCATION,
- PERMISSION_CAMERA
- ).map { PermissionCheckboxModel(it).vh() })
+ adapter.add(
+ listOf(
+ PERMISSION_ACCESS_COARSE_LOCATION,
+ PERMISSION_ACCESS_FINE_LOCATION,
+ PERMISSION_CAMERA
+ ).map { PermissionCheckboxModel(it).vh() }
+ )
adapter.addEventHook(PermissionCheckboxViewBinding.clickHook())
kauSwipeOnCreate {
edgeFlag = SWIPE_EDGE_LEFT
@@ -69,8 +73,10 @@ class AnimActivity : KauBaseActivity() {
}
override fun onBackPressed() {
- startActivity<MainActivity>(bundleBuilder = {
- withSlideOut(this@AnimActivity)
- })
+ startActivity<MainActivity>(
+ bundleBuilder = {
+ withSlideOut(this@AnimActivity)
+ }
+ )
}
}
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 e6841c8..b47bc48 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt
@@ -574,10 +574,12 @@ class MainActivity : KPrefActivity() {
/**
* This is how the setup looks like with all the proper tags
*/
- checkbox(title = R.string.checkbox_1, getter = pref::check1, setter = { pref.check1 = it },
+ checkbox(
+ title = R.string.checkbox_1, getter = pref::check1, setter = { pref.check1 = it },
builder = {
descRes = R.string.desc
- })
+ }
+ )
/**
* Since we know the order, we may omit the tags
@@ -585,7 +587,8 @@ class MainActivity : KPrefActivity() {
checkbox(
R.string.checkbox_2,
pref::check2,
- { pref.check2 = it; reloadByTitle(R.string.checkbox_3) })
+ { pref.check2 = it; reloadByTitle(R.string.checkbox_3) }
+ )
/**
* Since the builder is the last argument and is a lambda, we may write the setup cleanly like so:
@@ -601,19 +604,25 @@ class MainActivity : KPrefActivity() {
allowCustom = true
}
- colorPicker(R.string.accent_color, pref::accentColor, {
- pref.accentColor = it
- reload()
- this@MainActivity.navigationBarColor = it
- toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
- }) {
+ colorPicker(
+ R.string.accent_color, pref::accentColor,
+ {
+ pref.accentColor = it
+ reload()
+ this@MainActivity.navigationBarColor = it
+ toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
+ }
+ ) {
descRes = R.string.color_no_custom
allowCustom = false
}
- colorPicker(R.string.background_color, pref::bgColor, {
- pref.bgColor = it; bgCanvas.ripple(it, duration = 500L)
- }) {
+ colorPicker(
+ R.string.background_color, pref::bgColor,
+ {
+ pref.bgColor = it; bgCanvas.ripple(it, duration = 500L)
+ }
+ ) {
iicon = GoogleMaterial.Icon.gmd_colorize
descRes = R.string.color_custom_alpha
allowCustomAlpha = true
@@ -663,9 +672,11 @@ class MainActivity : KPrefActivity() {
plainText(R.string.adapter_showcase) {
onClick = {
- startActivity<AdapterActivity>(bundleBuilder = {
- withSceneTransitionAnimation(this@MainActivity)
- })
+ startActivity<AdapterActivity>(
+ bundleBuilder = {
+ withSceneTransitionAnimation(this@MainActivity)
+ }
+ )
}
}
@@ -682,7 +693,8 @@ class MainActivity : KPrefActivity() {
checkbox(
R.string.checkbox_2,
pref::check2,
- { pref.check2 = it; reloadByTitle(R.string.checkbox_3) }) {
+ { pref.check2 = it; reloadByTitle(R.string.checkbox_3) }
+ ) {
titleFun = { R.string.checkbox_3 }
descRes = R.string.kau_lorem_ipsum
}
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
index 0e6b22f..ce45d85 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MediaPicker.kt
@@ -29,13 +29,16 @@ import java.io.File
/**
* Created by Allan Wang on 2017-07-23.
*/
-private fun actions(multiple: Boolean) = listOf(object : MediaActionCamera() {
+private fun actions(multiple: Boolean) = listOf(
+ object : MediaActionCamera() {
- override fun createFile(context: Context): File = createMediaFile("KAU", ".jpg")
+ override fun createFile(context: Context): File = createMediaFile("KAU", ".jpg")
- override fun createUri(context: Context, file: File): Uri =
- FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file)
-}, MediaActionGallery(multiple))
+ override fun createUri(context: Context, file: File): Uri =
+ FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".provider", file)
+ },
+ MediaActionGallery(multiple)
+)
class ImagePickerActivity : MediaPickerActivityBase(MediaType.IMAGE, actions(true))
diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
index 7bd2851..a9a67b6 100644
--- a/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
+++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/PermissionCheckbox.kt
@@ -39,7 +39,8 @@ import com.mikepenz.fastadapter.listeners.EventHook
* Created by Allan Wang on 2017-07-03.
*/
class PermissionCheckbox(val permission: String) : KauIItem<PermissionCheckbox.ViewHolder>(
- R.layout.permission_checkbox, { ViewHolder(it) }) {
+ R.layout.permission_checkbox, { ViewHolder(it) }
+) {
override fun bindView(holder: ViewHolder, payloads: List<Any>) {
super.bindView(holder, payloads)
diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml
index 18b8f31..38d8180 100644
--- a/sample/src/main/res/xml/kau_changelog.xml
+++ b/sample/src/main/res/xml/kau_changelog.xml
@@ -6,6 +6,12 @@
<item text="" />
-->
+ <version title="v6.4.0" />
+ <item text="Add support for Bumblebee 2021.1.1" />
+ <item text="Remove Koin" />
+ <item text="Many version bumps" />
+ <item text="" />
+
<version title="v6.3.0" />
<item text="Add support for Arctic Fox 2020.3.1" />
<item text="Move to new maven release system" />
diff --git a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
index 12f835b..ca388a7 100644
--- a/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
+++ b/searchview/src/main/kotlin/ca/allanwang/kau/searchview/SearchView.kt
@@ -179,14 +179,14 @@ class SearchView @JvmOverloads constructor(
* This event is only triggered when [key] is not blank (like in [noResultsFound]
*/
var onItemClick: (position: Int, key: String, content: String, searchView: SearchView) -> Unit =
- { _, _, _, _ -> }
+ { _, _, _, _ -> }
/**
* Long click event for suggestion items
* This event is only triggered when [key] is not blank (like in [noResultsFound]
*/
var onItemLongClick: (position: Int, key: String, content: String, searchView: SearchView) -> Unit =
- { _, _, _, _ -> }
+ { _, _, _, _ -> }
/**
* If a [SearchItem]'s title contains the submitted query, make that portion bold
@@ -239,7 +239,7 @@ class SearchView @JvmOverloads constructor(
else value
if (configs.highlightQueryText && value.isNotEmpty()) list.forEach {
it.withHighlights(
- binding.kauSearchEditText.text?.toString()
+ binding.kauSearchEditText.text?.toString()
)
}
cardTransition()
@@ -259,7 +259,7 @@ class SearchView @JvmOverloads constructor(
// views
private var textCallback: Debouncer2<String, SearchView> =
- debounce(0) { query, _ -> KL.d { "Search query $query found; set your own textCallback" } }
+ debounce(0) { query, _ -> KL.d { "Search query $query found; set your own textCallback" } }
private val adapter = FastItemAdapter<SearchItem>()
private var menuItem: MenuItem? = null
val isOpen: Boolean
@@ -290,7 +290,7 @@ class SearchView @JvmOverloads constructor(
private fun KauSearchViewBinding.init() {
kauSearchNav.setSearchIcon(configs.navIcon).setOnClickListener { revealClose() }
kauSearchClear.setSearchIcon(configs.clearIcon)
- .setOnClickListener { kauSearchEditText.text?.clear() }
+ .setOnClickListener { kauSearchEditText.text?.clear() }
tintForeground(configs.foregroundColor)
tintBackground(configs.backgroundColor)
with(kauSearchRecycler) {
@@ -312,19 +312,19 @@ class SearchView @JvmOverloads constructor(
}
onClickListener = { _, _, item, position ->
if (item.key.isNotBlank()) configs.onItemClick(
- position,
- item.key,
- item.content,
- this@SearchView
+ position,
+ item.key,
+ item.content,
+ this@SearchView
); true
}
onLongClickListener = { _, _, item, position ->
if (item.key.isNotBlank()) {
configs.onItemLongClick(
- position,
- item.key,
- item.content,
- this@SearchView
+ position,
+ item.key,
+ item.content,
+ this@SearchView
)
}
true
@@ -365,13 +365,15 @@ class SearchView @JvmOverloads constructor(
}
internal fun cardTransition(builder: TransitionSet.() -> Unit = {}) {
- TransitionManager.beginDelayedTransition(binding.kauSearchCardview,
- // we are only using change bounds, as the recyclerview items may be animated as well,
- // which causes a measure IllegalStateException
- TransitionSet().addTransition(ChangeBounds()).apply {
- duration = configs.transitionDuration
- builder()
- })
+ TransitionManager.beginDelayedTransition(
+ binding.kauSearchCardview,
+ // we are only using change bounds, as the recyclerview items may be animated as well,
+ // which causes a measure IllegalStateException
+ TransitionSet().addTransition(ChangeBounds()).apply {
+ duration = configs.transitionDuration
+ builder()
+ }
+ )
}
/**
@@ -395,7 +397,7 @@ class SearchView @JvmOverloads constructor(
): SearchView {
config(config)
val menuItem = menu.findItem(id)
- ?: throw IllegalArgumentException("Menu item with given id doesn't exist")
+ ?: throw IllegalArgumentException("Menu item with given id doesn't exist")
if (menuItem.icon == null) {
menuItem.icon = GoogleMaterial.Icon.gmd_search.toDrawable(context, 18, menuIconColor)
}
@@ -430,12 +432,12 @@ class SearchView @JvmOverloads constructor(
menuY = (locations[1] + menuHalfHeight)
kauSearchCardview.viewTreeObserver.addOnPreDrawListener(object :
ViewTreeObserver.OnPreDrawListener {
- override fun onPreDraw(): Boolean {
- view.viewTreeObserver.removeOnPreDrawListener(this)
- kauSearchCardview.setMarginTop(menuY - kauSearchCardview.height / 2)
- return true
- }
- })
+ override fun onPreDraw(): Boolean {
+ view.viewTreeObserver.removeOnPreDrawListener(this)
+ kauSearchCardview.setMarginTop(menuY - kauSearchCardview.height / 2)
+ return true
+ }
+ })
}
/**
@@ -489,9 +491,9 @@ class SearchView @JvmOverloads constructor(
kauSearchShadow.fadeIn()
kauSearchEditText.showKeyboard()
kauSearchCardview.circularReveal(
- menuX,
- menuHalfHeight,
- duration = configs.revealDuration
+ menuX,
+ menuHalfHeight,
+ duration = configs.revealDuration
) {
cardTransition()
kauSearchRecycler.visible()
@@ -510,15 +512,17 @@ class SearchView @JvmOverloads constructor(
kauSearchShadow.fadeOut(duration = configs.transitionDuration)
cardTransition {
addEndListener {
- kauSearchCardview.circularHide(menuX,
- menuHalfHeight,
- duration = configs.revealDuration,
- onFinish = {
- configs.closeListener?.invoke(this@SearchView)
- if (configs.shouldClearOnClose) {
- kauSearchEditText.text?.clear()
- }
- })
+ kauSearchCardview.circularHide(
+ menuX,
+ menuHalfHeight,
+ duration = configs.revealDuration,
+ onFinish = {
+ configs.closeListener?.invoke(this@SearchView)
+ if (configs.shouldClearOnClose) {
+ kauSearchEditText.text?.clear()
+ }
+ }
+ )
}
}
kauSearchRecycler.gone()
@@ -542,7 +546,7 @@ fun Activity.bindSearchView(
@ColorInt menuIconColor: Int = Color.WHITE,
config: Configs.() -> Unit = {}
): SearchView =
- findViewById<ViewGroup>(android.R.id.content).bindSearchView(menu, id, menuIconColor, config)
+ findViewById<ViewGroup>(android.R.id.content).bindSearchView(menu, id, menuIconColor, config)
/**
* Bind searchView to a menu item; call this in [Activity.onCreateOptionsMenu]
@@ -558,10 +562,10 @@ fun ViewGroup.bindSearchView(
): SearchView {
val searchView = SearchView(context)
searchView.layoutParams =
- FrameLayout.LayoutParams(
- FrameLayout.LayoutParams.MATCH_PARENT,
- FrameLayout.LayoutParams.MATCH_PARENT
- )
+ FrameLayout.LayoutParams(
+ FrameLayout.LayoutParams.MATCH_PARENT,
+ FrameLayout.LayoutParams.MATCH_PARENT
+ )
addView(searchView)
searchView.bind(menu, id, menuIconColor, config)
return searchView
diff --git a/spotless.gradle b/spotless.gradle
index ea95c38..6ff39f3 100644
--- a/spotless.gradle
+++ b/spotless.gradle
@@ -3,7 +3,7 @@ apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target "**/*.kt"
- ktlint().userData(["disabled_rules": "no-wildcard-imports"])
+ ktlint(kau.Versions.ktlint).userData(["disabled_rules": "no-wildcard-imports"])
licenseHeaderFile '../spotless.license.kt'
trimTrailingWhitespace()
endWithNewline()