diff --git a/CHANGELOG.md b/CHANGELOG.md index e3d97a08..d60c74f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ # ChangeLog +## Version 1.5.3 + +* Update: Kotlin modules dependency to v1.6.10. +* Update: Kotlin coroutines modules dependency to v1.6.0. +* Update: Material components dependency to v1.5.0. +* Update: Minor update of other libraries. +* Add: Version catalogs. + + ## Version 1.5.2 * Update: `BottomNavigationView` extensions replaced by `NavigationBarView` extensions. diff --git a/README.md b/README.md index 6f91f6a6..506e492c 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ [![Corbind](logo.svg)](https://ldralighieri.github.io/Corbind) [![Maven Central](https://img.shields.io/maven-central/v/ru.ldralighieri.corbind/corbind.svg)](https://search.maven.org/search?q=g:ru.ldralighieri.corbind) -[![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.5.20-blue.svg)](https://kotlinlang.org) -[![Kotlin Coroutines Version](https://img.shields.io/badge/Coroutines-v1.5.0-blue.svg)](https://kotlinlang.org/docs/reference/coroutines-overview.html) +[![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.6.10-blue.svg)](https://kotlinlang.org) +[![Kotlin Coroutines Version](https://img.shields.io/badge/Coroutines-v1.6.0-blue.svg)](https://kotlinlang.org/docs/reference/coroutines-overview.html) [![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a1c9a1b1d1ce4ca7a201ab93492bf6e0)](https://www.codacy.com/app/LDRAlighieri/Corbind?utm_source=github.com&utm_medium=referral&utm_content=LDRAlighieri/Corbind&utm_campaign=Badge_Grade) @@ -25,28 +25,28 @@ This library is for Android applications only. Help you to transform Android UI Platform bindings: ```groovy -implementation 'ru.ldralighieri.corbind:corbind:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind:1.5.3' ``` AndroidX library bindings: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-activity:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-core:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-leanback:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-lifecycle:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-navigation:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.5.2' -implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-activity:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-core:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-leanback:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-lifecycle:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-navigation:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.5.3' +implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.5.3' ``` Google 'material' library bindings: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-material:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-material:1.5.3' ``` Snapshot build: @@ -56,12 +56,13 @@ repositories { } dependencies { - implementation 'ru.ldralighieri.corbind:{module}:1.5.3-SNAPSHOT' + implementation 'ru.ldralighieri.corbind:{module}:1.5.4-SNAPSHOT' } ``` ## List of extensions + You can find a list of extensions in the description of each module: [corbind] [corbind-activity] @@ -86,6 +87,7 @@ If you need to get a text change events of EditText widget, simple use case with findViewById(R.id.et_name) .textChanges() // Flow .onEach { /* handle text change events */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` @@ -122,6 +124,7 @@ combine( transform = { email, password -> email && password } ) .onEach { bt_login.isEnabled = it } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` @@ -141,7 +144,7 @@ If I forgot something or you have any ideas what can be added or corrected, plea ## License ``` -Copyright 2019-2021 Vladimir Raupov +Copyright 2019-2022 Vladimir Raupov Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/build.gradle b/build.gradle index d8033eb7..6c16d039 100644 --- a/build.gradle +++ b/build.gradle @@ -14,117 +14,51 @@ * limitations under the License. */ -buildscript { - - ext { - versions = [ - 'kotlin': '1.5.20', - 'kotlin_coroutines': '1.5.0', - 'android_gradle': '4.2.2', - 'androidx': [ - 'core': '1.6.0', - 'annotation': '1.2.0', - 'appcompat': '1.3.0', - 'drawerlayout': '1.1.1', - 'leanback': '1.0.0', - 'navigation': '2.3.5', - 'recyclerview': '1.2.1', - 'slidingpanelayout': '1.1.0', - 'swiperefreshlayout': '1.1.0', - 'viewpager': '1.0.0', - 'viewpager2': '1.0.0', - 'lifecycle': '2.3.1', - 'activity': '1.2.3' - ], - 'material': '1.4.0', - 'ktlint': '0.40.0', - 'dokka': '0.10.1' - ] - - deps = [ - 'kotlin': [ - 'stdlib': [ - 'jdk6': "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}", - 'jdk8': "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}" - ], - 'coroutines': [ - 'core': "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.kotlin_coroutines}", - 'jdk8': "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${versions.kotlin_coroutines}", - 'android': "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_coroutines}" - ] - ], - 'androidx': [ - 'core': "androidx.core:core:${versions.androidx.core}", - 'annotation': "androidx.annotation:annotation:${versions.androidx.annotation}", - 'appcompat': "androidx.appcompat:appcompat:${versions.androidx.appcompat}", - 'drawerlayout': "androidx.drawerlayout:drawerlayout:${versions.androidx.drawerlayout}", - 'leanback': "androidx.leanback:leanback:${versions.androidx.leanback}", - 'navigation': "androidx.navigation:navigation-runtime:${versions.androidx.navigation}", - 'recyclerview': "androidx.recyclerview:recyclerview:${versions.androidx.recyclerview}", - 'slidingpanelayout': "androidx.slidingpanelayout:slidingpanelayout:${versions.androidx.slidingpanelayout}", - 'swiperefreshlayout': "androidx.swiperefreshlayout:swiperefreshlayout:${versions.androidx.swiperefreshlayout}", - 'viewpager': "androidx.viewpager:viewpager:${versions.androidx.viewpager}", - 'viewpager2': "androidx.viewpager2:viewpager2:${versions.androidx.viewpager2}", - 'lifecycle': "androidx.lifecycle:lifecycle-runtime-ktx:${versions.androidx.lifecycle}", - 'activity': "androidx.activity:activity:${versions.androidx.activity}" - ], - 'material': "com.google.android.material:material:${versions.material}" - ] - - buildConfig = [ - 'compileSdk': 30, - 'minSdk': 14, - 'targetSdk': 30 - ] - } +import io.gitlab.arturbosch.detekt.Detekt +import org.jetbrains.dokka.gradle.DokkaTask +buildscript { repositories { + gradlePluginPortal() mavenCentral() google() - maven { url "https://plugins.gradle.org/m2/" } } dependencies { - // Android gradle - classpath "com.android.tools.build:gradle:${versions.android_gradle}" - - // Kotlin - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" - - // Dokka - classpath "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}" + classpath(libs.bundles.plugins) } - } plugins { - id "com.diffplug.spotless" version "5.14.0" - id 'com.github.ben-manes.versions' version '0.39.0' - id "io.gitlab.arturbosch.detekt" version "1.17.1" + alias(libs.plugins.spotless) + alias(libs.plugins.gver) + alias(libs.plugins.detekt) + alias(libs.plugins.dokka) } allprojects { - repositories { mavenCentral() google() } - - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - jvmTarget = "1.8" - } - } - } subprojects { + tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11 - group = GROUP - version = VERSION_NAME + // Treat all Kotlin warnings as errors + allWarningsAsErrors = true + + // Enable experimental coroutines APIs + freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ObsoleteCoroutinesApi" + freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" + } + } apply plugin: 'com.diffplug.spotless' spotless { @@ -133,33 +67,55 @@ subprojects { targetExclude("$buildDir/**/*.kt") targetExclude('bin/**/*.kt') - ktlint(versions.ktlint) + ktlint(libs.versions.ktlint.get()) licenseHeaderFile rootProject.file('spotless/copyright.kt') } } - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { - kotlinOptions { - // Treat all Kotlin warnings as errors - allWarningsAsErrors = true - - // Enable experimental coroutines APIs - freeCompilerArgs += "-Xuse-experimental=kotlinx.coroutines.ObsoleteCoroutinesApi" - freeCompilerArgs += "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi" + apply plugin: 'org.jetbrains.dokka' + tasks.withType(DokkaTask).configureEach { + dokkaSourceSets { + named("main") { + jdkVersion.set(JavaVersion.VERSION_11.majorVersion.toInteger()) + skipDeprecated.set(false) + reportUndocumented.set(false) + skipEmptyPackages.set(true) + + sourceLink { + def relPath = rootProject.projectDir.toPath().relativize(projectDir.toPath()) + localDirectory.set(new File("src/main/kotlin")) + remoteUrl.set(new URL("https://github.com/LDRAlighieri/Corbind/tree/master/$relPath/src/main/kotlin")) + remoteLineSuffix.set("#L") + } + + externalDocumentationLink { + url.set(new URL("https://developer.android.com/reference/")) + packageListUrl.set(new URL("https://developer.android.com/reference/package-list")) + } + + externalDocumentationLink { + url.set(new URL("https://developer.android.com/reference/")) + packageListUrl.set(new URL("https://developer.android.com/reference/androidx/package-list")) + } + + externalDocumentationLink { + url.set(new URL("https://developer.android.com/reference/")) + packageListUrl.set(new URL("https://developer.android.com/reference/com/google/android/material/package-list")) + } + } } } - } detekt { - toolVersion = "1.16.0" + toolVersion = libs.versions.detekt.get() - failFast = false + allRules = false buildUponDefaultConfig = true config = files("default-detekt-config.yml") - input = files( + source = files( "corbind/src/main/kotlin", "corbind-activity/src/main/kotlin", "corbind-appcompat/src/main/kotlin", @@ -176,11 +132,15 @@ detekt { "corbind-viewpager2/src/main/kotlin" ) parallel = true +} +tasks.withType(Detekt).configureEach { + jvmTarget = JavaVersion.VERSION_11 reports { - html.enabled = true - xml.enabled = false - txt.enabled = false + html.required.set(true) + xml.required.set(false) + txt.required.set(false) + sarif.required.set(false) } } @@ -191,7 +151,7 @@ configurations.all { // Force all Kotlin stdlib artifacts to use the same version. if (details.requested.group == 'org.jetbrains.kotlin' && details.requested.name.startsWith('kotlin-stdlib')) { - details.useVersion versions.kotlin + details.useVersion libs.versions.kotlin.get() } } } diff --git a/corbind-activity/README.md b/corbind-activity/README.md index 6a14d25a..1806e1dd 100644 --- a/corbind-activity/README.md +++ b/corbind-activity/README.md @@ -4,7 +4,7 @@ To add androidx activity bindings, import `corbind-activity` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-activity:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-activity:1.5.3' ``` ## List of extensions @@ -19,6 +19,7 @@ Component | Extension | Description ```kotlin requireActivity().onBackPressedDispatcher.backPresses() .onEach { /* handle onBackPressed event */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-activity/build.gradle b/corbind-activity/build.gradle index 99235867..ee3ee2bc 100644 --- a/corbind-activity/build.gradle +++ b/corbind-activity/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.activity + api libs.androidx.activity } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackPresses.kt b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackPresses.kt index 75b1ec66..a5ce56f9 100644 --- a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackPresses.kt +++ b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackPresses.kt @@ -104,6 +104,7 @@ fun OnBackPressedDispatcher.backPresses( * ``` * requireActivity().onBackPressedDispatcher.backPresses() * .onEach { /* handle onBackPressed event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind-appcompat/README.md b/corbind-appcompat/README.md index 5da1672d..bcf23873 100644 --- a/corbind-appcompat/README.md +++ b/corbind-appcompat/README.md @@ -4,7 +4,7 @@ To add androidx appcompat bindings, import `corbind-appcompat` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-appcompat:1.5.3' ``` ## List of extensions @@ -25,6 +25,7 @@ Component | Extension | Description ```kotlin toolbar.itemClicks() // Flow .onEach { /* handle menu item clicks events */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-appcompat/build.gradle b/corbind-appcompat/build.gradle index 22032dbd..ae9c332f 100644 --- a/corbind-appcompat/build.gradle +++ b/corbind-appcompat/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.appcompat + api libs.androidx.appcompat } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ActionMenuViewItemClicks.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ActionMenuViewItemClicks.kt index b7e178e0..183ac883 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ActionMenuViewItemClicks.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ActionMenuViewItemClicks.kt @@ -108,6 +108,7 @@ fun ActionMenuView.itemClicks( * ``` * actionMenuView.itemClicks() * .onEach { /* handle menu item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuDismisses.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuDismisses.kt index bac7190f..2eec1649 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuDismisses.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuDismisses.kt @@ -107,6 +107,7 @@ fun PopupMenu.dismisses( * ``` * popupMenu.dismisses() * .onEach { /* handle popup menu dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuItemClicks.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuItemClicks.kt index 44bfccfb..dc31cbe8 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuItemClicks.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/PopupMenuItemClicks.kt @@ -108,6 +108,7 @@ fun PopupMenu.itemClicks( * ``` * popupMenu.itemClicks() * .onEach { /* handle menu item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChangeEvents.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChangeEvents.kt index 4bf4b410..19f88a20 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChangeEvents.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChangeEvents.kt @@ -122,13 +122,15 @@ fun SearchView.queryTextChangeEvents( * // handle initial value * searchView.queryTextChangeEvents() * .onEach { /* handle query text event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * searchView.queryTextChangeEvents() * .dropInitialValue() * .onEach { /* handle query text event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChanges.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChanges.kt index bbe9286a..b828d989 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChanges.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/SearchViewQueryTextChanges.kt @@ -116,13 +116,15 @@ fun SearchView.queryTextChanges( * // handle initial value * searchView.queryTextChanges() * .onEach { /* handle query text change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * searchView.queryTextChanges() * .dropInitialValue() * .onEach { /* handle query text change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarItemClicks.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarItemClicks.kt index 41d4f92d..7f031156 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarItemClicks.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarItemClicks.kt @@ -108,6 +108,7 @@ fun Toolbar.itemClicks( * ``` * toolbar.itemClicks() * .onEach { /* handle menu item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarNavigationClicks.kt b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarNavigationClicks.kt index d40003a3..7863ce58 100644 --- a/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarNavigationClicks.kt +++ b/corbind-appcompat/src/main/kotlin/ru/ldralighieri/corbind/appcompat/ToolbarNavigationClicks.kt @@ -108,6 +108,7 @@ fun Toolbar.navigationClicks( * ``` * toolbar.navigationClicks() * .onEach { /* handle navigation click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-core/README.md b/corbind-core/README.md index f9bd886d..e3ccb6e6 100644 --- a/corbind-core/README.md +++ b/corbind-core/README.md @@ -4,7 +4,7 @@ To add androidx core bindings, import `corbind-core` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-core:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-core:1.5.3' ``` ## List of extensions @@ -19,6 +19,7 @@ Component | Extension | Description ```kotlin scrollView.scrollChangeEvents() // Flow .onEach { /* handle scroll change events */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-core/build.gradle b/corbind-core/build.gradle index 73a5a782..c4bcc9ee 100644 --- a/corbind-core/build.gradle +++ b/corbind-core/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.core + api libs.androidx.core } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-core/src/main/kotlin/ru/ldralighieri/corbind/core/NestedScrollViewScrollChangeEvents.kt b/corbind-core/src/main/kotlin/ru/ldralighieri/corbind/core/NestedScrollViewScrollChangeEvents.kt index 5098b2c9..3e82536f 100644 --- a/corbind-core/src/main/kotlin/ru/ldralighieri/corbind/core/NestedScrollViewScrollChangeEvents.kt +++ b/corbind-core/src/main/kotlin/ru/ldralighieri/corbind/core/NestedScrollViewScrollChangeEvents.kt @@ -110,6 +110,7 @@ fun NestedScrollView.scrollChangeEvents( * ``` * nestedScrollView.scrollChangeEvents() * .onEach { /* handle scroll change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-drawerlayout/README.md b/corbind-drawerlayout/README.md index 0e6a9dbd..e5ec246e 100644 --- a/corbind-drawerlayout/README.md +++ b/corbind-drawerlayout/README.md @@ -4,7 +4,7 @@ To add androidx drawerlayout bindings, import `corbind-drawerlayout` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-drawerlayout:1.5.3' ``` ## List of extensions @@ -21,6 +21,7 @@ drawer.drawerOpens() // Flow .onEach { isOpen -> tv_message = "Drawer completely ${ if (isOpen) "open" else "close"}" } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-drawerlayout/build.gradle b/corbind-drawerlayout/build.gradle index ce235a30..aac6da54 100644 --- a/corbind-drawerlayout/build.gradle +++ b/corbind-drawerlayout/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.drawerlayout + api libs.androidx.drawerlayout } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-drawerlayout/src/main/kotlin/ru/ldralighieri/corbind/drawerlayout/DrawerLayoutDrawerOpen.kt b/corbind-drawerlayout/src/main/kotlin/ru/ldralighieri/corbind/drawerlayout/DrawerLayoutDrawerOpen.kt index 1d621d38..6643ca08 100644 --- a/corbind-drawerlayout/src/main/kotlin/ru/ldralighieri/corbind/drawerlayout/DrawerLayoutDrawerOpen.kt +++ b/corbind-drawerlayout/src/main/kotlin/ru/ldralighieri/corbind/drawerlayout/DrawerLayoutDrawerOpen.kt @@ -112,13 +112,15 @@ fun DrawerLayout.drawerOpens( * // handle initial value * drawerLayout.drawerOpens() * .onEach { /* handle open state */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * adapter.dataChanges() * .dropInitialValue() * .onEach { /* handle open state */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * * @param gravity Gravity of the drawer to check diff --git a/corbind-leanback/README.md b/corbind-leanback/README.md index 72a6bc79..c47fc406 100644 --- a/corbind-leanback/README.md +++ b/corbind-leanback/README.md @@ -4,7 +4,7 @@ To add androidx leanback bindings, import `corbind-leanback` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-leanback:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-leanback:1.5.3' ``` ## List of extensions @@ -22,6 +22,7 @@ Component | Extension | Description search.searchQueryChanges() // Flow .map { it.toLowerCase(Locale.getDefault()) } .onEach { query -> filter.updateItems(query) } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-leanback/build.gradle b/corbind-leanback/build.gradle index dc793be8..d915571e 100644 --- a/corbind-leanback/build.gradle +++ b/corbind-leanback/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.leanback + api libs.androidx.leanback } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChangeEvents.kt b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChangeEvents.kt index 9232ecaa..da4c6080 100644 --- a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChangeEvents.kt +++ b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChangeEvents.kt @@ -153,12 +153,14 @@ fun SearchBar.searchQueryChangeEvents( * is SearchBarSearchQuerySubmittedEvent -> { /* handle query submit event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * searchBar.searchQueryChangeEvents() * .filterIsInstance() * .onEach { /* handle query change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx */ @CheckResult diff --git a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChanges.kt b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChanges.kt index 65674b57..f4f6381d 100644 --- a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChanges.kt +++ b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchBarSearchQueryChanges.kt @@ -108,6 +108,7 @@ fun SearchBar.searchQueryChanges( * ``` * searchBar.searchQueryChanges() * .onEach { /* handle query change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchEditTextKeyboardDismisses.kt b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchEditTextKeyboardDismisses.kt index be8a37f7..89643b0e 100644 --- a/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchEditTextKeyboardDismisses.kt +++ b/corbind-leanback/src/main/kotlin/ru/ldralighieri/corbind/leanback/SearchEditTextKeyboardDismisses.kt @@ -108,6 +108,7 @@ fun SearchEditText.keyboardDismisses( * ``` * searchEditText.keyboardDismisses() * .onEach { /* handle keyboard dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-lifecycle/README.md b/corbind-lifecycle/README.md index c9301123..8078e7e9 100644 --- a/corbind-lifecycle/README.md +++ b/corbind-lifecycle/README.md @@ -4,7 +4,7 @@ To add androidx lifecycle bindings, import `corbind-lifecycle` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-lifecycle:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-lifecycle:1.5.3' ``` ## List of extensions @@ -20,6 +20,7 @@ Component | Extension | Description lifecycle.events() .filter { it == Lifecycle.Event.ON_RESUME } .onEach { /* handle lifecycle onResume event */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-lifecycle/build.gradle b/corbind-lifecycle/build.gradle index 4526755a..bd23934f 100644 --- a/corbind-lifecycle/build.gradle +++ b/corbind-lifecycle/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.lifecycle + api libs.androidx.lifecycle.runtime.ktx } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-lifecycle/src/main/kotlin/ru/ldralighieri/corbind/lifecycle/LifecycleEvents.kt b/corbind-lifecycle/src/main/kotlin/ru/ldralighieri/corbind/lifecycle/LifecycleEvents.kt index 57b3d567..7f113380 100644 --- a/corbind-lifecycle/src/main/kotlin/ru/ldralighieri/corbind/lifecycle/LifecycleEvents.kt +++ b/corbind-lifecycle/src/main/kotlin/ru/ldralighieri/corbind/lifecycle/LifecycleEvents.kt @@ -97,6 +97,7 @@ fun Lifecycle.events( * ``` * lifecycle.events() * .onEach { /* handle lifecycle event change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/README.md b/corbind-material/README.md index d85d9a7b..71ad28df 100644 --- a/corbind-material/README.md +++ b/corbind-material/README.md @@ -4,7 +4,7 @@ To add material bindings, import `corbind-material` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-material:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-material:1.5.3' ``` ## List of extensions @@ -58,6 +58,7 @@ chipGroup.checkedChanges() // Flow tv_message = if (it != View.NO_ID) "Chip #$it selected" else "No one сhip selected" } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-material/build.gradle b/corbind-material/build.gradle index 96bef12d..daea1ec3 100644 --- a/corbind-material/build.gradle +++ b/corbind-material/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.material + api libs.material } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/AppBarLayoutOffsetChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/AppBarLayoutOffsetChanges.kt index 433e92db..0dae7e31 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/AppBarLayoutOffsetChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/AppBarLayoutOffsetChanges.kt @@ -97,6 +97,7 @@ fun AppBarLayout.offsetChanges( * ``` * appBarLayout.offsetChanges() * .onEach { /* handle offset change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorSlides.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorSlides.kt index 9069e2a7..7ad7465a 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorSlides.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorSlides.kt @@ -102,6 +102,7 @@ fun View.slides( * ``` * bottomSheetBehavior.slides() * .onEach { /* handle slide offset */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorStateChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorStateChanges.kt index bd957127..101484da 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorStateChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/BottomSheetBehaviorStateChanges.kt @@ -110,13 +110,15 @@ fun View.stateChanges( * // handle initial value * bottomSheetBehavior.stateChanges() * .onEach { /* handle state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * bottomSheetBehavior.stateChanges() * .dropInitialValue() * .onEach { /* handle state change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ fun View.stateChanges(): InitialValueFlow = channelFlow { diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipCloseIconClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipCloseIconClicks.kt index d2cef30a..1ee5f37e 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipCloseIconClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipCloseIconClicks.kt @@ -108,6 +108,7 @@ fun Chip.closeIconClicks( * ``` * chip.closeIconClicks() * .onEach { /* handle close icon click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipGroupCheckedChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipGroupCheckedChanges.kt index c591ce89..518c2e1a 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipGroupCheckedChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/ChipGroupCheckedChanges.kt @@ -122,13 +122,15 @@ fun ChipGroup.checkedChanges( * // handle initial value * chipGroup.checkedChanges() * .onEach { /* handle checked view */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * chipGroup.checkedChanges() * .dropInitialValue() * .onEach { /* handle checked view */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonCheckedChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonCheckedChanges.kt index d911a3b0..b05e7c4a 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonCheckedChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonCheckedChanges.kt @@ -115,13 +115,15 @@ fun MaterialButton.checkedChanges( * // handle initial value * materialButton.checkedChanges() * .onEach { /* handle check state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * materialButton.checkedChanges() * .dropInitialValue() * .onEach { /* handle check state change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChangeEvents.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChangeEvents.kt index 20fdf652..a99aa4b6 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChangeEvents.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChangeEvents.kt @@ -118,6 +118,7 @@ fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( * ``` * materialButtonToggleGroup.buttonCheckedChangeEvents() * .onEach { /* handle check change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChanges.kt index a41ffee3..6bec7022 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialButtonToggleGroupCheckedChanges.kt @@ -126,13 +126,15 @@ fun MaterialButtonToggleGroup.buttonCheckedChanges( * // handle initial value * materialButtonToggleGroup.buttonCheckedChanges() * .onEach { /* handle check change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * materialButtonToggleGroup.buttonCheckedChanges() * .dropInitialValue() * .onEach { /* handle check change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialCardViewCheckedChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialCardViewCheckedChanges.kt index cf9e678e..2cf1f2a0 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialCardViewCheckedChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialCardViewCheckedChanges.kt @@ -115,13 +115,15 @@ fun MaterialCardView.checkedChanges( * // handle initial value * materialCardView.checkedChanges() * .onEach { /* handle check change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * materialCardView.checkedChanges() * .dropInitialValue() * .onEach { /* handle check change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerCancels.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerCancels.kt index e6670e48..2b587c05 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerCancels.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerCancels.kt @@ -114,6 +114,7 @@ fun MaterialDatePicker.cancels( * ``` * materialDatePicker.cancels() * .onEach { /* handle cancel event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerDismisses.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerDismisses.kt index b940eef0..be647579 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerDismisses.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerDismisses.kt @@ -101,6 +101,7 @@ fun MaterialDatePicker.dismisses( * ``` * materialDatePicker.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerNegativeClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerNegativeClicks.kt index 69d86e2d..c50e90d7 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerNegativeClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerNegativeClicks.kt @@ -98,6 +98,7 @@ fun MaterialDatePicker.negativeClicks( * ``` * materialDatePicker.negativeClicks() * .onEach { /* handle negative button click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerPositiveClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerPositiveClicks.kt index d5f6e2ab..0f139d43 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerPositiveClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialDatePickerPositiveClicks.kt @@ -98,6 +98,7 @@ fun MaterialDatePicker.positiveClicks( * ``` * materialDatePicker.positiveClicks() * .onEach { /* handle positive button click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerCancels.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerCancels.kt index a4f6699c..5d155a38 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerCancels.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerCancels.kt @@ -114,6 +114,7 @@ fun MaterialTimePicker.cancels( * ``` * materialTimePicker.cancels() * .onEach { /* handle cancel event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerDismisses.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerDismisses.kt index d63beced..4e51e61e 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerDismisses.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerDismisses.kt @@ -101,6 +101,7 @@ fun MaterialTimePicker.dismisses( * ``` * materialTimePicker.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerNegativeClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerNegativeClicks.kt index 609c03f5..c9d4ecb2 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerNegativeClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerNegativeClicks.kt @@ -98,6 +98,7 @@ fun MaterialTimePicker.negativeClicks( * ``` * materialTimePicker.negativeClicks() * .onEach { /* handle negative button click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerPositiveClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerPositiveClicks.kt index dc7bddce..0b959eed 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerPositiveClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaterialTimePickerPositiveClicks.kt @@ -98,6 +98,7 @@ fun MaterialTimePicker.positiveClicks( * ``` * materialTimePicker.positiveClicks() * .onEach { /* handle positive button click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemReselections.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemReselections.kt index 6a623e1a..141e1b10 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemReselections.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemReselections.kt @@ -18,9 +18,7 @@ package ru.ldralighieri.corbind.material import android.view.MenuItem import androidx.annotation.CheckResult -import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.navigation.NavigationBarView -import com.google.android.material.navigationrail.NavigationRailView import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.Channel @@ -110,6 +108,7 @@ fun NavigationBarView.itemReselections( * ``` * anyNavigationBarView.itemReselections() * .onEach { /* handle reselected item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemSelections.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemSelections.kt index 811283eb..ea4d3d5c 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemSelections.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationBarViewItemSelections.kt @@ -18,7 +18,6 @@ package ru.ldralighieri.corbind.material import android.view.MenuItem import androidx.annotation.CheckResult -import com.google.android.material.bottomnavigation.BottomNavigationView import com.google.android.material.navigation.NavigationBarView import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -116,13 +115,15 @@ fun NavigationBarView.itemSelections( * // handle initial value * anyNavigationBarView.itemSelections() * .onEach { /* handle selected item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * anyNavigationBarView.itemSelections() * .drop(1) * .onEach { /* handle selected item */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationViewItemSelections.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationViewItemSelections.kt index c0d5bb3e..42c93e87 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationViewItemSelections.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/NavigationViewItemSelections.kt @@ -115,12 +115,14 @@ fun NavigationView.itemSelections( * // handle initial value * navigationView.itemSelections() * .onEach { /* handle selected item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * navigationView.itemSelections() * .drop(1) * .onEach { /* handle selected item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderTouches.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderTouches.kt index b7b6d293..b71a8acc 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderTouches.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderTouches.kt @@ -97,6 +97,7 @@ fun RangeSlider.touches( * ``` * rangeSlider.touches() * .onEach { /* handle touch tracking event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChangeEvents.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChangeEvents.kt index ddbeac35..5e73288b 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChangeEvents.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChangeEvents.kt @@ -116,13 +116,15 @@ fun RangeSlider.valuesChangeEvents( * // handle initial values * rangeSlider.valuesChangeEvents() * .onEach { /* handle values change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial values * rangeSlider.valuesChangeEvents() * .dropInitialValue() * .onEach { /* handle values change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChanges.kt index 372a5140..ec8b49dd 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/RangeSliderValuesChanges.kt @@ -105,13 +105,15 @@ fun RangeSlider.valuesChanges( * // handle initial values * slider.valuesChanges() * .onEach { /* handle values change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial values * slider.valuesChanges() * .dropInitialValue() * .onEach { /* handle values change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderTouches.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderTouches.kt index bd212a97..3eed2a62 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderTouches.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderTouches.kt @@ -97,6 +97,7 @@ fun Slider.touches( * ``` * slider.touches() * .onEach { /* handle touch tracking event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChangeEvents.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChangeEvents.kt index db985796..f2475b58 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChangeEvents.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChangeEvents.kt @@ -113,13 +113,15 @@ fun Slider.valueChangeEvents( * // handle initial value * slider.valueChangeEvents() * .onEach { /* handle value change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * slider.valueChangeEvents() * .dropInitialValue() * .onEach { /* handle value change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChanges.kt index d6682184..dc0c3924 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SliderValueChanges.kt @@ -105,13 +105,15 @@ fun Slider.valueChanges( * // handle initial value * slider.valueChanges() * .onEach { /* handle value change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * slider.valueChanges() * .dropInitialValue() * .onEach { /* handle value change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarDismisses.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarDismisses.kt index f3ad6a35..40a29cc8 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarDismisses.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarDismisses.kt @@ -97,6 +97,7 @@ fun Snackbar.dismisses( * ``` * snackbar.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarShown.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarShown.kt index b0afc2c2..492db915 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarShown.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SnackbarShown.kt @@ -97,6 +97,7 @@ fun Snackbar.shown( * ``` * snackbar.shown() * .onEach { /* handle show */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDesmisses.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDesmisses.kt index a57d49da..00639d97 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDesmisses.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDesmisses.kt @@ -110,6 +110,7 @@ fun View.dismisses( * ``` * swipeDismissBehavior.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDragStateChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDragStateChanges.kt index 1115f21b..4eee045c 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDragStateChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SwipeDismissBehaviorDragStateChanges.kt @@ -109,6 +109,7 @@ fun View.dragStateChanges( * ``` * swipeDismissBehavior.dragStateChanges() * .onEach { /* handle drag state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelectionEvents.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelectionEvents.kt index 95dee4f5..b24c6de1 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelectionEvents.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelectionEvents.kt @@ -148,18 +148,21 @@ fun TabLayout.selectionEvents( * is TabLayoutSelectionUnselectedEvent -> { /* handle unselect event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * tabLayout.selectionEvents() * .filterIsInstance() * .onEach { /* handle select event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * tabLayout.selectionEvents() * .drop(1) * .onEach { /* handle event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelections.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelections.kt index d113bf3c..9e98073e 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelections.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TabLayoutSelections.kt @@ -104,12 +104,14 @@ fun TabLayout.selections( * // handle initial value * tabLayout.selections() * .onEach { /* handle selected tab */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * tabLayout.selections() * .drop(1) * .onEach { /* handle selected tab */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconChanges.kt index d599c794..245ea401 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconChanges.kt @@ -103,6 +103,7 @@ fun TextInputLayout.endIconChanges( * ``` * textInputLayout.endIconChanges() * .onEach { /* handle end icon mode change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconClicks.kt index 0729d542..b9838852 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconClicks.kt @@ -108,6 +108,7 @@ fun TextInputLayout.endIconClicks( * ``` * textInputLayout.endIconClicks() * .onEach { /* handle end icon click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconLongClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconLongClicks.kt index fcb26069..bf017ae0 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconLongClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutEndIconLongClicks.kt @@ -118,6 +118,7 @@ fun TextInputLayout.endIconLongClicks( * ``` * textInputLayout.endIconLongClicks() * .onEach { /* handle end icon long click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconClicks.kt index 59433b60..f3df80a2 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconClicks.kt @@ -108,6 +108,7 @@ fun TextInputLayout.startIconClicks( * ``` * textInputLayout.startIconClicks() * .onEach { /* handle start icon click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconLongClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconLongClicks.kt index 52b00926..739f1643 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconLongClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/TextInputLayoutStartIconLongClicks.kt @@ -118,6 +118,7 @@ fun TextInputLayout.startIconLongClicks( * ``` * textInputLayout.startIconLongClicks() * .onEach { /* handle start icon long click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind-navigation/README.md b/corbind-navigation/README.md index ccbed574..fb1deb8d 100644 --- a/corbind-navigation/README.md +++ b/corbind-navigation/README.md @@ -4,7 +4,7 @@ To add androidx navigation bindings, import `corbind-navigation` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-navigation:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-navigation:1.5.3' ``` ## List of extensions @@ -24,6 +24,7 @@ navController.destinationChanges() // Flow hideSoftInput() } } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-navigation/build.gradle b/corbind-navigation/build.gradle index 7b9ec1a3..d024cfca 100644 --- a/corbind-navigation/build.gradle +++ b/corbind-navigation/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.navigation + api libs.androidx.navigation } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChangeEvents.kt b/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChangeEvents.kt index 251d507c..944223c4 100644 --- a/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChangeEvents.kt +++ b/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChangeEvents.kt @@ -110,6 +110,7 @@ fun NavController.destinationChangeEvents( * ``` * navController.destinationChangeEvents() * .onEach { /* handle destination change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChanges.kt b/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChanges.kt index 934e825f..f06bfc25 100644 --- a/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChanges.kt +++ b/corbind-navigation/src/main/kotlin/ru/ldralighieri/corbind/navigation/NavControllerOnDestinationChanges.kt @@ -98,6 +98,7 @@ fun NavController.destinationChanges( * ``` * navController.destinationChanges() * .onEach { /* handle destination change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-recyclerview/README.md b/corbind-recyclerview/README.md index fcade37a..abf6ef00 100644 --- a/corbind-recyclerview/README.md +++ b/corbind-recyclerview/README.md @@ -4,7 +4,7 @@ To add androidx recyclerview bindings, import `corbind-recyclerview` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-recyclerview:1.5.3' ``` ## List of extensions @@ -23,6 +23,7 @@ Component | Extension | Description ```kotlin rv.scrollStateChanges() // Flow .onEach { /* handle RecyclerView scroll state change events */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-recyclerview/build.gradle b/corbind-recyclerview/build.gradle index 36793630..e5cd3a88 100644 --- a/corbind-recyclerview/build.gradle +++ b/corbind-recyclerview/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.recyclerview + api libs.androidx.recyclerview } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerAdapterDataChanges.kt b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerAdapterDataChanges.kt index 89959c87..08b60a8d 100644 --- a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerAdapterDataChanges.kt +++ b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerAdapterDataChanges.kt @@ -105,13 +105,15 @@ fun > T.dataChanges( * // handle initial value * adapter.dataChanges() * .onEach { /* handle data change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * adapter.dataChanges() * .dropInitialValue() * .onEach { /* handle data change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewChildAttachStateChangeEvents.kt b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewChildAttachStateChangeEvents.kt index aed38a15..7553007a 100644 --- a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewChildAttachStateChangeEvents.kt +++ b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewChildAttachStateChangeEvents.kt @@ -139,12 +139,14 @@ fun RecyclerView.childAttachStateChangeEvents( * is RecyclerViewChildDetachEvent -> { /* handle child detach event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * recyclerView.childAttachStateChangeEvents() * .filterIsInstance() * .onEach { /* handle child attach event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewFlingEvents.kt b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewFlingEvents.kt index dd99fdb8..008c4be6 100644 --- a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewFlingEvents.kt +++ b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewFlingEvents.kt @@ -114,6 +114,7 @@ fun RecyclerView.flingEvents( * ``` * recyclerView.flingEvents() * .onEach { /* handle fling event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollEvents.kt b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollEvents.kt index 237458da..8fb6895a 100644 --- a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollEvents.kt +++ b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollEvents.kt @@ -104,6 +104,7 @@ fun RecyclerView.scrollEvents( * ``` * recyclerView.scrollEvents() * .onEach { /* handle scroll event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollStateChanges.kt b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollStateChanges.kt index af9295af..42d86b22 100644 --- a/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollStateChanges.kt +++ b/corbind-recyclerview/src/main/kotlin/ru/ldralighieri/corbind/recyclerview/RecyclerViewScrollStateChanges.kt @@ -97,6 +97,7 @@ fun RecyclerView.scrollStateChanges( * ``` * recyclerView.scrollStateChanges() * .onEach { /* handle scroll state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-slidingpanelayout/README.md b/corbind-slidingpanelayout/README.md index 8619df05..67bffd48 100644 --- a/corbind-slidingpanelayout/README.md +++ b/corbind-slidingpanelayout/README.md @@ -4,7 +4,7 @@ To add androidx slidingpanelayout bindings, import `corbind-slidingpanelayout` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-slidingpanelayout:1.5.3' ``` ## List of extensions @@ -22,6 +22,7 @@ slider.panelOpens() // Flow .onEach { isOpen -> tv_message = "Panel completely ${ if (isOpen) "open" else "close"}" } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-slidingpanelayout/build.gradle b/corbind-slidingpanelayout/build.gradle index 36043c7f..2f36920c 100644 --- a/corbind-slidingpanelayout/build.gradle +++ b/corbind-slidingpanelayout/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.slidingpanelayout + api libs.androidx.slidingpanelayout } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutPaneOpens.kt b/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutPaneOpens.kt index 9a93d9a3..5585ba0c 100644 --- a/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutPaneOpens.kt +++ b/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutPaneOpens.kt @@ -117,13 +117,15 @@ fun SlidingPaneLayout.panelOpens( * // handle initial value * slidingPaneLayout.panelOpens() * .onEach { /* handle open state */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * slidingPaneLayout.panelOpens() * .dropInitialValue() * .onEach { /* handle open state */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutSlides.kt b/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutSlides.kt index 0571b693..b2075725 100644 --- a/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutSlides.kt +++ b/corbind-slidingpanelayout/src/main/kotlin/ru/ldralighieri/corbind/slidingpanelayout/SlidingPaneLayoutSlides.kt @@ -109,6 +109,7 @@ fun SlidingPaneLayout.panelSlides( * ``` * slidingPaneLayout.panelSlides() * .onEach { /* handle slide offset */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-swiperefreshlayout/README.md b/corbind-swiperefreshlayout/README.md index cbbb4dcb..27561436 100644 --- a/corbind-swiperefreshlayout/README.md +++ b/corbind-swiperefreshlayout/README.md @@ -4,7 +4,7 @@ To add androidx swiperefreshlayout bindings, import `corbind-swiperefreshlayout` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.5.3' ``` ## List of extensions @@ -19,6 +19,7 @@ Component | Extension | Description ```kotlin swipe.refreshes() // Flow .onEach { /* handle refresh events */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-swiperefreshlayout/build.gradle b/corbind-swiperefreshlayout/build.gradle index 28260910..10f54d0a 100644 --- a/corbind-swiperefreshlayout/build.gradle +++ b/corbind-swiperefreshlayout/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.swiperefreshlayout + api libs.androidx.swiperefreshlayout } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-swiperefreshlayout/src/main/kotlin/ru/ldralighieri/corbind/swiperefreshlayout/SwipeRefreshLayoutRefreshes.kt b/corbind-swiperefreshlayout/src/main/kotlin/ru/ldralighieri/corbind/swiperefreshlayout/SwipeRefreshLayoutRefreshes.kt index 167c97a3..d3e06294 100644 --- a/corbind-swiperefreshlayout/src/main/kotlin/ru/ldralighieri/corbind/swiperefreshlayout/SwipeRefreshLayoutRefreshes.kt +++ b/corbind-swiperefreshlayout/src/main/kotlin/ru/ldralighieri/corbind/swiperefreshlayout/SwipeRefreshLayoutRefreshes.kt @@ -107,6 +107,7 @@ fun SwipeRefreshLayout.refreshes( * ``` * swipeRefreshLayout.refreshes() * .onEach { /* handle refresh */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-viewpager/README.md b/corbind-viewpager/README.md index fa908c09..d6c6ec04 100644 --- a/corbind-viewpager/README.md +++ b/corbind-viewpager/README.md @@ -4,7 +4,7 @@ To add androidx viewpager bindings, import `corbind-viewpager` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-viewpager:1.5.3' ``` ## List of extensions @@ -21,6 +21,7 @@ Component | Extension | Description ```kotlin vp_slides.pageSelections() // Flow .onEach { tv_message = "Page #$it selected" } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-viewpager/build.gradle b/corbind-viewpager/build.gradle index 8f9ff581..c95549d0 100644 --- a/corbind-viewpager/build.gradle +++ b/corbind-viewpager/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.viewpager + api libs.androidx.viewpager } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollEvents.kt b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollEvents.kt index 401c0113..e9eb368f 100644 --- a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollEvents.kt +++ b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollEvents.kt @@ -105,6 +105,7 @@ fun ViewPager.pageScrollEvents( * ``` * viewPager.pageScrollEvents() * .onEach { /* handle page scroll event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollStateChanges.kt b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollStateChanges.kt index 74045fac..308f54a2 100644 --- a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollStateChanges.kt +++ b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageScrollStateChanges.kt @@ -97,6 +97,7 @@ fun ViewPager.pageScrollStateChanges( * ``` * viewPager.pageScrollStateChanges() * .onEach { /* handle scroll state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageSelections.kt b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageSelections.kt index cd704514..bca80757 100644 --- a/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageSelections.kt +++ b/corbind-viewpager/src/main/kotlin/ru/ldralighieri/corbind/viewpager/ViewPagerPageSelections.kt @@ -106,13 +106,15 @@ fun ViewPager.pageSelections( * // handle initial value * viewPager.pageSelections() * .onEach { /* handle selected page */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * viewPager.pageSelections() * .dropInitialValue() * .onEach { /* handle selected page */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind-viewpager2/README.md b/corbind-viewpager2/README.md index d9dd4a83..047121ee 100644 --- a/corbind-viewpager2/README.md +++ b/corbind-viewpager2/README.md @@ -4,7 +4,7 @@ To add androidx viewpager2 bindings, import `corbind-viewpager2` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind-viewpager2:1.5.3' ``` ## List of extensions @@ -21,6 +21,7 @@ Component | Extension | Description ```kotlin vp_slides.pageSelections() // Flow .onEach { tv_message = "Page #$it selected" } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind-viewpager2/build.gradle b/corbind-viewpager2/build.gradle index c87f4a15..ae42763d 100644 --- a/corbind-viewpager2/build.gradle +++ b/corbind-viewpager2/build.gradle @@ -17,19 +17,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,17 +38,9 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { api project(':corbind') - - api deps.androidx.viewpager2 + api libs.androidx.viewpager2 } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollEvents.kt b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollEvents.kt index f7d2cacc..bb93abe4 100644 --- a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollEvents.kt +++ b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollEvents.kt @@ -105,6 +105,7 @@ fun ViewPager2.pageScrollEvents( * ``` * viewPager2.pageScrollEvents() * .onEach { /* handle page scroll event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollStateChanges.kt b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollStateChanges.kt index 061f81ee..f0985843 100644 --- a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollStateChanges.kt +++ b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageScrollStateChanges.kt @@ -97,6 +97,7 @@ fun ViewPager2.pageScrollStateChanges( * ``` * viewPager2.pageScrollStateChanges() * .onEach { /* handle scroll state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageSelections.kt b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageSelections.kt index 644a8450..f727b628 100644 --- a/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageSelections.kt +++ b/corbind-viewpager2/src/main/kotlin/ru/ldralighieri/corbind/viewpager2/ViewPager2PageSelections.kt @@ -105,13 +105,15 @@ fun ViewPager2.pageSelections( * // handle initial value * viewPager2.pageSelections() * .onEach { /* handle selected page */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * viewPager2.pageSelections() * .dropInitialValue() * .onEach { /* handle selected page */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/README.md b/corbind/README.md index 82af0c62..e3d21a9f 100644 --- a/corbind/README.md +++ b/corbind/README.md @@ -4,7 +4,7 @@ To add platform bindings, import `corbind` module: ```groovy -implementation 'ru.ldralighieri.corbind:corbind:1.5.2' +implementation 'ru.ldralighieri.corbind:corbind:1.5.3' ``` ## List of extensions @@ -99,6 +99,7 @@ combine( transform = { email, password -> email && password } ) .onEach { bt_login.isEnabled = it } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` @@ -113,6 +114,7 @@ flowOf( ) .flattenMerge() .onEach { /* handle an authorization event */} + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` @@ -123,6 +125,7 @@ context IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED) ) .onEach { /* handle nfc adapter state changed */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` @@ -138,6 +141,7 @@ window.decorView.windowInsetsApplyEvents() insets.isVisible(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()) } .onEach { /* handle status bars or navigation bars visibility */ } + .flowWithLifecycle(lifecycle) .launchIn(lifecycleScope) // lifecycle-runtime-ktx ``` diff --git a/corbind/build.gradle b/corbind/build.gradle index 33edbf5a..a604fa9d 100644 --- a/corbind/build.gradle +++ b/corbind/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.dokka.gradle.DokkaTask + /* * Copyright 2019 Vladimir Raupov * @@ -17,19 +19,19 @@ plugins { id 'com.android.library' id 'kotlin-android' + id 'com.vanniktech.maven.publish' } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { - minSdkVersion buildConfig.minSdk + minSdkVersion (findProperty("android.minSdk") as Integer) testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -38,20 +40,11 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - } dependencies { - api deps.kotlin.stdlib.jdk8 - api deps.kotlin.coroutines.core - api deps.kotlin.coroutines.android - - api deps.androidx.annotation + api libs.kotlin.stdlib + api libs.kotlin.coroutines.android + api libs.androidx.annotation } - -apply from: rootProject.file('gradle/gradle-mvn-push.gradle') diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt index 2123300d..1c886cae 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt @@ -122,6 +122,7 @@ fun DatePickerDialog.dateSetEvents( * ``` * datePickerDialog.dateSetEvents() * .onEach { /* handle date set event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt index 48ae3775..3244f83e 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt @@ -114,6 +114,7 @@ fun Context.receivesBroadcast( * IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED) * ) * .onEach { /* handle nfc adapter state changed */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt index 34bd1e19..fb5166d0 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt @@ -149,12 +149,14 @@ fun MenuItem.actionViewEvents( * is MenuItemActionViewExpandEvent -> { /* handle expand event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * menuItem.actionViewEvents() * .filterIsInstance() * .onEach { /* handle collapse event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt index 4dcdf310..aa58e6ab 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt @@ -117,6 +117,7 @@ fun MenuItem.clicks( * ``` * menuItem.clicks() * .onEach { /* handle click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt index 498a2b78..9d0eee12 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt @@ -129,12 +129,14 @@ fun View.attachEvents( * is ViewAttachDetachedEvent -> { /* handle detach event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * view.attachEvents() * .filterIsInstance() * .onEach { /* handle attach event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt index ee9ef039..2de0c9e8 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt @@ -97,6 +97,7 @@ fun View.attaches( * ``` * view.attaches() * .onEach { /* handle attach */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @@ -174,6 +175,7 @@ fun View.detaches( * ``` * view.detaches() * .onEach { /* handle detach */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt index 98fd9a51..4c7f2a98 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt @@ -106,6 +106,7 @@ fun View.clicks( * ``` * view.clicks() * .onEach { /* handle click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt index c2bec2a0..477bedf2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt @@ -115,6 +115,7 @@ fun View.drags( * ``` * view.drags() * .onEach { /* handle drag */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt index 4bb3a984..9799f499 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt @@ -115,13 +115,15 @@ fun View.focusChanges( * // handle initial value * view.focusChanges() * .onEach { /* handle focus change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * view.focusChanges() * .dropInitialValue() * .onEach { /* handle focus change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt index 2f996d48..3471cbcf 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt @@ -143,12 +143,14 @@ fun ViewGroup.changeEvents( * is ViewGroupHierarchyChildViewRemoveEvent -> { /* handle remove event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * viewGroup.changeEvents() * .filterIsInstance() * .onEach { /* handle add event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt index 2e1aebd3..62ebe540 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt @@ -117,6 +117,7 @@ fun View.hovers( * ``` * view.hovers() * .onEach { /* handle hover */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt index 1244ca21..bd91fdfb 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt @@ -115,6 +115,7 @@ fun View.keys( * ``` * view.keys() * .onEach { /* handle key */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt index 40c3985e..628561d5 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt @@ -110,6 +110,7 @@ fun View.layoutChangeEvents( * ``` * view.layoutChangeEvents() * .onEach { /* handle layout change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt index 70a7cfa8..d438f8bf 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt @@ -95,6 +95,7 @@ fun View.layoutChanges( * ``` * view.layoutChanges() * .onEach { /* handle layout change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt index 369fc15d..688ee372 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt @@ -117,6 +117,7 @@ fun View.longClicks( * ``` * view.longClicks() * .onEach { /* handle long click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt index c154ee6e..6faea98f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt @@ -121,6 +121,7 @@ fun View.scrollChangeEvents( * ``` * view.scrollChangeEvents() * .onEach { /* handle scroll change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt index 6e6d91f5..a3a9174e 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt @@ -143,6 +143,7 @@ fun View.systemUiVisibilityChanges( * ``` * view.systemUiVisibilityChanges() * .onEach { /* handle system UI visibility */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt index 12ad365a..f48eaa41 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt @@ -118,6 +118,7 @@ fun View.touches( * ``` * view.touches() * .onEach { /* handle touch */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt index 405f9f0b..84fc4f62 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt @@ -103,6 +103,7 @@ fun View.draws( * ``` * view.draws() * .onEach { /* handle draw */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt index 2b2a8a9e..e69b1ed3 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt @@ -104,6 +104,7 @@ fun View.globalLayouts( * ``` * view.globalLayouts() * .onEach { /* handle global layout */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt index d13740bd..1671b39b 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt @@ -104,6 +104,7 @@ fun View.preDraws( * ``` * view.preDraws() * .onEach { /* handle pre-draws */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt index d54b6e6b..97ede402 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt @@ -107,6 +107,7 @@ fun View.windowInsetsApplyEvents( * ``` * decorView.windowInsetsApplyEvents() * .onEach { /* handle window insets event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * @@ -121,7 +122,8 @@ fun View.windowInsetsApplyEvents( * insets.isVisible(WindowInsets.Type.statusBars() or WindowInsets.Type.navigationBars()) * } * .onEach { /* handle status bars or navigation bars visibility */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @RequiresApi(Build.VERSION_CODES.KITKAT_WATCH) diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt index b0f76593..818118f9 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt @@ -116,6 +116,7 @@ fun AbsListView.scrollEvents( * ``` * absListView.scrollEvents() * .onEach { /* handle list scroll event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt index f612a14c..083f1e58 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt @@ -106,12 +106,14 @@ fun T.dataChanges( * // handle initial value * adapter.dataChanges() * .onEach { /* handle data change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * adapter.dataChanges() * .dropInitialValue() * .onEach { /* handle data change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt index f32b101f..cafbd0e5 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt @@ -117,6 +117,7 @@ fun AdapterView.itemClickEvents( * ``` * adapterView.itemClickEvents() * .onEach { /* handle item click event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt index 7b374e14..f2ddc805 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt @@ -109,6 +109,7 @@ fun AdapterView.itemClicks( * ``` * adapterView.itemClicks() * .onEach { /* handle item click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt index 03bdb8b6..3468d405 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt @@ -128,6 +128,7 @@ fun AdapterView.itemLongClickEvents( * ``` * adapterView.itemLongClickEvents() * .onEach { /* handle item long click event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt index 7d3a9ed3..dcd60573 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt @@ -119,6 +119,7 @@ fun AdapterView.itemLongClicks( * ``` * adapterView.itemLongClicks() * .onEach { /* handle item long click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt index 7129e099..01f21415 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt @@ -119,13 +119,15 @@ fun AdapterView.itemSelections( * // handle initial value * adapterView.itemSelections() * .onEach { /* handle selected position */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * adapterView.itemSelections() * .dropInitialValue() * .onEach { /* handle selected position */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt index 78882568..6f99fdec 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt @@ -151,19 +151,22 @@ fun AdapterView.selectionEvents( * is AdapterViewNothingSelectionEvent -> { /* handle nothing selection event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * adapterView.selectionEvents() * .filterIsInstance() * .onEach { /* handle item selection event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * adapterView.selectionEvents() * .dropInitialValue() * .onEach { /* handle selection event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt index ed73f99e..c91c1f49 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt @@ -112,6 +112,7 @@ fun AutoCompleteTextView.dismisses( * ``` * autoCompleteTextView.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt index feb2e1e4..dba35ea2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt @@ -110,6 +110,7 @@ fun AutoCompleteTextView.itemClickEvents( * ``` * autoCompleteTextView.itemClickEvents() * .onEach { /* handle item click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt index 37294afd..b21f5ee0 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt @@ -125,13 +125,15 @@ fun CalendarView.dateChangeEvents( * // handle initial value * calendarView.dateChangeEvents() * .onEach { /* handle date change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * calendarView.dateChangeEvents() * .dropInitialValue() * .onEach { /* handle date change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt index 0ed4a1f5..8e8af51d 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt @@ -115,13 +115,15 @@ fun CompoundButton.checkedChanges( * // handle initial value * compoundButton.checkedChanges() * .onEach { /* handle checked change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * compoundButton.checkedChanges() * .dropInitialValue() * .onEach { /* handle checked change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt index fc17183c..90c39342 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt @@ -128,13 +128,15 @@ fun DatePicker.dateChangeEvents( * // handle initial value * datePicker.dateChangeEvents() * .onEach { /* handle date changed event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * datePicker.dateChangeEvents() * .dropInitialValue() * .onEach { /* handle date changed event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @RequiresApi(Build.VERSION_CODES.O) diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt index 001f8fd5..f1524b34 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt @@ -107,6 +107,7 @@ fun NumberPicker.scrollStateChanges( * ``` * numberPicker.scrollStateChanges() * .onEach { /* handle scroll state change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt index fc6237b0..6ffe1d75 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt @@ -124,13 +124,15 @@ fun NumberPicker.valueChangeEvents( * // handle initial value * numberPicker.valueChangeEvents() * .onEach { /* handle value change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * numberPicker.valueChangeEvents() * .dropInitialValue() * .onEach { /* handle value change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt index 779fa4fb..0ef37aa4 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt @@ -107,6 +107,7 @@ fun PopupMenu.dismisses( * ``` * popupMenu.dismisses() * .onEach { /* handle dismiss */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt index ed871d62..63c98041 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt @@ -108,6 +108,7 @@ fun PopupMenu.itemClicks( * ``` * popupMenu.itemClicks() * .onEach { /* handle item click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt index d4817006..0faa015f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt @@ -118,13 +118,15 @@ fun RadioGroup.checkedChanges( * // handle initial value * radioGroup.checkedChanges() * .onEach { /* handle checked change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * radioGroup.checkedChanges() * .dropInitialValue() * .onEach { /* handle checked change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt index 9a759819..08a5bf0b 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt @@ -122,13 +122,15 @@ fun RatingBar.ratingChangeEvents( * // handle initial value * ratingBar.ratingChangeEvents() * .onEach { /* handle rating change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * ratingBar.ratingChangeEvents() * .dropInitialValue() * .onEach { /* handle rating change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt index 7c00e76f..9e99bc2f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt @@ -115,13 +115,15 @@ fun RatingBar.ratingChanges( * // handle initial value * ratingBar.ratingChanges() * .onEach { /* handle rating change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * ratingBar.ratingChanges() * .dropInitialValue() * .onEach { /* handle rating change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt index 509af4d3..fc0a5cd0 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt @@ -122,13 +122,15 @@ fun SearchView.queryTextChangeEvents( * // handle initial value * searchView.queryTextChangeEvents() * .onEach { /* handle query text change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * searchView.queryTextChangeEvents() * .dropInitialValue() * .onEach { /* handle query text change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt index c0f8a4d1..7a07e692 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt @@ -116,13 +116,15 @@ fun SearchView.queryTextChanges( * // handle initial value * searchView.queryTextChanges() * .onEach { /* handle query text change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * searchView.queryTextChanges() * .dropInitialValue() * .onEach { /* handle query text change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt index 78f8331f..759cb908 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt @@ -154,19 +154,22 @@ fun SeekBar.changeEvents( * is SeekBarStopChangeEvent -> { /* handle stop change event */ } * } * } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // handle one event * seekBar.changeEvents() * .filterIsInstance() * .onEach { /* handle progress change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop one event * seekBar.changeEvents() * .dropInitialValue() * .onEach { /* handle event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt index 6ee1d6a7..8d60c753 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt @@ -141,13 +141,15 @@ fun SeekBar.changes( * // handle initial value * seekBar.changes() * .onEach { /* handle progress value change */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * seekBar.changes() * .dropInitialValue() * .onEach { /* handle progress value change */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult @@ -224,13 +226,15 @@ fun SeekBar.userChanges( * // handle initial value * seekBar.userChanges() * .onEach { /* handle progress value change made from user */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * seekBar.userChanges() * .dropInitialValue() * .onEach { /* handle progress value change made from user */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult @@ -307,13 +311,15 @@ fun SeekBar.systemChanges( * // handle initial value * seekBar.systemChanges() * .onEach { /* handle progress value change made from system */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * seekBar.systemChanges() * .dropInitialValue() * .onEach { /* handle progress value change made from system */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt index c67b8e94..27282997 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt @@ -113,13 +113,15 @@ fun TextView.afterTextChangeEvents( * // handle initial value * textView.afterTextChangeEvents() * .onEach { /* handle after text change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * textView.afterTextChangeEvents() * .dropInitialValue() * .onEach { /* handle after text change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt index 646e4140..91421908 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt @@ -114,13 +114,15 @@ fun TextView.beforeTextChangeEvents( * // handle initial value * textView.beforeTextChangeEvents() * .onEach { /* handle before text change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * textView.beforeTextChangeEvents() * .dropInitialValue() * .onEach { /* handle before text change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt index 0cfc5ea6..eb9a7896 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt @@ -125,6 +125,7 @@ fun TextView.editorActionEvents( * ``` * textView.editorActionEvents() * .onEach { /* handle editor action event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt index 22b3cf7b..c2d274f2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt @@ -117,6 +117,7 @@ fun TextView.editorActions( * ``` * textView.editorActions() * .onEach { /* handle action */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` * diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt index 91159dec..b7ee106f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt @@ -116,13 +116,15 @@ fun TextView.textChangeEvents( * // handle initial value * textView.textChangeEvents() * .onEach { /* handle text change event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * textView.textChangeEvents() * .dropInitialValue() * .onEach { /* handle text change event */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt index 669dc847..c45905be 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt @@ -108,13 +108,15 @@ fun TextView.textChanges( * // handle initial value * textView.textChanges() * .onEach { /* handle text changes */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * textView.textChanges() * .dropInitialValue() * .onEach { /* handle text changes */ } - * .launchIn(lifecycleScope) + * .flowWithLifecycle(lifecycle) + * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ @CheckResult diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt index 7f3fe6d5..300194aa 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt @@ -127,12 +127,14 @@ fun TimePicker.timeChangeEvents( * // handle initial value * timePicker.timeChangeEvents() * .onEach { /* handle time changed event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * * // drop initial value * timePicker.timeChangeEvents() * .dropInitialValue() * .onEach { /* handle time changed event */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt index ce653218..e67047e2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt @@ -113,6 +113,7 @@ fun Toolbar.itemClicks( * ``` * toolbar.itemClicks() * .onEach { /* handle clicked item */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt index e7b38eb9..f5fc78aa 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt @@ -113,6 +113,7 @@ fun Toolbar.navigationClicks( * ``` * toolbar.navigationClicks() * .onEach { /* handle navigation click */ } + * .flowWithLifecycle(lifecycle) * .launchIn(lifecycleScope) // lifecycle-runtime-ktx * ``` */ diff --git a/gradle.properties b/gradle.properties index 05393cf6..b5f53448 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,13 @@ # AndroidX android.useAndroidX=true +android.compileSdk=31 +android.targetSdk=31 +android.minSdk=14 # Maven GROUP=ru.ldralighieri.corbind -VERSION_NAME=1.5.2 +VERSION_NAME=1.5.3 POM_DESCRIPTION=Kotlin Coroutines binding APIs for Android UI widgets from the platform and support libraries. @@ -19,3 +22,4 @@ POM_LICENCE_DIST=repo POM_DEVELOPER_ID=ldralighieri POM_DEVELOPER_NAME=Vladimir Raupov +POM_DEVELOPER_URL=https://github.com/LDRAlighieri/ diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle deleted file mode 100644 index 220185fa..00000000 --- a/gradle/gradle-mvn-push.gradle +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2013 Chris Banes - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -apply plugin: 'maven' -apply plugin: 'signing' - -def isReleaseBuild() { - return !VERSION_NAME.contains("SNAPSHOT") -} - -def getReleaseRepositoryUrl() { - return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL - : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" -} - -def getSnapshotRepositoryUrl() { - return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL - : "https://oss.sonatype.org/content/repositories/snapshots/" -} - -def getRepositoryUsername() { - return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : "" -} - -afterEvaluate { project -> - uploadArchives { - repositories { - mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - pom.groupId = GROUP - pom.artifactId = POM_ARTIFACT_ID - pom.version = VERSION_NAME - - repository(url: getReleaseRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - snapshotRepository(url: getSnapshotRepositoryUrl()) { - authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) - } - - pom.project { - name POM_NAME - packaging POM_PACKAGING - description POM_DESCRIPTION - url POM_URL - - scm { - url POM_SCM_URL - connection POM_SCM_CONNECTION - developerConnection POM_SCM_DEV_CONNECTION - } - - licenses { - license { - name POM_LICENCE_NAME - url POM_LICENCE_URL - distribution POM_LICENCE_DIST - } - } - - developers { - developer { - id POM_DEVELOPER_ID - name POM_DEVELOPER_NAME - } - } - } - } - } - } - - signing { - required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } - sign configurations.archives - } - - task androidJavadocs(type: Javadoc) { - if (!project.plugins.hasPlugin('kotlin-android')) { - source = android.sourceSets.main.java.srcDirs - } - - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) - - exclude '**/internal/*' - include '**/*.java' - - options.links("http://docs.oracle.com/javase/7/docs/api/") - options.linksOffline "https://developer.android.com/reference", - "${project.android.sdkDirectory}/docs/reference" - - if (JavaVersion.current().isJava8Compatible()) { - options.addStringOption('Xdoclint:none', '-quiet') - } - - - def androidJavadocsJar = project.tasks.register("androidJavadocsJar", Jar.class) { - classifier = "javadoc" - } - - if (plugins.hasPlugin('kotlin-android')) { - def dokkaOutput = "${project.docsDir}/dokka" - - project.plugins.apply('org.jetbrains.dokka') - def path = new File(project.projectDir, "") - project.dokka { - outputFormat = "html" - outputDirectory = dokkaOutput - - configuration { - reportUndocumented = false - skipDeprecated = true - skipEmptyPackages = true - - sourceLink { - path = "src/main/kotlin" - url = "https://github.com/LDRAlighieri/Corbind/blob/master/" - lineSuffix = "#L" - } - - jdkVersion = 8 - - externalDocumentationLink { - url = new URL("https://developer.android.com/reference/") - packageListUrl = new URL("https://developer.android.com/reference/package-list") - } - - externalDocumentationLink { - url = new URL("https://developer.android.com/reference/") - packageListUrl = new URL("https://developer.android.com/reference/androidx/package-list") - } - - externalDocumentationLink { - url = new URL("https://developer.android.com/reference/") - packageListUrl = new URL("https://developer.android.com/reference/com/google/android/material/package-list") - } - - externalDocumentationLink { - url = new URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/") - packageListUrl = new URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/package-list") - } - - externalDocumentationLink { - url = new URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/") - packageListUrl = new URL("https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/package-list") - } - } - - } - - androidJavadocsJar.configure { - dependsOn "dokka" - from dokkaOutput - } - - } else { - androidJavadocsJar.configure { - dependsOn "javadoc" - from project.androidJavadocs.destinationDir - } - } - } - - task androidSourcesJar(type: Jar) { - archiveClassifier.set("sources") - from project.android.sourceSets.main.java.srcDirs - } - - artifacts { - archives androidSourcesJar - archives androidJavadocsJar - } -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..81fd3283 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,69 @@ +[versions] +spotless = "6.2.0" +gver = "0.41.0" +detekt = "1.19.0" +dokka = "1.6.10" +maven-publish = "0.18.0" + +plugin-android = "7.0.4" +plugin-kotlin = "1.6.10" + +ktlint = "0.43.2" +kotlin = "1.6.10" +kotlin-coroutines = "1.6.0" + +androidx-core = "1.7.0" +androidx-annotation = "1.3.0" +androidx-appcompat = "1.4.1" +androidx-drawerlayout = "1.1.1" +androidx-leanback = "1.0.0" +androidx-navigation = "2.3.5" +androidx-recyclerview = "1.2.1" +androidx-slidingpanelayout = "1.1.0" +androidx-swiperefreshlayout = "1.1.0" +androidx-viewpager = "1.0.0" +androidx-viewpager2 = "1.0.0" +androidx-lifecycle = "2.4.0" +androidx-activity = "1.4.0" + +material = "1.5.0" + + +[plugins] +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +gver = { id = "com.github.ben-manes.versions", version.ref = "gver" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } + + +[libraries] +plugin-android = { module = "com.android.tools.build:gradle", version.ref = "plugin-android" } +plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "plugin-kotlin" } +maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "maven-publish" } + +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlin-coroutines" } + +androidx-core = { module = "androidx.core:core", version.ref = "androidx-core" } +androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-drawerlayout = { module = "androidx.drawerlayout:drawerlayout", version.ref = "androidx-drawerlayout" } +androidx-leanback = { module = "androidx.leanback:leanback", version.ref = "androidx-leanback" } +androidx-navigation = { module = "androidx.navigation:navigation-runtime", version.ref = "androidx-navigation" } +androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "androidx-recyclerview" } +androidx-slidingpanelayout = { module = "androidx.slidingpanelayout:slidingpanelayout", version.ref = "androidx-slidingpanelayout" } +androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" } +androidx-viewpager = { module = "androidx.viewpager:viewpager", version.ref = "androidx-viewpager" } +androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "androidx-viewpager2" } +androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } +androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" } + +material = { module = "com.google.android.material:material", version.ref = "material" } + + +[bundles] +plugins = [ + "plugin-android", + "plugin-kotlin", + "maven-publish" +] diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f8cd40f0..6a0887c9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -18,4 +18,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip diff --git a/sample/build.gradle b/sample/build.gradle index cb61c4bc..b13e536a 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -20,14 +20,13 @@ plugins { } android { - - compileSdkVersion buildConfig.compileSdk + compileSdkVersion (findProperty("android.compileSdk") as Integer) defaultConfig { applicationId "ru.ldralighieri.corbind.example" - minSdkVersion buildConfig.minSdk - targetSdkVersion buildConfig.targetSdk + minSdkVersion (findProperty("android.minSdk") as Integer) + targetSdkVersion (findProperty("android.targetSdk") as Integer) versionCode 1 - versionName '1.0.0' + versionName findProperty("VERSION_NAME") vectorDrawables.useSupportLibrary = true @@ -54,13 +53,9 @@ android { } - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } packagingOptions { @@ -77,12 +72,11 @@ android { } dependencies { - implementation project(":corbind-swiperefreshlayout") - implementation deps.androidx.appcompat - implementation deps.androidx.lifecycle - implementation deps.material - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation libs.androidx.appcompat + implementation libs.androidx.lifecycle.runtime.ktx + implementation libs.material + implementation 'androidx.constraintlayout:constraintlayout:2.1.2' } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 78cda511..b0efd672 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -28,7 +28,9 @@ tools:ignore="GoogleAppIndexingWarning" android:fullBackupContent="false" > - + diff --git a/sample/src/main/kotlin/ru/ldralighieri/corbind/sample/LoginActivity.kt b/sample/src/main/kotlin/ru/ldralighieri/corbind/sample/LoginActivity.kt index 78030a3c..c88b9664 100644 --- a/sample/src/main/kotlin/ru/ldralighieri/corbind/sample/LoginActivity.kt +++ b/sample/src/main/kotlin/ru/ldralighieri/corbind/sample/LoginActivity.kt @@ -20,17 +20,20 @@ import android.annotation.SuppressLint import android.os.Build import android.os.Bundle import android.util.Patterns -import android.view.View import android.view.inputmethod.EditorInfo import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.WindowCompat +import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.launch import ru.ldralighieri.corbind.sample.core.extensions.hideSoftInput import ru.ldralighieri.corbind.sample.databinding.ActivityLoginBinding import ru.ldralighieri.corbind.swiperefreshlayout.refreshes @@ -45,14 +48,8 @@ class LoginActivity : AppCompatActivity() { @SuppressLint("InlinedApi") override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (Build.VERSION.SDK_INT in Build.VERSION_CODES.JELLY_BEAN until Build.VERSION_CODES.R) { - val view = window.decorView - @Suppress("DEPRECATION") - view.systemUiVisibility = view.systemUiVisibility or - View.SYSTEM_UI_FLAG_LAYOUT_STABLE or - View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION - } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - window.setDecorFitsSystemWindows(false) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + WindowCompat.setDecorFitsSystemWindows(window, false) } binding = ActivityLoginBinding.inflate(layoutInflater) @@ -62,48 +59,49 @@ class LoginActivity : AppCompatActivity() { private fun bindViews() { with(binding) { - combine( - etEmail.textChanges() - .map { Patterns.EMAIL_ADDRESS.matcher(it).matches() }, + lifecycleScope.launch { + repeatOnLifecycle(Lifecycle.State.STARTED) { + combine( + etEmail.textChanges() + .map { Patterns.EMAIL_ADDRESS.matcher(it).matches() }, + etPassword.textChanges() + .map { it.length > 7 }, + transform = { email, password -> email && password } + ) + .onEach { btLogin.isEnabled = it } + .launchIn(this) - etPassword.textChanges() - .map { it.length > 7 }, + merge( + btLogin.clicks(), + etPassword.editorActionEvents() + .filter { it.actionId == EditorInfo.IME_ACTION_DONE } + .filter { btLogin.isEnabled } + .onEach { hideSoftInput() } + ) + .onEach { + Toast.makeText( + this@LoginActivity, + R.string.login_success_message, + Toast.LENGTH_SHORT + ).show() + } + .launchIn(this) - transform = { email, password -> email && password } - ) - .onEach { btLogin.isEnabled = it } - .launchIn(lifecycleScope) - - merge( - btLogin.clicks(), - - etPassword.editorActionEvents() - .filter { it.actionId == EditorInfo.IME_ACTION_DONE } - .filter { btLogin.isEnabled } - .onEach { hideSoftInput() } - ) - .onEach { - Toast.makeText( - this@LoginActivity, - R.string.login_success_message, - Toast.LENGTH_SHORT - ).show() - } - .launchIn(lifecycleScope) - - swipe.refreshes() - .onEach { - etEmail.text?.clear() - etPassword.text?.clear() - swipe.isRefreshing = false - hideSoftInput() - Toast.makeText( - this@LoginActivity, - R.string.login_swipe_message, - Toast.LENGTH_SHORT - ).show() + swipe.refreshes() + .onEach { + etEmail.text?.clear() + etPassword.text?.clear() + swipe.isRefreshing = false + hideSoftInput() + Toast.makeText( + this@LoginActivity, + R.string.login_swipe_message, + Toast.LENGTH_SHORT + ).show() + } + .launchIn(this) } - .launchIn(lifecycleScope) + } } } } diff --git a/settings.gradle b/settings.gradle index 23a59e05..7a92dece 100644 --- a/settings.gradle +++ b/settings.gradle @@ -32,3 +32,5 @@ include ':corbind-viewpager' include ':corbind-viewpager2' include ':sample' + +enableFeaturePreview("VERSION_CATALOGS")