Skip to content

Commit

Permalink
Merge pull request #19 from LDRAlighieri/release/1.11.0
Browse files Browse the repository at this point in the history
Release 1.11.0. Min sdk now 19, update kotlin, material and other dependencies
  • Loading branch information
LDRAlighieri authored May 4, 2024
2 parents 75f0a87 + d91f209 commit 379b5fd
Show file tree
Hide file tree
Showing 157 changed files with 840 additions and 786 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# ChangeLog


## Version 1.11.0

* Update: minSdk is now 19.
* Update: Kotlin to v1.9.23.
* Update: Material components to v1.12.0.
* Update: Minor update of other libraries.


## Version 1.10.0

* New: BOM (Bills of Materials) module
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[![Corbind](logo.svg)](https://ldralighieri.github.io/Corbind)

[![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.9.21-blue.svg?logo=kotlin)](https://kotlinlang.org)
[![Kotlin Coroutines Version](https://img.shields.io/badge/Coroutines-v1.7.3-blue.svg)](https://kotlinlang.org/docs/reference/coroutines-overview.html)
[![Kotlin Version](https://img.shields.io/badge/Kotlin-v1.9.23-blue.svg?logo=kotlin)](https://kotlinlang.org)
[![Kotlin Coroutines Version](https://img.shields.io/badge/Coroutines-v1.8.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)](https://www.apache.org/licenses/LICENSE-2.0)

[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a1c9a1b1d1ce4ca7a201ab93492bf6e0)](https://app.codacy.com/gh/LDRAlighieri/Corbind)
[![API](https://img.shields.io/badge/API-14%2B-brightgreen.svg)](https://android-arsenal.com/api?level=14)
[![API](https://img.shields.io/badge/API-19%2B-brightgreen.svg)](https://android-arsenal.com/api?level=19)
[![Publish status](https://github.com/LDRAlighieri/Corbind/actions/workflows/publish.yml/badge.svg)](https://github.com/LDRAlighieri/Corbind/actions)

[![Google Dev Library](https://img.shields.io/badge/Google_DevLibrary-Corbind-blue)](https://devlibrary.withgoogle.com/products/android/repos/LDRAlighieri-Corbind)
Expand Down Expand Up @@ -54,15 +54,15 @@ Please consider giving this repository a star ⭐ if you like the project.
Platform bindings:
```kotlin
dependencies {
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2023.12.00"))
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2024.01.00"))
implementation("ru.ldralighieri.corbind:corbind")
}
```

AndroidX library bindings:
```kotlin
dependencies {
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2023.12.00"))
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2024.01.00"))
implementation("ru.ldralighieri.corbind:corbind-activity")
implementation("ru.ldralighieri.corbind:corbind-appcompat")
implementation("ru.ldralighieri.corbind:corbind-core")
Expand All @@ -82,7 +82,7 @@ dependencies {
Google 'material' library bindings:
```kotlin
dependencies {
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2023.12.00"))
implementation(platform("ru.ldralighieri.corbind:corbind-bom:2024.01.00"))
implementation("ru.ldralighieri.corbind:corbind-material")
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions

internal fun Project.configureKotlinAndroid(
commonExtension: CommonExtension<*, *, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *, *>,
) {
val compileSdk: String by project
val minSdk: String by project
Expand Down Expand Up @@ -55,6 +55,6 @@ internal fun Project.configureKotlinAndroid(
private fun Project.kotlin(action: KotlinAndroidProjectExtension.() -> Unit) =
extensions.configure(action)

private fun CommonExtension<*, *, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
private fun CommonExtension<*, *, *, *, *, *>.kotlinOptions(block: KotlinJvmOptions.() -> Unit) {
(this as ExtensionAware).extensions.configure("kotlinOptions", block)
}
2 changes: 1 addition & 1 deletion corbind-activity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To add androidx activity bindings, import `corbind-activity` module:

```kotlin
dependencies {
implementation("ru.ldralighieri.corbind:corbind-activity:1.10.0")
implementation("ru.ldralighieri.corbind:corbind-activity:1.11.0")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fun OnBackPressedDispatcher.backPresses(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend () -> Unit
action: suspend () -> Unit,
) {
val events = scope.actor<Unit>(Dispatchers.Main.immediate, capacity) {
for (ignored in channel) action()
Expand All @@ -65,7 +65,7 @@ fun OnBackPressedDispatcher.backPresses(
suspend fun OnBackPressedDispatcher.backPresses(
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend () -> Unit
action: suspend () -> Unit,
) = coroutineScope {
backPresses(this, lifecycleOwner, capacity, action)
}
Expand All @@ -89,7 +89,7 @@ suspend fun OnBackPressedDispatcher.backPresses(
fun OnBackPressedDispatcher.backPresses(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<Unit> = corbindReceiveChannel(capacity) {
val callback = callback(scope, ::trySend)
addCallback(lifecycleOwner, callback)
Expand Down Expand Up @@ -119,10 +119,10 @@ fun OnBackPressedDispatcher.backPresses(lifecycleOwner: LifecycleOwner): Flow<Un
@CheckResult
private fun callback(
scope: CoroutineScope,
emitter: (Unit) -> Unit
emitter: (Unit) -> Unit,
) = object : OnBackPressedCallback(true) {

override fun handleOnBackPressed() {
if (scope.isActive) { emitter(Unit) }
if (scope.isActive) emitter(Unit)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ fun OnBackPressedDispatcher.backProgressed(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (Float) -> Unit
action: suspend (Float) -> Unit,
) {
val events = scope.actor<Float>(Dispatchers.Main.immediate, capacity) {
for (progress in channel) action(progress)
Expand All @@ -67,7 +67,7 @@ fun OnBackPressedDispatcher.backProgressed(
suspend fun OnBackPressedDispatcher.backProgressed(
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (Float) -> Unit
action: suspend (Float) -> Unit,
) = coroutineScope {
backProgressed(this, lifecycleOwner, capacity, action)
}
Expand All @@ -92,7 +92,7 @@ suspend fun OnBackPressedDispatcher.backProgressed(
fun OnBackPressedDispatcher.backProgressed(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<Float> = corbindReceiveChannel(capacity) {
val callback = callback(scope, ::trySend)
addCallback(lifecycleOwner, callback)
Expand Down Expand Up @@ -124,11 +124,11 @@ fun OnBackPressedDispatcher.backProgressed(lifecycleOwner: LifecycleOwner): Flow
@CheckResult
private fun callback(
scope: CoroutineScope,
emitter: (Float) -> Unit
emitter: (Float) -> Unit,
) = object : OnBackPressedCallback(true) {

override fun handleOnBackProgressed(backEvent: BackEventCompat) {
if (scope.isActive) { emitter(backEvent.progress) }
if (scope.isActive) emitter(backEvent.progress)
}

override fun handleOnBackPressed() = Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fun OnBackPressedDispatcher.backEvents(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (OnBackEvent) -> Unit
action: suspend (OnBackEvent) -> Unit,
) {
val events = scope.actor<OnBackEvent>(Dispatchers.Main.immediate, capacity) {
for (event in channel) action(event)
Expand All @@ -72,7 +72,7 @@ fun OnBackPressedDispatcher.backEvents(
suspend fun OnBackPressedDispatcher.backEvents(
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (OnBackEvent) -> Unit
action: suspend (OnBackEvent) -> Unit,
) = coroutineScope {
backEvents(this, lifecycleOwner, capacity, action)
}
Expand Down Expand Up @@ -110,7 +110,7 @@ suspend fun OnBackPressedDispatcher.backEvents(
fun OnBackPressedDispatcher.backEvents(
scope: CoroutineScope,
lifecycleOwner: LifecycleOwner,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<OnBackEvent> = corbindReceiveChannel(capacity) {
val callback = callback(scope, ::trySend)
addCallback(lifecycleOwner, callback)
Expand Down Expand Up @@ -156,7 +156,7 @@ fun OnBackPressedDispatcher.backEvents(lifecycleOwner: LifecycleOwner): Flow<OnB
@CheckResult
private fun callback(
scope: CoroutineScope,
emitter: (OnBackEvent) -> Unit
emitter: (OnBackEvent) -> Unit,
) = object : OnBackPressedCallback(true) {

override fun handleOnBackPressed() = onEvent(OnBackPressed)
Expand All @@ -166,6 +166,6 @@ private fun callback(
onEvent(OnBackProgressed(backEvent))

private fun onEvent(event: OnBackEvent) {
if (scope.isActive) { emitter(event) }
if (scope.isActive) emitter(event)
}
}
2 changes: 1 addition & 1 deletion corbind-appcompat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To add androidx appcompat bindings, import `corbind-appcompat` module:

```kotlin
dependencies {
implementation("ru.ldralighieri.corbind:corbind-appcompat:1.10.0")
implementation("ru.ldralighieri.corbind:corbind-appcompat:1.11.0")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel
fun ActionMenuView.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (MenuItem) -> Unit
action: suspend (MenuItem) -> Unit,
) {
val events = scope.actor<MenuItem>(Dispatchers.Main.immediate, capacity) {
for (item in channel) action(item)
Expand All @@ -65,7 +65,7 @@ fun ActionMenuView.itemClicks(
*/
suspend fun ActionMenuView.itemClicks(
capacity: Int = Channel.RENDEZVOUS,
action: suspend (MenuItem) -> Unit
action: suspend (MenuItem) -> Unit,
) = coroutineScope {
itemClicks(this, capacity, action)
}
Expand All @@ -91,7 +91,7 @@ suspend fun ActionMenuView.itemClicks(
@CheckResult
fun ActionMenuView.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<MenuItem> = corbindReceiveChannel(capacity) {
setOnMenuItemClickListener(listener(scope, ::trySend))
invokeOnClose { setOnMenuItemClickListener(null) }
Expand Down Expand Up @@ -121,8 +121,8 @@ fun ActionMenuView.itemClicks(): Flow<MenuItem> = channelFlow {
@CheckResult
private fun listener(
scope: CoroutineScope,
emitter: (MenuItem) -> Unit
emitter: (MenuItem) -> Unit,
) = ActionMenuView.OnMenuItemClickListener {
if (scope.isActive) { emitter(it) }
if (scope.isActive) emitter(it)
return@OnMenuItemClickListener true
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel
fun PopupMenu.dismisses(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS,
action: suspend () -> Unit
action: suspend () -> Unit,
) {
val events = scope.actor<Unit>(Dispatchers.Main.immediate, capacity) {
for (ignored in channel) action()
Expand All @@ -64,7 +64,7 @@ fun PopupMenu.dismisses(
*/
suspend fun PopupMenu.dismisses(
capacity: Int = Channel.RENDEZVOUS,
action: suspend () -> Unit
action: suspend () -> Unit,
) = coroutineScope {
dismisses(this, capacity, action)
}
Expand All @@ -90,7 +90,7 @@ suspend fun PopupMenu.dismisses(
@CheckResult
fun PopupMenu.dismisses(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<Unit> = corbindReceiveChannel(capacity) {
setOnDismissListener(listener(scope, ::trySend))
invokeOnClose { setOnMenuItemClickListener(null) }
Expand Down Expand Up @@ -120,7 +120,7 @@ fun PopupMenu.dismisses(): Flow<Unit> = channelFlow {
@CheckResult
private fun listener(
scope: CoroutineScope,
emitter: (Unit) -> Unit
emitter: (Unit) -> Unit,
) = PopupMenu.OnDismissListener {
if (scope.isActive) { emitter(Unit) }
if (scope.isActive) emitter(Unit)
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel
fun PopupMenu.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (MenuItem) -> Unit
action: suspend (MenuItem) -> Unit,
) {
val events = scope.actor<MenuItem>(Dispatchers.Main.immediate, capacity) {
for (item in channel) action(item)
Expand All @@ -65,7 +65,7 @@ fun PopupMenu.itemClicks(
*/
suspend fun PopupMenu.itemClicks(
capacity: Int = Channel.RENDEZVOUS,
action: suspend (MenuItem) -> Unit
action: suspend (MenuItem) -> Unit,
) = coroutineScope {
itemClicks(this, capacity, action)
}
Expand All @@ -91,7 +91,7 @@ suspend fun PopupMenu.itemClicks(
@CheckResult
fun PopupMenu.itemClicks(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<MenuItem> = corbindReceiveChannel(capacity) {
setOnMenuItemClickListener(listener(scope, ::trySend))
invokeOnClose { setOnMenuItemClickListener(null) }
Expand Down Expand Up @@ -121,8 +121,8 @@ fun PopupMenu.itemClicks(): Flow<MenuItem> = channelFlow {
@CheckResult
private fun listener(
scope: CoroutineScope,
emitter: (MenuItem) -> Unit
emitter: (MenuItem) -> Unit,
) = PopupMenu.OnMenuItemClickListener {
if (scope.isActive) { emitter(it) }
if (scope.isActive) emitter(it)
return@OnMenuItemClickListener true
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel
data class SearchViewQueryTextEvent(
val view: SearchView,
val queryText: CharSequence,
val isSubmitted: Boolean
val isSubmitted: Boolean,
)

/**
Expand All @@ -50,7 +50,7 @@ data class SearchViewQueryTextEvent(
fun SearchView.queryTextChangeEvents(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS,
action: suspend (SearchViewQueryTextEvent) -> Unit
action: suspend (SearchViewQueryTextEvent) -> Unit,
) {
val events = scope.actor<SearchViewQueryTextEvent>(Dispatchers.Main.immediate, capacity) {
for (event in channel) action(event)
Expand All @@ -73,7 +73,7 @@ fun SearchView.queryTextChangeEvents(
*/
suspend fun SearchView.queryTextChangeEvents(
capacity: Int = Channel.RENDEZVOUS,
action: suspend (SearchViewQueryTextEvent) -> Unit
action: suspend (SearchViewQueryTextEvent) -> Unit,
) = coroutineScope {
queryTextChangeEvents(this, capacity, action)
}
Expand Down Expand Up @@ -101,7 +101,7 @@ suspend fun SearchView.queryTextChangeEvents(
@CheckResult
fun SearchView.queryTextChangeEvents(
scope: CoroutineScope,
capacity: Int = Channel.RENDEZVOUS
capacity: Int = Channel.RENDEZVOUS,
): ReceiveChannel<SearchViewQueryTextEvent> = corbindReceiveChannel(capacity) {
trySend(SearchViewQueryTextEvent(this@queryTextChangeEvents, query, false))
setOnQueryTextListener(listener(scope, this@queryTextChangeEvents, ::trySend))
Expand Down Expand Up @@ -143,7 +143,7 @@ fun SearchView.queryTextChangeEvents(): InitialValueFlow<SearchViewQueryTextEven
private fun listener(
scope: CoroutineScope,
searchView: SearchView,
emitter: (SearchViewQueryTextEvent) -> Unit
emitter: (SearchViewQueryTextEvent) -> Unit,
) = object : SearchView.OnQueryTextListener {

override fun onQueryTextChange(s: String): Boolean {
Expand Down
Loading

0 comments on commit 379b5fd

Please sign in to comment.