From b58e2cc957d17f7cefaf5665da82e35b27e0bf1f Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 21:11:09 +0300 Subject: [PATCH 01/13] Update gradle to v8.7 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4630f96b..652aaa62 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-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip From 619bd524bf94035d7342c3c896d9edc1b088e47f Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 21:30:31 +0300 Subject: [PATCH 02/13] Update plugins --- .../corbind/Project+configureKotlinAndroid.kt | 4 ++-- gradle/libs.versions.toml | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/ru/ldralighieri/corbind/Project+configureKotlinAndroid.kt b/build-logic/convention/src/main/kotlin/ru/ldralighieri/corbind/Project+configureKotlinAndroid.kt index b09023d1..3b26bdfa 100644 --- a/build-logic/convention/src/main/kotlin/ru/ldralighieri/corbind/Project+configureKotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/ru/ldralighieri/corbind/Project+configureKotlinAndroid.kt @@ -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 @@ -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) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4263cf04..c2ef8d98 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] # Plugins -agp = "8.2.0" -dokka = "1.9.10" +agp = "8.4.0" +dokka = "1.9.20" spotless = "6.18.0" -mavenPublish = "0.25.3" -bcv = "0.13.2" +mavenPublish = "0.28.0" +bcv = "0.14.0" gver = "0.50.0" # Kotlin From 5a257c57d5bfff3c00b48c9c93bff8214f3152c5 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 21:48:09 +0300 Subject: [PATCH 03/13] Fix spotless --- .../OnBackPressedDispatcherBackPresses.kt | 10 +++---- .../OnBackPressedDispatcherBackProgressed.kt | 10 +++---- .../OnBackPressedDispatcherOnBackEvents.kt | 10 +++---- .../appcompat/ActionMenuViewItemClicks.kt | 10 +++---- .../corbind/appcompat/PopupMenuDismisses.kt | 10 +++---- .../corbind/appcompat/PopupMenuItemClicks.kt | 10 +++---- .../SearchViewQueryTextChangeEvents.kt | 10 +++---- .../appcompat/SearchViewQueryTextChanges.kt | 10 +++---- .../corbind/appcompat/ToolbarItemClicks.kt | 10 +++---- .../appcompat/ToolbarNavigationClicks.kt | 10 +++---- .../NestedScrollViewScrollChangeEvents.kt | 8 +++--- .../drawerlayout/DrawerLayoutDrawerOpen.kt | 14 +++++----- .../fragment/FragmentManagerResultEvents.kt | 14 +++++----- .../SearchBarSearchQueryChangeEvents.kt | 16 ++++++------ .../leanback/SearchBarSearchQueryChanges.kt | 10 +++---- .../SearchEditTextKeyboardDismisses.kt | 10 +++---- .../corbind/lifecycle/LifecycleEvents.kt | 11 ++++---- .../material/AppBarLayoutOffsetChanges.kt | 10 +++---- .../material/BottomSheetBehaviorSlides.kt | 10 +++---- .../BottomSheetBehaviorStateChanges.kt | 10 +++---- .../corbind/material/ChipCloseIconClicks.kt | 10 +++---- .../material/ChipGroupCheckedChanges.kt | 10 +++---- ...mViewOnScrollBehaviorScrollStateChanges.kt | 10 +++---- .../MaskableFrameLayoutMaskChanges.kt | 10 +++---- .../material/MaterialButtonCheckedChanges.kt | 10 +++---- ...ialButtonToggleGroupCheckedChangeEvents.kt | 12 ++++----- ...MaterialButtonToggleGroupCheckedChanges.kt | 10 +++---- .../MaterialCardViewCheckedChanges.kt | 10 +++---- .../material/MaterialDatePickerCancels.kt | 10 +++---- .../material/MaterialDatePickerDismisses.kt | 10 +++---- .../MaterialDatePickerNegativeClicks.kt | 10 +++---- .../MaterialDatePickerPositiveClicks.kt | 10 +++---- .../material/MaterialTimePickerCancels.kt | 10 +++---- .../material/MaterialTimePickerDismisses.kt | 10 +++---- .../MaterialTimePickerNegativeClicks.kt | 10 +++---- .../MaterialTimePickerPositiveClicks.kt | 10 +++---- .../NavigationBarViewItemReselections.kt | 10 +++---- .../NavigationBarViewItemSelections.kt | 12 ++++----- .../material/NavigationViewItemSelections.kt | 12 ++++----- .../corbind/material/RangeSliderTouches.kt | 14 +++++----- .../material/RangeSliderValuesChangeEvents.kt | 19 +++++++++----- .../material/RangeSliderValuesChanges.kt | 10 +++---- .../material/SearchBarNavigationClicks.kt | 10 +++---- .../SearchViewTransitionStateChangeEvents.kt | 10 +++---- .../SearchViewTransitionStateChanges.kt | 10 +++---- .../material/SideSheetBehaviorSlides.kt | 10 +++---- .../material/SideSheetBehaviorStateChanges.kt | 10 +++---- .../corbind/material/SliderTouches.kt | 14 +++++----- .../material/SliderValueChangeEvents.kt | 14 +++++----- .../corbind/material/SliderValueChanges.kt | 10 +++---- .../corbind/material/SnackbarDismisses.kt | 10 +++---- .../corbind/material/SnackbarShown.kt | 10 +++---- .../material/SwipeDismissBehaviorDesmisses.kt | 10 +++---- .../SwipeDismissBehaviorDragStateChanges.kt | 10 +++---- .../material/TabLayoutSelectionEvents.kt | 18 ++++++------- .../corbind/material/TabLayoutSelections.kt | 14 +++++----- .../material/TextInputLayoutEndIconChanges.kt | 10 +++---- .../material/TextInputLayoutEndIconClicks.kt | 10 +++---- .../TextInputLayoutEndIconLongClicks.kt | 10 +++---- .../TextInputLayoutStartIconClicks.kt | 10 +++---- .../TextInputLayoutStartIconLongClicks.kt | 10 +++---- .../NavControllerOnDestinationChangeEvents.kt | 10 +++---- .../NavControllerOnDestinationChanges.kt | 10 +++---- .../RecyclerAdapterDataChanges.kt | 10 +++---- ...ecyclerViewChildAttachStateChangeEvents.kt | 16 ++++++------ .../recyclerview/RecyclerViewFlingEvents.kt | 10 +++---- .../recyclerview/RecyclerViewScrollEvents.kt | 12 ++++----- .../RecyclerViewScrollStateChanges.kt | 10 +++---- .../SlidingPaneLayoutPaneOpens.kt | 14 +++++----- .../SlidingPaneLayoutSlides.kt | 10 +++---- .../SwipeRefreshLayoutRefreshes.kt | 10 +++---- .../viewpager/ViewPagerPageScrollEvents.kt | 12 ++++----- .../ViewPagerPageScrollStateChanges.kt | 10 +++---- .../viewpager/ViewPagerPageSelections.kt | 10 +++---- .../viewpager2/ViewPager2PageScrollEvents.kt | 12 ++++----- .../ViewPager2PageScrollStateChanges.kt | 10 +++---- .../viewpager2/ViewPager2PageSelections.kt | 10 +++---- .../app/DatePickerDialogDateSetEvents.kt | 14 +++++----- .../content/ContextReceivesBroadcast.kt | 10 +++---- .../corbind/internal/CorbindReceiveChannel.kt | 2 +- .../corbind/internal/InitialValueFlow.kt | 2 +- .../corbind/view/MenuItemActionViewEvents.kt | 14 +++++----- .../corbind/view/MenuItemClicks.kt | 10 +++---- .../corbind/view/ViewAttachEvents.kt | 18 ++++++------- .../ldralighieri/corbind/view/ViewAttaches.kt | 18 ++++++------- .../ldralighieri/corbind/view/ViewClicks.kt | 10 +++---- .../ru/ldralighieri/corbind/view/ViewDrags.kt | 10 +++---- .../corbind/view/ViewFocusChanges.kt | 10 +++---- .../view/ViewGroupHierarchyChangeEvents.kt | 20 +++++++------- .../ldralighieri/corbind/view/ViewHovers.kt | 8 +++--- .../ru/ldralighieri/corbind/view/ViewKeys.kt | 8 +++--- .../corbind/view/ViewLayoutChangeEvents.kt | 23 ++++++++++------ .../corbind/view/ViewLayoutChanges.kt | 10 +++---- .../corbind/view/ViewLongClicks.kt | 10 +++---- .../corbind/view/ViewScrollChangeEvents.kt | 10 +++---- .../view/ViewSystemUiVisibilityChanges.kt | 26 +++++++++---------- .../ldralighieri/corbind/view/ViewTouches.kt | 10 +++---- .../corbind/view/ViewTreeObserverDraws.kt | 10 +++---- .../view/ViewTreeObserverGlobalLayouts.kt | 10 +++---- .../corbind/view/ViewTreeObserverPreDraws.kt | 10 +++---- .../view/ViewWindowInsetsApplyEvents.kt | 12 ++++----- .../corbind/widget/AbsListViewScrollEvents.kt | 16 ++++++------ .../corbind/widget/AdapterDataChanges.kt | 10 +++---- .../widget/AdapterViewItemClickEvents.kt | 10 +++---- .../corbind/widget/AdapterViewItemClicks.kt | 10 +++---- .../widget/AdapterViewItemLongClickEvents.kt | 12 ++++----- .../widget/AdapterViewItemLongClicks.kt | 10 +++---- .../widget/AdapterViewItemSelections.kt | 12 ++++----- .../widget/AdapterViewSelectionEvents.kt | 16 ++++++------ .../widget/AutoCompleteTextViewDismisses.kt | 10 +++---- .../AutoCompleteTextViewItemClickEvents.kt | 8 +++--- .../widget/CalendarViewDateChangeEvents.kt | 14 +++++----- .../widget/CompoundButtonCheckedChanges.kt | 10 +++---- .../corbind/widget/DatePickerChangedEvents.kt | 14 +++++----- .../widget/NumberPickerScrollStateChanges.kt | 10 +++---- .../widget/NumberPickerValueChangeEvents.kt | 14 +++++----- .../corbind/widget/PopupMenuDismisses.kt | 10 +++---- .../corbind/widget/PopupMenuItemClicks.kt | 8 +++--- .../widget/RadioGroupCheckedChanges.kt | 8 +++--- .../widget/RatingBarRatingChangeEvents.kt | 14 +++++----- .../corbind/widget/RatingBarRatingChanges.kt | 10 +++---- .../widget/SearchViewQueryTextChangeEvents.kt | 10 +++---- .../widget/SearchViewQueryTextChanges.kt | 8 +++--- .../corbind/widget/SeekBarChangeEvents.kt | 16 ++++++------ .../corbind/widget/SeekBarChanges.kt | 26 +++++++++---------- .../widget/TextViewAfterTextChangeEvents.kt | 14 +++++----- .../widget/TextViewBeforeTextChangeEvents.kt | 10 +++---- .../widget/TextViewEditorActionEvents.kt | 12 ++++----- .../corbind/widget/TextViewEditorActions.kt | 8 +++--- .../widget/TextViewTextChangeEvents.kt | 10 +++---- .../corbind/widget/TextViewTextChanges.kt | 10 +++---- .../corbind/widget/TimePickerChangedEvents.kt | 14 +++++----- .../corbind/widget/ToolbarItemClicks.kt | 8 +++--- .../corbind/widget/ToolbarNavigationClicks.kt | 10 +++---- gradle/libs.versions.toml | 4 +-- 135 files changed, 767 insertions(+), 742 deletions(-) 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 6dd08a21..a34c228a 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 @@ -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(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -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) } @@ -89,7 +89,7 @@ suspend fun OnBackPressedDispatcher.backPresses( fun OnBackPressedDispatcher.backPresses( scope: CoroutineScope, lifecycleOwner: LifecycleOwner, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) addCallback(lifecycleOwner, callback) @@ -119,10 +119,10 @@ fun OnBackPressedDispatcher.backPresses(lifecycleOwner: LifecycleOwner): Flow Unit + emitter: (Unit) -> Unit, ) = object : OnBackPressedCallback(true) { override fun handleOnBackPressed() { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } } diff --git a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackProgressed.kt b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackProgressed.kt index 67c0fffc..53fb3751 100644 --- a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackProgressed.kt +++ b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherBackProgressed.kt @@ -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(Dispatchers.Main.immediate, capacity) { for (progress in channel) action(progress) @@ -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) } @@ -92,7 +92,7 @@ suspend fun OnBackPressedDispatcher.backProgressed( fun OnBackPressedDispatcher.backProgressed( scope: CoroutineScope, lifecycleOwner: LifecycleOwner, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) addCallback(lifecycleOwner, callback) @@ -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 diff --git a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherOnBackEvents.kt b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherOnBackEvents.kt index b2a7b72b..a49792d2 100644 --- a/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherOnBackEvents.kt +++ b/corbind-activity/src/main/kotlin/ru/ldralighieri/corbind/activity/OnBackPressedDispatcherOnBackEvents.kt @@ -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(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -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) } @@ -110,7 +110,7 @@ suspend fun OnBackPressedDispatcher.backEvents( fun OnBackPressedDispatcher.backEvents( scope: CoroutineScope, lifecycleOwner: LifecycleOwner, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) addCallback(lifecycleOwner, callback) @@ -156,7 +156,7 @@ fun OnBackPressedDispatcher.backEvents(lifecycleOwner: LifecycleOwner): Flow Unit + emitter: (OnBackEvent) -> Unit, ) = object : OnBackPressedCallback(true) { override fun handleOnBackPressed() = onEvent(OnBackPressed) @@ -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) } } 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 183ac883..4a24c590 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 @@ -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(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -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) } @@ -91,7 +91,7 @@ suspend fun ActionMenuView.itemClicks( @CheckResult fun ActionMenuView.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -121,8 +121,8 @@ fun ActionMenuView.itemClicks(): Flow = 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 } 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 2eec1649..59208bec 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 @@ -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(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -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) } @@ -90,7 +90,7 @@ suspend fun PopupMenu.dismisses( @CheckResult fun PopupMenu.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnDismissListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -120,7 +120,7 @@ fun PopupMenu.dismisses(): Flow = 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) } 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 dc31cbe8..44496ab0 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 @@ -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(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -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) } @@ -91,7 +91,7 @@ suspend fun PopupMenu.itemClicks( @CheckResult fun PopupMenu.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -121,8 +121,8 @@ fun PopupMenu.itemClicks(): Flow = 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 } 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 19f88a20..0d2c16c3 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 @@ -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, ) /** @@ -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(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -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) } @@ -101,7 +101,7 @@ suspend fun SearchView.queryTextChangeEvents( @CheckResult fun SearchView.queryTextChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(SearchViewQueryTextEvent(this@queryTextChangeEvents, query, false)) setOnQueryTextListener(listener(scope, this@queryTextChangeEvents, ::trySend)) @@ -143,7 +143,7 @@ fun SearchView.queryTextChangeEvents(): InitialValueFlow Unit + emitter: (SearchViewQueryTextEvent) -> Unit, ) = object : SearchView.OnQueryTextListener { override fun onQueryTextChange(s: String): Boolean { 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 b828d989..32fc622c 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchView.queryTextChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (chars in channel) action(chars) @@ -67,7 +67,7 @@ fun SearchView.queryTextChanges( */ suspend fun SearchView.queryTextChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) = coroutineScope { queryTextChanges(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun SearchView.queryTextChanges( @CheckResult fun SearchView.queryTextChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(query) setOnQueryTextListener(listener(scope, ::trySend)) @@ -136,7 +136,7 @@ fun SearchView.queryTextChanges(): InitialValueFlow = channelFlow @CheckResult private fun listener( scope: CoroutineScope, - emitter: (CharSequence) -> Unit + emitter: (CharSequence) -> Unit, ) = object : SearchView.OnQueryTextListener { override fun onQueryTextChange(s: String): Boolean { @@ -147,5 +147,5 @@ private fun listener( return false } - override fun onQueryTextSubmit(query: String): Boolean { return false } + override fun onQueryTextSubmit(query: String): Boolean = false } 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 7f031156..d12023bb 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Toolbar.itemClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -65,7 +65,7 @@ fun Toolbar.itemClicks( */ suspend fun Toolbar.itemClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { itemClicks(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun Toolbar.itemClicks( @CheckResult fun Toolbar.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -121,8 +121,8 @@ fun Toolbar.itemClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = Toolbar.OnMenuItemClickListener { - if (scope.isActive) { emitter(it) } + if (scope.isActive) emitter(it) return@OnMenuItemClickListener true } 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 7863ce58..bf7b444a 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Toolbar.navigationClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -65,7 +65,7 @@ fun Toolbar.navigationClicks( */ suspend fun Toolbar.navigationClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { navigationClicks(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun Toolbar.navigationClicks( @CheckResult fun Toolbar.navigationClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setNavigationOnClickListener(listener(scope, ::trySend)) invokeOnClose { setNavigationOnClickListener(null) } @@ -121,7 +121,7 @@ fun Toolbar.navigationClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 3e82536f..15464607 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.view.ViewScrollChangeEvent fun NestedScrollView.scrollChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewScrollChangeEvent) -> Unit + action: suspend (ViewScrollChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -67,7 +67,7 @@ fun NestedScrollView.scrollChangeEvents( */ suspend fun NestedScrollView.scrollChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewScrollChangeEvent) -> Unit + action: suspend (ViewScrollChangeEvent) -> Unit, ) = coroutineScope { scrollChangeEvents(this, capacity, action) } @@ -93,7 +93,7 @@ suspend fun NestedScrollView.scrollChangeEvents( @CheckResult fun NestedScrollView.scrollChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnScrollChangeListener(listener(scope, ::trySend)) invokeOnClose { setOnScrollChangeListener(null as NestedScrollView.OnScrollChangeListener?) } @@ -123,7 +123,7 @@ fun NestedScrollView.scrollChangeEvents(): Flow = channel @CheckResult private fun listener( scope: CoroutineScope, - emitter: (ViewScrollChangeEvent) -> Unit + emitter: (ViewScrollChangeEvent) -> Unit, ) = NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> if (scope.isActive) { emitter(ViewScrollChangeEvent(v, scrollX, scrollY, oldScrollX, oldScrollY)) 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 6643ca08..6fc91e89 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 @@ -44,7 +44,7 @@ fun DrawerLayout.drawerOpens( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, gravity: Int, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (open in channel) action(open) @@ -66,7 +66,7 @@ fun DrawerLayout.drawerOpens( suspend fun DrawerLayout.drawerOpens( capacity: Int = Channel.RENDEZVOUS, gravity: Int, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { drawerOpens(this, capacity, gravity, action) } @@ -93,7 +93,7 @@ suspend fun DrawerLayout.drawerOpens( fun DrawerLayout.drawerOpens( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - gravity: Int + gravity: Int, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(isDrawerOpen(gravity)) val listener = listener(scope, gravity, ::trySend) @@ -136,18 +136,18 @@ fun DrawerLayout.drawerOpens(gravity: Int): InitialValueFlow = channelF private fun listener( scope: CoroutineScope, gravity: Int, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = object : DrawerLayout.DrawerListener { override fun onDrawerSlide(drawerView: View, slideOffset: Float) = Unit - override fun onDrawerOpened(drawerView: View) { onEvent(drawerView, true) } - override fun onDrawerClosed(drawerView: View) { onEvent(drawerView, false) } + override fun onDrawerOpened(drawerView: View) = onEvent(drawerView, true) + override fun onDrawerClosed(drawerView: View) = onEvent(drawerView, false) override fun onDrawerStateChanged(newState: Int) = Unit private fun onEvent(drawerView: View, opened: Boolean) { if (scope.isActive) { val drawerGravity = (drawerView.layoutParams as DrawerLayout.LayoutParams).gravity - if (drawerGravity == gravity) { emitter(opened) } + if (drawerGravity == gravity) emitter(opened) } } } diff --git a/corbind-fragment/src/main/kotlin/ru/ldralighieri/corbind/fragment/FragmentManagerResultEvents.kt b/corbind-fragment/src/main/kotlin/ru/ldralighieri/corbind/fragment/FragmentManagerResultEvents.kt index 59d89c35..fe8f813b 100644 --- a/corbind-fragment/src/main/kotlin/ru/ldralighieri/corbind/fragment/FragmentManagerResultEvents.kt +++ b/corbind-fragment/src/main/kotlin/ru/ldralighieri/corbind/fragment/FragmentManagerResultEvents.kt @@ -34,7 +34,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class FragmentResultEvent( val requestKey: String, - val bundle: Bundle + val bundle: Bundle, ) /** @@ -55,7 +55,7 @@ fun FragmentManager.resultEvents( requestKey: String, lifecycleOwner: LifecycleOwner, capacity: Int = Channel.RENDEZVOUS, - action: suspend (FragmentResultEvent) -> Unit + action: suspend (FragmentResultEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -82,7 +82,7 @@ suspend fun FragmentManager.resultEvents( requestKey: String, lifecycleOwner: LifecycleOwner, capacity: Int = Channel.RENDEZVOUS, - action: suspend (FragmentResultEvent) -> Unit + action: suspend (FragmentResultEvent) -> Unit, ) = coroutineScope { resultEvents(this, requestKey, lifecycleOwner, capacity, action) } @@ -114,7 +114,7 @@ fun FragmentManager.resultEvents( scope: CoroutineScope, requestKey: String, lifecycleOwner: LifecycleOwner, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) setFragmentResultListener(requestKey, lifecycleOwner, listener) @@ -145,7 +145,7 @@ fun FragmentManager.resultEvents( */ fun FragmentManager.resultEvents( requestKey: String, - lifecycleOwner: LifecycleOwner + lifecycleOwner: LifecycleOwner, ): Flow = channelFlow { val listener = listener(this, ::trySend) setFragmentResultListener(requestKey, lifecycleOwner, listener) @@ -155,7 +155,7 @@ fun FragmentManager.resultEvents( @CheckResult private fun listener( scope: CoroutineScope, - emitter: (FragmentResultEvent) -> Unit + emitter: (FragmentResultEvent) -> Unit, ) = { requestKey: String, bundle: Bundle -> - if (scope.isActive) { emitter(FragmentResultEvent(requestKey, bundle)) } + if (scope.isActive) emitter(FragmentResultEvent(requestKey, bundle)) } 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 36ce4a7b..c3b1f00b 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 @@ -37,17 +37,17 @@ sealed interface SearchBarSearchQueryEvent { data class SearchBarSearchQueryChangedEvent( override val view: SearchBar, - override val searchQuery: String + override val searchQuery: String, ) : SearchBarSearchQueryEvent data class SearchBarSearchQueryKeyboardDismissedEvent( override val view: SearchBar, - override val searchQuery: String + override val searchQuery: String, ) : SearchBarSearchQueryEvent data class SearchBarSearchQuerySubmittedEvent( override val view: SearchBar, - override val searchQuery: String + override val searchQuery: String, ) : SearchBarSearchQueryEvent /** @@ -63,7 +63,7 @@ data class SearchBarSearchQuerySubmittedEvent( fun SearchBar.searchQueryChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchBarSearchQueryEvent) -> Unit + action: suspend (SearchBarSearchQueryEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -85,7 +85,7 @@ fun SearchBar.searchQueryChangeEvents( */ suspend fun SearchBar.searchQueryChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchBarSearchQueryEvent) -> Unit + action: suspend (SearchBarSearchQueryEvent) -> Unit, ) = coroutineScope { searchQueryChangeEvents(this, capacity, action) } @@ -127,7 +127,7 @@ suspend fun SearchBar.searchQueryChangeEvents( @CheckResult fun SearchBar.searchQueryChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setSearchBarListener(listener(scope, this@searchQueryChangeEvents, ::trySend)) invokeOnClose { setSearchBarListener(null) } @@ -173,7 +173,7 @@ fun SearchBar.searchQueryChangeEvents(): Flow = chann private fun listener( scope: CoroutineScope, searchBar: SearchBar, - emitter: (SearchBarSearchQueryEvent) -> Unit + emitter: (SearchBarSearchQueryEvent) -> Unit, ) = object : SearchBar.SearchBarListener { override fun onSearchQueryChange(query: String) { @@ -189,6 +189,6 @@ private fun listener( } private fun onEvent(event: SearchBarSearchQueryEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 f4f6381d..9ca4283c 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchBar.searchQueryChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (String) -> Unit + action: suspend (String) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (query in channel) action(query) @@ -65,7 +65,7 @@ fun SearchBar.searchQueryChanges( */ suspend fun SearchBar.searchQueryChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (String) -> Unit + action: suspend (String) -> Unit, ) = coroutineScope { searchQueryChanges(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun SearchBar.searchQueryChanges( @CheckResult fun SearchBar.searchQueryChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setSearchBarListener(listener(scope, ::trySend)) invokeOnClose { setSearchBarListener(null) } @@ -121,11 +121,11 @@ fun SearchBar.searchQueryChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (String) -> Unit + emitter: (String) -> Unit, ) = object : SearchBar.SearchBarListener { override fun onSearchQueryChange(query: String) { - if (scope.isActive) { emitter(query) } + if (scope.isActive) emitter(query) } override fun onSearchQuerySubmit(query: String) = Unit 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 89643b0e..8ebf0b48 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchEditText.keyboardDismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -65,7 +65,7 @@ fun SearchEditText.keyboardDismisses( */ suspend fun SearchEditText.keyboardDismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { keyboardDismisses(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun SearchEditText.keyboardDismisses( @CheckResult fun SearchEditText.keyboardDismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnKeyboardDismissListener(listener(scope, ::trySend)) invokeOnClose { setOnKeyboardDismissListener(null) } @@ -121,7 +121,7 @@ fun SearchEditText.keyboardDismisses(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = SearchEditText.OnKeyboardDismissListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 7f113380..6b8de40b 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Lifecycle.events( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Lifecycle.Event) -> Unit + action: suspend (Lifecycle.Event) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -60,7 +60,7 @@ fun Lifecycle.events( */ suspend fun Lifecycle.events( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Lifecycle.Event) -> Unit + action: suspend (Lifecycle.Event) -> Unit, ) = coroutineScope { events(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun Lifecycle.events( */ fun Lifecycle.events( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val observer = observer(scope, ::trySend) addObserver(observer) @@ -111,8 +111,7 @@ fun Lifecycle.events(): Flow = channelFlow { @CheckResult private fun observer( scope: CoroutineScope, - emitter: (Lifecycle.Event) -> Unit + emitter: (Lifecycle.Event) -> Unit, ) = LifecycleEventObserver { _, event -> - - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } 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 0dae7e31..07a2c3e2 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun AppBarLayout.offsetChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (offset in channel) action(offset) @@ -59,7 +59,7 @@ fun AppBarLayout.offsetChanges( */ suspend fun AppBarLayout.offsetChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { offsetChanges(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun AppBarLayout.offsetChanges( @CheckResult fun AppBarLayout.offsetChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnOffsetChangedListener(listener) @@ -111,7 +111,7 @@ fun AppBarLayout.offsetChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = AppBarLayout.OnOffsetChangedListener { _, verticalOffset -> - if (scope.isActive) { emitter(verticalOffset) } + if (scope.isActive) emitter(verticalOffset) } 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 b6ad9fe6..56014aaf 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.slides( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (offset in channel) action(offset) @@ -62,7 +62,7 @@ fun View.slides( */ suspend fun View.slides( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) = coroutineScope { slides(this, capacity, action) } @@ -85,7 +85,7 @@ suspend fun View.slides( @CheckResult fun View.slides( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getBottomSheetBehavior() val callback = callback(scope, ::trySend) @@ -116,11 +116,11 @@ fun View.slides(): Flow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Float) -> Unit + emitter: (Float) -> Unit, ) = object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, slideOffset: Float) { - if (scope.isActive) { emitter(slideOffset) } + if (scope.isActive) emitter(slideOffset) } override fun onStateChanged(bottomSheet: View, newState: Int) = Unit 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 3d103195..e057ad9b 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.stateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -65,7 +65,7 @@ fun View.stateChanges( */ suspend fun View.stateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { stateChanges(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun View.stateChanges( @CheckResult fun View.stateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getBottomSheetBehavior() trySend(behavior.state) @@ -139,11 +139,11 @@ internal fun View.getBottomSheetBehavior(): BottomSheetBehavior<*> { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : BottomSheetBehavior.BottomSheetCallback() { override fun onStateChanged(bottomSheet: View, newState: Int) { - if (scope.isActive) { emitter(newState) } + if (scope.isActive) emitter(newState) } override fun onSlide(bottomSheet: View, slideOffset: Float) = Unit 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 1ee5f37e..5f7971d3 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Chip.closeIconClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -65,7 +65,7 @@ fun Chip.closeIconClicks( */ suspend fun Chip.closeIconClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { closeIconClicks(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun Chip.closeIconClicks( @CheckResult fun Chip.closeIconClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnCloseIconClickListener(listener(scope, ::trySend)) invokeOnClose { setOnClickListener(null) } @@ -121,7 +121,7 @@ fun Chip.closeIconClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 2020fa8b..6f33dc3f 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun ChipGroup.checkedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (List) -> Unit + action: suspend (List) -> Unit, ) { val events = scope.actor>(Dispatchers.Main.immediate, capacity) { for (checkedId in channel) action(checkedId) @@ -66,7 +66,7 @@ fun ChipGroup.checkedChanges( */ suspend fun ChipGroup.checkedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (List) -> Unit + action: suspend (List) -> Unit, ) = coroutineScope { checkedChanges(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun ChipGroup.checkedChanges( @CheckResult fun ChipGroup.checkedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel> = corbindReceiveChannel(capacity) { trySend(checkedChipIds) setOnCheckedStateChangeListener(listener(scope, ::trySend)) @@ -137,7 +137,7 @@ fun ChipGroup.checkedChanges(): InitialValueFlow> = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (List) -> Unit + emitter: (List) -> Unit, ) = ChipGroup.OnCheckedStateChangeListener { _, checkedIds -> - if (scope.isActive) { emitter(checkedIds) } + if (scope.isActive) emitter(checkedIds) } diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/HideBottomViewOnScrollBehaviorScrollStateChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/HideBottomViewOnScrollBehaviorScrollStateChanges.kt index 6babd45a..d5ea87df 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/HideBottomViewOnScrollBehaviorScrollStateChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/HideBottomViewOnScrollBehaviorScrollStateChanges.kt @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.bottomViewScrollStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -64,7 +64,7 @@ fun View.bottomViewScrollStateChanges( */ suspend fun View.bottomViewScrollStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { bottomViewScrollStateChanges(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun View.bottomViewScrollStateChanges( @CheckResult fun View.bottomViewScrollStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getBehavior() val listener = listener(scope, ::trySend) @@ -131,7 +131,7 @@ private fun View.getBehavior(): HideBottomViewOnScrollBehavior<*> { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = HideBottomViewOnScrollBehavior.OnScrollStateChangedListener { _, newState -> - if (scope.isActive) { emitter(newState) } + if (scope.isActive) emitter(newState) } diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaskableFrameLayoutMaskChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaskableFrameLayoutMaskChanges.kt index 5b30aec0..fdeeadd9 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaskableFrameLayoutMaskChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/MaskableFrameLayoutMaskChanges.kt @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaskableFrameLayout.maskChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RectF) -> Unit + action: suspend (RectF) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (changes in channel) action(changes) @@ -64,7 +64,7 @@ fun MaskableFrameLayout.maskChanges( */ suspend fun MaskableFrameLayout.maskChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RectF) -> Unit + action: suspend (RectF) -> Unit, ) = coroutineScope { maskChanges(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun MaskableFrameLayout.maskChanges( @CheckResult fun MaskableFrameLayout.maskChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMaskChangedListener(listener(scope, ::trySend)) invokeOnClose { setOnMaskChangedListener(null) } @@ -119,7 +119,7 @@ fun MaskableFrameLayout.maskChanges() = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (RectF) -> Unit + emitter: (RectF) -> Unit, ) = OnMaskChangedListener { maskRect -> - if (scope.isActive) { emitter(maskRect) } + if (scope.isActive) emitter(maskRect) } 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 b05e7c4a..d5e5783f 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialButton.checkedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (checked in channel) action(checked) @@ -66,7 +66,7 @@ fun MaterialButton.checkedChanges( */ suspend fun MaterialButton.checkedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { checkedChanges(this, capacity, action) } @@ -93,7 +93,7 @@ suspend fun MaterialButton.checkedChanges( @CheckResult fun MaterialButton.checkedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { checkCheckableState(this@checkedChanges) trySend(isChecked) @@ -141,7 +141,7 @@ private fun checkCheckableState(button: MaterialButton) { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = MaterialButton.OnCheckedChangeListener { _, isChecked -> - if (scope.isActive) { emitter(isChecked) } + if (scope.isActive) emitter(isChecked) } 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 a99aa4b6..49920c59 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 @@ -34,7 +34,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class MaterialButtonCheckedChangeEvent( @IdRes val checkedId: Int, - val isChecked: Boolean + val isChecked: Boolean, ) /** @@ -50,7 +50,7 @@ data class MaterialButtonCheckedChangeEvent( fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MaterialButtonCheckedChangeEvent) -> Unit + action: suspend (MaterialButtonCheckedChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -73,7 +73,7 @@ fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( */ suspend fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MaterialButtonCheckedChangeEvent) -> Unit + action: suspend (MaterialButtonCheckedChangeEvent) -> Unit, ) = coroutineScope { buttonCheckedChangeEvents(this, capacity, action) } @@ -99,7 +99,7 @@ suspend fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( @CheckResult fun MaterialButtonToggleGroup.buttonCheckedChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { checkSelectionMode(this@buttonCheckedChangeEvents) val listener = listener(scope, ::trySend) @@ -141,7 +141,7 @@ private fun checkSelectionMode(group: MaterialButtonToggleGroup) { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MaterialButtonCheckedChangeEvent) -> Unit + emitter: (MaterialButtonCheckedChangeEvent) -> Unit, ) = MaterialButtonToggleGroup.OnButtonCheckedListener { _, checkedId, isChecked -> - if (scope.isActive) { emitter(MaterialButtonCheckedChangeEvent(checkedId, isChecked)) } + if (scope.isActive) emitter(MaterialButtonCheckedChangeEvent(checkedId, isChecked)) } 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 6bec7022..d319c9fb 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 @@ -47,7 +47,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialButtonToggleGroup.buttonCheckedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (checkedId in channel) action(checkedId) @@ -73,7 +73,7 @@ fun MaterialButtonToggleGroup.buttonCheckedChanges( */ suspend fun MaterialButtonToggleGroup.buttonCheckedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { buttonCheckedChanges(this, capacity, action) } @@ -102,7 +102,7 @@ suspend fun MaterialButtonToggleGroup.buttonCheckedChanges( @CheckResult fun MaterialButtonToggleGroup.buttonCheckedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { checkSelectionMode(this@buttonCheckedChanges) trySend(checkedButtonId) @@ -155,14 +155,14 @@ private fun checkSelectionMode(group: MaterialButtonToggleGroup) { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : MaterialButtonToggleGroup.OnButtonCheckedListener { private var lastChecked = View.NO_ID override fun onButtonChecked( group: MaterialButtonToggleGroup, checkedId: Int, - isChecked: Boolean + isChecked: Boolean, ) { if (scope.isActive) { when { 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 2cf1f2a0..48345d5b 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialCardView.checkedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (checked in channel) action(checked) @@ -66,7 +66,7 @@ fun MaterialCardView.checkedChanges( */ suspend fun MaterialCardView.checkedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { checkedChanges(this, capacity, action) } @@ -93,7 +93,7 @@ suspend fun MaterialCardView.checkedChanges( @CheckResult fun MaterialCardView.checkedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { checkCheckableState(this@checkedChanges) trySend(isChecked) @@ -140,7 +140,7 @@ private fun checkCheckableState(card: MaterialCardView) { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = MaterialCardView.OnCheckedChangeListener { _, isChecked -> - if (scope.isActive) { emitter(isChecked) } + if (scope.isActive) emitter(isChecked) } 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 2b587c05..31d1ea9a 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 @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialDatePicker.cancels( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -68,7 +68,7 @@ fun MaterialDatePicker.cancels( */ suspend fun MaterialDatePicker.cancels( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { cancels(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun MaterialDatePicker.cancels( @CheckResult fun MaterialDatePicker.cancels( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnCancelListener(listener) @@ -128,7 +128,7 @@ fun MaterialDatePicker.cancels(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = DialogInterface.OnCancelListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 be647579..3db1d275 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialDatePicker.dismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -61,7 +61,7 @@ fun MaterialDatePicker.dismisses( */ suspend fun MaterialDatePicker.dismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { dismisses(this, capacity, action) } @@ -85,7 +85,7 @@ suspend fun MaterialDatePicker.dismisses( @CheckResult fun MaterialDatePicker.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnDismissListener(listener) @@ -115,7 +115,7 @@ fun MaterialDatePicker.dismisses(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = DialogInterface.OnDismissListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 c50e90d7..4b0e32de 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialDatePicker.negativeClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -60,7 +60,7 @@ fun MaterialDatePicker.negativeClicks( */ suspend fun MaterialDatePicker.negativeClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { negativeClicks(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun MaterialDatePicker.negativeClicks( @CheckResult fun MaterialDatePicker.negativeClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnNegativeButtonClickListener(listener) @@ -112,7 +112,7 @@ fun MaterialDatePicker.negativeClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 0f139d43..6496fa8c 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialDatePicker.positiveClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (S) -> Unit + action: suspend (S) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (selection in channel) action(selection) @@ -60,7 +60,7 @@ fun MaterialDatePicker.positiveClicks( */ suspend fun MaterialDatePicker.positiveClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend (S) -> Unit + action: suspend (S) -> Unit, ) = coroutineScope { positiveClicks(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun MaterialDatePicker.positiveClicks( @CheckResult fun MaterialDatePicker.positiveClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnPositiveButtonClickListener(listener) @@ -112,7 +112,7 @@ fun MaterialDatePicker.positiveClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (S) -> Unit + emitter: (S) -> Unit, ) = MaterialPickerOnPositiveButtonClickListener { selection -> - if (scope.isActive) { emitter(selection) } + if (scope.isActive) emitter(selection) } 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 5d155a38..648e6c6a 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 @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialTimePicker.cancels( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -68,7 +68,7 @@ fun MaterialTimePicker.cancels( */ suspend fun MaterialTimePicker.cancels( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { cancels(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun MaterialTimePicker.cancels( @CheckResult fun MaterialTimePicker.cancels( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnCancelListener(listener) @@ -128,7 +128,7 @@ fun MaterialTimePicker.cancels(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = DialogInterface.OnCancelListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 4e51e61e..6f687d45 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialTimePicker.dismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -61,7 +61,7 @@ fun MaterialTimePicker.dismisses( */ suspend fun MaterialTimePicker.dismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { dismisses(this, capacity, action) } @@ -85,7 +85,7 @@ suspend fun MaterialTimePicker.dismisses( @CheckResult fun MaterialTimePicker.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnDismissListener(listener) @@ -115,7 +115,7 @@ fun MaterialTimePicker.dismisses(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = DialogInterface.OnDismissListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 c9d4ecb2..4f16e219 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialTimePicker.negativeClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -60,7 +60,7 @@ fun MaterialTimePicker.negativeClicks( */ suspend fun MaterialTimePicker.negativeClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { negativeClicks(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun MaterialTimePicker.negativeClicks( @CheckResult fun MaterialTimePicker.negativeClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnNegativeButtonClickListener(listener) @@ -112,7 +112,7 @@ fun MaterialTimePicker.negativeClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 0b959eed..c614e9af 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun MaterialTimePicker.positiveClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -60,7 +60,7 @@ fun MaterialTimePicker.positiveClicks( */ suspend fun MaterialTimePicker.positiveClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { positiveClicks(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun MaterialTimePicker.positiveClicks( @CheckResult fun MaterialTimePicker.positiveClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnPositiveButtonClickListener(listener) @@ -112,7 +112,7 @@ fun MaterialTimePicker.positiveClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 141e1b10..b0f9b927 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun NavigationBarView.itemReselections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -65,7 +65,7 @@ fun NavigationBarView.itemReselections( */ suspend fun NavigationBarView.itemReselections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { itemReselections(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun NavigationBarView.itemReselections( @CheckResult fun NavigationBarView.itemReselections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnItemReselectedListener(listener(scope, ::trySend)) invokeOnClose { setOnItemReselectedListener(null) } @@ -121,7 +121,7 @@ fun NavigationBarView.itemReselections(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = NavigationBarView.OnItemReselectedListener { - if (scope.isActive) { emitter(it) } + if (scope.isActive) emitter(it) } 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 ea4d3d5c..43e815b2 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun NavigationBarView.itemSelections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -66,7 +66,7 @@ fun NavigationBarView.itemSelections( */ suspend fun NavigationBarView.itemSelections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { itemSelections(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun NavigationBarView.itemSelections( @CheckResult fun NavigationBarView.itemSelections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setInitialValue(this@itemSelections, ::trySend) setOnItemSelectedListener(listener(scope, ::trySend)) @@ -135,7 +135,7 @@ fun NavigationBarView.itemSelections(): Flow = channelFlow { private fun setInitialValue( navigationBarView: NavigationBarView, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) { val menu = navigationBarView.menu for (i in 0 until menu.size()) { @@ -150,8 +150,8 @@ private fun setInitialValue( @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = NavigationBarView.OnItemSelectedListener { - if (scope.isActive) { emitter(it) } + if (scope.isActive) emitter(it) return@OnItemSelectedListener true } 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 42c93e87..ecde3d00 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun NavigationView.itemSelections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -66,7 +66,7 @@ fun NavigationView.itemSelections( */ suspend fun NavigationView.itemSelections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { itemSelections(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun NavigationView.itemSelections( @CheckResult fun NavigationView.itemSelections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setInitialValue(this@itemSelections, ::trySend) setNavigationItemSelectedListener(listener(scope, ::trySend)) @@ -135,7 +135,7 @@ fun NavigationView.itemSelections(): Flow = channelFlow { private fun setInitialValue( navigationView: NavigationView, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) { val menu = navigationView.menu for (i in 0 until menu.size()) { @@ -150,8 +150,8 @@ private fun setInitialValue( @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = NavigationView.OnNavigationItemSelectedListener { - if (scope.isActive) { emitter(it) } + if (scope.isActive) emitter(it) return@OnNavigationItemSelectedListener true } 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 b71a8acc..f68ad482 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun RangeSlider.touches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -59,7 +59,7 @@ fun RangeSlider.touches( */ suspend fun RangeSlider.touches( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { touches(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun RangeSlider.touches( @CheckResult fun RangeSlider.touches( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnSliderTouchListener(listener) @@ -111,13 +111,13 @@ fun RangeSlider.touches(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = object : RangeSlider.OnSliderTouchListener { - override fun onStartTrackingTouch(slider: RangeSlider) { onEvent(true) } - override fun onStopTrackingTouch(slider: RangeSlider) { onEvent(false) } + override fun onStartTrackingTouch(slider: RangeSlider) = onEvent(true) + override fun onStopTrackingTouch(slider: RangeSlider) = onEvent(false) private fun onEvent(event: Boolean) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 5e73288b..bf48537e 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 @@ -38,7 +38,7 @@ data class RangeSliderChangeEvent( val changedSide: RangeSliderSide, val newValues: List, val previousValues: List, - val fromUser: Boolean + val fromUser: Boolean, ) /** @@ -51,7 +51,7 @@ data class RangeSliderChangeEvent( fun RangeSlider.valuesChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RangeSliderChangeEvent) -> Unit + action: suspend (RangeSliderChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -72,7 +72,7 @@ fun RangeSlider.valuesChangeEvents( */ suspend fun RangeSlider.valuesChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RangeSliderChangeEvent) -> Unit + action: suspend (RangeSliderChangeEvent) -> Unit, ) = coroutineScope { valuesChangeEvents(this, capacity, action) } @@ -97,7 +97,7 @@ suspend fun RangeSlider.valuesChangeEvents( @CheckResult fun RangeSlider.valuesChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val event = initialValue(this@valuesChangeEvents).also { trySend(it) } val listener = listener(scope, ::trySend).apply { previousValues = event.previousValues } @@ -141,7 +141,7 @@ private fun initialValue(slider: RangeSlider): RangeSliderChangeEvent = @CheckResult private fun listener( scope: CoroutineScope, - emitter: (RangeSliderChangeEvent) -> Unit + emitter: (RangeSliderChangeEvent) -> Unit, ) = object : RangeSlider.OnChangeListener { var previousValues: List = mutableListOf() @@ -149,10 +149,15 @@ private fun listener( val values = slider.values if (scope.isActive) { val changedSide = - if (previousValues[0] != values[0]) RangeSliderSide.LEFT - else RangeSliderSide.RIGHT + if (previousValues[0] != values[0]) { + RangeSliderSide.LEFT + } else { + RangeSliderSide.RIGHT + } + val event = RangeSliderChangeEvent(slider, changedSide, values, previousValues, fromUser) + previousValues = values emitter(event) } 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 ec8b49dd..46495b68 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun RangeSlider.valuesChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (List) -> Unit + action: suspend (List) -> Unit, ) { val events = scope.actor>(Dispatchers.Main.immediate, capacity) { for (values in channel) action(values) @@ -61,7 +61,7 @@ fun RangeSlider.valuesChanges( */ suspend fun RangeSlider.valuesChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (List) -> Unit + action: suspend (List) -> Unit, ) = coroutineScope { valuesChanges(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun RangeSlider.valuesChanges( @CheckResult fun RangeSlider.valuesChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel> = corbindReceiveChannel(capacity) { trySend(values) val listener = listener(scope, ::trySend) @@ -126,7 +126,7 @@ fun RangeSlider.valuesChanges(): InitialValueFlow> = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (List) -> Unit + emitter: (List) -> Unit, ) = RangeSlider.OnChangeListener { slider, _, _ -> - if (scope.isActive) { emitter(slider.values) } + if (scope.isActive) emitter(slider.values) } diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchBarNavigationClicks.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchBarNavigationClicks.kt index 05b15148..228425ba 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchBarNavigationClicks.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchBarNavigationClicks.kt @@ -47,7 +47,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchBar.navigationClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -69,7 +69,7 @@ fun SearchBar.navigationClicks( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) suspend fun SearchBar.navigationClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { navigationClicks(this, capacity, action) } @@ -96,7 +96,7 @@ suspend fun SearchBar.navigationClicks( @CheckResult fun SearchBar.navigationClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setNavigationOnClickListener(listener(scope, ::trySend)) invokeOnClose { setNavigationOnClickListener(null) } @@ -127,7 +127,7 @@ fun SearchBar.navigationClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChangeEvents.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChangeEvents.kt index 43db0012..585e2e1a 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChangeEvents.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChangeEvents.kt @@ -33,7 +33,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class SearchViewTransitionStateChangeEvent( val view: SearchView, val previousState: SearchView.TransitionState, - val newState: SearchView.TransitionState + val newState: SearchView.TransitionState, ) /** @@ -47,7 +47,7 @@ data class SearchViewTransitionStateChangeEvent( fun SearchView.transitionStateChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchViewTransitionStateChangeEvent) -> Unit + action: suspend (SearchViewTransitionStateChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -68,7 +68,7 @@ fun SearchView.transitionStateChangeEvents( */ suspend fun SearchView.transitionStateChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchViewTransitionStateChangeEvent) -> Unit + action: suspend (SearchViewTransitionStateChangeEvent) -> Unit, ) = coroutineScope { transitionStateChangeEvents(this, capacity, action) } @@ -92,7 +92,7 @@ suspend fun SearchView.transitionStateChangeEvents( @CheckResult fun SearchView.transitionStateChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addTransitionListener(listener) @@ -123,7 +123,7 @@ fun SearchView.transitionStateChangeEvents(): Flow Unit + emitter: (SearchViewTransitionStateChangeEvent) -> Unit, ) = SearchView.TransitionListener { searchView, previousState, newState -> if (scope.isActive) { emitter(SearchViewTransitionStateChangeEvent(searchView, previousState, newState)) diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChanges.kt index c1ac958c..d5253cb5 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SearchViewTransitionStateChanges.kt @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchView.transitionStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchView.TransitionState) -> Unit + action: suspend (SearchView.TransitionState) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -60,7 +60,7 @@ fun SearchView.transitionStateChanges( */ suspend fun SearchView.transitionStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (SearchView.TransitionState) -> Unit + action: suspend (SearchView.TransitionState) -> Unit, ) = coroutineScope { transitionStateChanges(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun SearchView.transitionStateChanges( @CheckResult fun SearchView.transitionStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addTransitionListener(listener) @@ -112,7 +112,7 @@ fun SearchView.transitionStateChanges(): Flow = chan @CheckResult private fun listener( scope: CoroutineScope, - emitter: (SearchView.TransitionState) -> Unit + emitter: (SearchView.TransitionState) -> Unit, ) = SearchView.TransitionListener { _, _, newState -> - if (scope.isActive) { emitter(newState) } + if (scope.isActive) emitter(newState) } diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorSlides.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorSlides.kt index 8fc5b9b4..557da7a4 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorSlides.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorSlides.kt @@ -42,7 +42,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.sideSheetSlides( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (offset in channel) action(offset) @@ -63,7 +63,7 @@ fun View.sideSheetSlides( */ suspend fun View.sideSheetSlides( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) = coroutineScope { sideSheetSlides(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun View.sideSheetSlides( @CheckResult fun View.sideSheetSlides( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getSideSheetBehavior() val callback = callback(scope, ::trySend) @@ -117,11 +117,11 @@ fun View.sideSheetSlides(): Flow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Float) -> Unit + emitter: (Float) -> Unit, ) = object : SideSheetCallback() { override fun onSlide(sheet: View, slideOffset: Float) { - if (scope.isActive) { emitter(slideOffset) } + if (scope.isActive) emitter(slideOffset) } override fun onStateChanged(sheet: View, newState: Int) = Unit diff --git a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorStateChanges.kt b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorStateChanges.kt index 2fd18084..3e31eca5 100644 --- a/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorStateChanges.kt +++ b/corbind-material/src/main/kotlin/ru/ldralighieri/corbind/material/SideSheetBehaviorStateChanges.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.sideSheetStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -66,7 +66,7 @@ fun View.sideSheetStateChanges( */ suspend fun View.sideSheetStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { sideSheetStateChanges(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun View.sideSheetStateChanges( @CheckResult fun View.sideSheetStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getSideSheetBehavior() trySend(behavior.state) @@ -140,11 +140,11 @@ internal fun View.getSideSheetBehavior(): SideSheetBehavior<*> { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : SideSheetCallback() { override fun onStateChanged(sheet: View, newState: Int) { - if (scope.isActive) { emitter(newState) } + if (scope.isActive) emitter(newState) } override fun onSlide(sheet: View, slideOffset: Float) = Unit 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 3eed2a62..cc876e53 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Slider.touches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -59,7 +59,7 @@ fun Slider.touches( */ suspend fun Slider.touches( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { touches(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun Slider.touches( @CheckResult fun Slider.touches( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnSliderTouchListener(listener) @@ -111,13 +111,13 @@ fun Slider.touches(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = object : Slider.OnSliderTouchListener { - override fun onStartTrackingTouch(slider: Slider) { onEvent(true) } - override fun onStopTrackingTouch(slider: Slider) { onEvent(false) } + override fun onStartTrackingTouch(slider: Slider) = onEvent(true) + override fun onStopTrackingTouch(slider: Slider) = onEvent(false) private fun onEvent(event: Boolean) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 f2475b58..1ae03ed5 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 @@ -35,7 +35,7 @@ data class SliderChangeEvent( val view: Slider, val value: Float, val previousValue: Float, - val fromUser: Boolean + val fromUser: Boolean, ) /** @@ -48,7 +48,7 @@ data class SliderChangeEvent( fun Slider.valueChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (SliderChangeEvent) -> Unit + action: suspend (SliderChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -69,7 +69,7 @@ fun Slider.valueChangeEvents( */ suspend fun Slider.valueChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (SliderChangeEvent) -> Unit + action: suspend (SliderChangeEvent) -> Unit, ) = coroutineScope { valueChangeEvents(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun Slider.valueChangeEvents( @CheckResult fun Slider.valueChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val event = initialValue(this@valueChangeEvents).also(::trySend) val listener = listener(scope, ::trySend).apply { previousValue = event.previousValue } @@ -138,11 +138,13 @@ private fun initialValue(slider: Slider): SliderChangeEvent = @CheckResult private fun listener( scope: CoroutineScope, - emitter: (SliderChangeEvent) -> Unit + emitter: (SliderChangeEvent) -> Unit, ) = object : Slider.OnChangeListener { var previousValue: Float = Float.NaN override fun onValueChange(slider: Slider, value: Float, fromUser: Boolean) { - if (scope.isActive) { emitter(SliderChangeEvent(slider, value, previousValue, fromUser)) } + if (scope.isActive) { + emitter(SliderChangeEvent(slider, value, previousValue, fromUser)) + } } } 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 dc0c3924..1dd124cc 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Slider.valueChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (value in channel) action(value) @@ -61,7 +61,7 @@ fun Slider.valueChanges( */ suspend fun Slider.valueChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) = coroutineScope { valueChanges(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun Slider.valueChanges( @CheckResult fun Slider.valueChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(value) val listener = listener(scope, ::trySend) @@ -126,7 +126,7 @@ fun Slider.valueChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Float) -> Unit + emitter: (Float) -> Unit, ) = Slider.OnChangeListener { _, value, _ -> - if (scope.isActive) { emitter(value) } + if (scope.isActive) emitter(value) } 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 40a29cc8..aa1309bb 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Snackbar.dismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -59,7 +59,7 @@ fun Snackbar.dismisses( */ suspend fun Snackbar.dismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { dismisses(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun Snackbar.dismisses( @CheckResult fun Snackbar.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) addCallback(callback) @@ -111,9 +111,9 @@ fun Snackbar.dismisses(): Flow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : Snackbar.Callback() { override fun onDismissed(transientBottomBar: Snackbar, event: Int) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 492db915..d5bffa6e 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Snackbar.shown( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Snackbar) -> Unit + action: suspend (Snackbar) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (snackbar in channel) action(snackbar) @@ -59,7 +59,7 @@ fun Snackbar.shown( */ suspend fun Snackbar.shown( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Snackbar) -> Unit + action: suspend (Snackbar) -> Unit, ) = coroutineScope { shown(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun Snackbar.shown( @CheckResult fun Snackbar.shown( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) addCallback(callback) @@ -111,9 +111,9 @@ fun Snackbar.shown(): Flow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Snackbar) -> Unit + emitter: (Snackbar) -> Unit, ) = object : Snackbar.Callback() { override fun onShown(sb: Snackbar) { - if (scope.isActive) { emitter(sb) } + if (scope.isActive) emitter(sb) } } 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 00639d97..3a277425 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 @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.dismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (View) -> Unit + action: suspend (View) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (view in channel) action(view) @@ -68,7 +68,7 @@ fun View.dismisses( */ suspend fun View.dismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend (View) -> Unit + action: suspend (View) -> Unit, ) = coroutineScope { dismisses(this, capacity, action) } @@ -92,7 +92,7 @@ suspend fun View.dismisses( @CheckResult fun View.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getBehavior(this@dismisses) behavior.listener = listener(scope, ::trySend) @@ -132,11 +132,11 @@ private fun getBehavior(view: View): SwipeDismissBehavior<*> { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (View) -> Unit + emitter: (View) -> Unit, ) = object : SwipeDismissBehavior.OnDismissListener { override fun onDismiss(view: View) { - if (scope.isActive) { emitter(view) } + if (scope.isActive) emitter(view) } override fun onDragStateChanged(state: Int) = Unit 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 4eee045c..dff4b8fb 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 @@ -42,7 +42,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.dragStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -65,7 +65,7 @@ fun View.dragStateChanges( */ suspend fun View.dragStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { dragStateChanges(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun View.dragStateChanges( @CheckResult fun View.dragStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val behavior = getBehavior(this@dragStateChanges) behavior.listener = listener(scope, ::trySend) @@ -131,12 +131,12 @@ private fun getBehavior(view: View): SwipeDismissBehavior<*> { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : SwipeDismissBehavior.OnDismissListener { override fun onDismiss(view: View) = Unit override fun onDragStateChanged(state: Int) { - if (scope.isActive) { emitter(state) } + if (scope.isActive) emitter(state) } } 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 97e0849c..d0107a53 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 @@ -37,17 +37,17 @@ sealed interface TabLayoutSelectionEvent { data class TabLayoutSelectionSelectedEvent( override val view: TabLayout, - override val tab: TabLayout.Tab + override val tab: TabLayout.Tab, ) : TabLayoutSelectionEvent data class TabLayoutSelectionReselectedEvent( override val view: TabLayout, - override val tab: TabLayout.Tab + override val tab: TabLayout.Tab, ) : TabLayoutSelectionEvent data class TabLayoutSelectionUnselectedEvent( override val view: TabLayout, - override val tab: TabLayout.Tab + override val tab: TabLayout.Tab, ) : TabLayoutSelectionEvent /** @@ -61,7 +61,7 @@ data class TabLayoutSelectionUnselectedEvent( fun TabLayout.selectionEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TabLayoutSelectionEvent) -> Unit + action: suspend (TabLayoutSelectionEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -82,7 +82,7 @@ fun TabLayout.selectionEvents( */ suspend fun TabLayout.selectionEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TabLayoutSelectionEvent) -> Unit + action: suspend (TabLayoutSelectionEvent) -> Unit, ) = coroutineScope { selectionEvents(this, capacity, action) } @@ -122,7 +122,7 @@ suspend fun TabLayout.selectionEvents( @CheckResult fun TabLayout.selectionEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setInitialValue(this@selectionEvents, ::trySend) val listener = listener(scope, this@selectionEvents, ::trySend) @@ -176,7 +176,7 @@ fun TabLayout.selectionEvents(): Flow = channelFlow { private fun setInitialValue( tabLayout: TabLayout, - emitter: (TabLayoutSelectionEvent) -> Unit + emitter: (TabLayoutSelectionEvent) -> Unit, ) { val index = tabLayout.selectedTabPosition if (index != -1) { @@ -188,7 +188,7 @@ private fun setInitialValue( private fun listener( scope: CoroutineScope, tabLayout: TabLayout, - emitter: (TabLayoutSelectionEvent) -> Unit + emitter: (TabLayoutSelectionEvent) -> Unit, ) = object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { @@ -204,6 +204,6 @@ private fun listener( } private fun onEvent(event: TabLayoutSelectionEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 9e98073e..6ee4909c 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun TabLayout.selections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TabLayout.Tab) -> Unit + action: suspend (TabLayout.Tab) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (tab in channel) action(tab) @@ -60,7 +60,7 @@ fun TabLayout.selections( */ suspend fun TabLayout.selections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TabLayout.Tab) -> Unit + action: suspend (TabLayout.Tab) -> Unit, ) = coroutineScope { selections(this, capacity, action) } @@ -85,7 +85,7 @@ suspend fun TabLayout.selections( @CheckResult fun TabLayout.selections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setInitialValue(this@selections, ::trySend) val listener = listener(scope, ::trySend) @@ -125,20 +125,20 @@ fun TabLayout.selections(): Flow = channelFlow { private fun setInitialValue( tabLayout: TabLayout, - emitter: (TabLayout.Tab) -> Unit + emitter: (TabLayout.Tab) -> Unit, ) { val index = tabLayout.selectedTabPosition - if (index != -1) { emitter(tabLayout.getTabAt(index)!!) } + if (index != -1) emitter(tabLayout.getTabAt(index)!!) } @CheckResult private fun listener( scope: CoroutineScope, - emitter: (TabLayout.Tab) -> Unit + emitter: (TabLayout.Tab) -> Unit, ) = object : TabLayout.OnTabSelectedListener { override fun onTabSelected(tab: TabLayout.Tab) { - if (scope.isActive) { emitter(tab) } + if (scope.isActive) emitter(tab) } override fun onTabReselected(tab: TabLayout.Tab) = Unit 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 245ea401..92544f0f 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun TextInputLayout.endIconChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (mode in channel) action(mode) @@ -59,7 +59,7 @@ fun TextInputLayout.endIconChanges( */ suspend fun TextInputLayout.endIconChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { endIconChanges(this, capacity, action) } @@ -85,7 +85,7 @@ suspend fun TextInputLayout.endIconChanges( @CheckResult fun TextInputLayout.endIconChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnEndIconChangedListener(listener) @@ -117,7 +117,7 @@ fun TextInputLayout.endIconChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = TextInputLayout.OnEndIconChangedListener { _, previousIcon -> - if (scope.isActive) { emitter(previousIcon) } + if (scope.isActive) emitter(previousIcon) } 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 b9838852..948d03a0 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun TextInputLayout.endIconClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -65,7 +65,7 @@ fun TextInputLayout.endIconClicks( */ suspend fun TextInputLayout.endIconClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { endIconClicks(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun TextInputLayout.endIconClicks( @CheckResult fun TextInputLayout.endIconClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setEndIconOnClickListener(listener(scope, ::trySend)) invokeOnClose { setEndIconOnClickListener(null) } @@ -121,7 +121,7 @@ fun TextInputLayout.endIconClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 bf017ae0..cc037e16 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 @@ -48,7 +48,7 @@ fun TextInputLayout.endIconLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -72,7 +72,7 @@ fun TextInputLayout.endIconLongClicks( suspend fun TextInputLayout.endIconLongClicks( capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { endIconLongClicks(this, capacity, handled, action) } @@ -101,7 +101,7 @@ suspend fun TextInputLayout.endIconLongClicks( fun TextInputLayout.endIconLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setEndIconOnLongClickListener(listener(scope, handled, ::trySend)) invokeOnClose { setEndIconOnLongClickListener(null) } @@ -127,7 +127,7 @@ fun TextInputLayout.endIconLongClicks( */ @CheckResult fun TextInputLayout.endIconLongClicks( - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): Flow = channelFlow { setEndIconOnLongClickListener(listener(this, handled, ::trySend)) awaitClose { setEndIconOnLongClickListener(null) } @@ -137,7 +137,7 @@ fun TextInputLayout.endIconLongClicks( private fun listener( scope: CoroutineScope, handled: () -> Boolean, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnLongClickListener { if (scope.isActive && handled()) { emitter(Unit) 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 f3df80a2..cd879878 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 @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun TextInputLayout.startIconClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -65,7 +65,7 @@ fun TextInputLayout.startIconClicks( */ suspend fun TextInputLayout.startIconClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { startIconClicks(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun TextInputLayout.startIconClicks( @CheckResult fun TextInputLayout.startIconClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setStartIconOnClickListener(listener(scope, ::trySend)) invokeOnClose { setStartIconOnClickListener(null) } @@ -121,7 +121,7 @@ fun TextInputLayout.startIconClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 739f1643..abad7f5b 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 @@ -48,7 +48,7 @@ fun TextInputLayout.startIconLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -72,7 +72,7 @@ fun TextInputLayout.startIconLongClicks( suspend fun TextInputLayout.startIconLongClicks( capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { startIconLongClicks(this, capacity, handled, action) } @@ -101,7 +101,7 @@ suspend fun TextInputLayout.startIconLongClicks( fun TextInputLayout.startIconLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setStartIconOnLongClickListener(listener(scope, handled, ::trySend)) invokeOnClose { setStartIconOnLongClickListener(null) } @@ -127,7 +127,7 @@ fun TextInputLayout.startIconLongClicks( */ @CheckResult fun TextInputLayout.startIconLongClicks( - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): Flow = channelFlow { setStartIconOnLongClickListener(listener(this, handled, ::trySend)) awaitClose { setStartIconOnLongClickListener(null) } @@ -137,7 +137,7 @@ fun TextInputLayout.startIconLongClicks( private fun listener( scope: CoroutineScope, handled: () -> Boolean, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnLongClickListener { if (scope.isActive && handled()) { emitter(Unit) 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 944223c4..c30a2d77 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 @@ -35,7 +35,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class NavControllerOnDestinationChangeEvent( val controller: NavController, val destination: NavDestination, - val arguments: Bundle? + val arguments: Bundle?, ) /** @@ -49,7 +49,7 @@ data class NavControllerOnDestinationChangeEvent( fun NavController.destinationChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (NavControllerOnDestinationChangeEvent) -> Unit + action: suspend (NavControllerOnDestinationChangeEvent) -> Unit, ) { val events = scope .actor(Dispatchers.Main.immediate, capacity) { @@ -70,7 +70,7 @@ fun NavController.destinationChangeEvents( */ suspend fun NavController.destinationChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (NavControllerOnDestinationChangeEvent) -> Unit + action: suspend (NavControllerOnDestinationChangeEvent) -> Unit, ) = coroutineScope { destinationChangeEvents(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun NavController.destinationChangeEvents( @CheckResult fun NavController.destinationChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnDestinationChangedListener(listener) @@ -125,7 +125,7 @@ fun NavController.destinationChangeEvents(): Flow Unit + emitter: (NavControllerOnDestinationChangeEvent) -> Unit, ) = NavController.OnDestinationChangedListener { controller, destination, arguments -> if (scope.isActive) { emitter(NavControllerOnDestinationChangeEvent(controller, destination, arguments)) 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 f06bfc25..91bb5511 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun NavController.destinationChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (NavDestination) -> Unit + action: suspend (NavDestination) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (destination in channel) action(destination) @@ -60,7 +60,7 @@ fun NavController.destinationChanges( */ suspend fun NavController.destinationChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (NavDestination) -> Unit + action: suspend (NavDestination) -> Unit, ) = coroutineScope { destinationChanges(this, capacity, action) } @@ -83,7 +83,7 @@ suspend fun NavController.destinationChanges( @CheckResult fun NavController.destinationChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnDestinationChangedListener(listener) @@ -112,7 +112,7 @@ fun NavController.destinationChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (NavDestination) -> Unit + emitter: (NavDestination) -> Unit, ) = NavController.OnDestinationChangedListener { _, destination, _ -> - if (scope.isActive) { emitter(destination) } + if (scope.isActive) emitter(destination) } 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 08b60a8d..7e64aced 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun > T.dataChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (T) -> Unit + action: suspend (T) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (adapter in channel) action(adapter) @@ -61,7 +61,7 @@ fun > T.dataChanges( */ suspend fun > T.dataChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (T) -> Unit + action: suspend (T) -> Unit, ) = coroutineScope { dataChanges(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun > T.dataChange @CheckResult fun > T.dataChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(this@dataChanges) val dataObserver = observer(scope, this@dataChanges, ::trySend) @@ -128,10 +128,10 @@ fun > T.dataChanges(): Ini private fun > observer( scope: CoroutineScope, adapter: T, - emitter: (T) -> Unit + emitter: (T) -> Unit, ) = object : RecyclerView.AdapterDataObserver() { override fun onChanged() { - if (scope.isActive) { emitter(adapter) } + if (scope.isActive) emitter(adapter) } } 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 f245c603..10801273 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 @@ -38,12 +38,12 @@ sealed interface RecyclerViewChildAttachStateChangeEvent { data class RecyclerViewChildAttachEvent( override val view: RecyclerView, - override val child: View + override val child: View, ) : RecyclerViewChildAttachStateChangeEvent data class RecyclerViewChildDetachEvent( override val view: RecyclerView, - override val child: View + override val child: View, ) : RecyclerViewChildAttachStateChangeEvent /** @@ -57,11 +57,11 @@ data class RecyclerViewChildDetachEvent( fun RecyclerView.childAttachStateChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewChildAttachStateChangeEvent) -> Unit + action: suspend (RecyclerViewChildAttachStateChangeEvent) -> Unit, ) { val events = scope.actor( Dispatchers.Main.immediate, - capacity + capacity, ) { for (event in channel) action(event) } @@ -80,7 +80,7 @@ fun RecyclerView.childAttachStateChangeEvents( */ suspend fun RecyclerView.childAttachStateChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewChildAttachStateChangeEvent) -> Unit + action: suspend (RecyclerViewChildAttachStateChangeEvent) -> Unit, ) = coroutineScope { childAttachStateChangeEvents(this, capacity, action) } @@ -117,7 +117,7 @@ suspend fun RecyclerView.childAttachStateChangeEvents( @CheckResult fun RecyclerView.childAttachStateChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, this@childAttachStateChangeEvents, ::trySend) addOnChildAttachStateChangeListener(listener) @@ -162,7 +162,7 @@ fun RecyclerView.childAttachStateChangeEvents(): Flow Unit + emitter: (RecyclerViewChildAttachStateChangeEvent) -> Unit, ) = object : RecyclerView.OnChildAttachStateChangeListener { override fun onChildViewAttachedToWindow(childView: View) { @@ -174,6 +174,6 @@ private fun listener( } private fun onEvent(event: RecyclerViewChildAttachStateChangeEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 008c4be6..d8875c83 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 @@ -33,7 +33,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class RecyclerViewFlingEvent( val view: RecyclerView, val velocityX: Int, - val velocityY: Int + val velocityY: Int, ) /** @@ -49,7 +49,7 @@ data class RecyclerViewFlingEvent( fun RecyclerView.flingEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewFlingEvent) -> Unit + action: suspend (RecyclerViewFlingEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -71,7 +71,7 @@ fun RecyclerView.flingEvents( */ suspend fun RecyclerView.flingEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewFlingEvent) -> Unit + action: suspend (RecyclerViewFlingEvent) -> Unit, ) = coroutineScope { flingEvents(this, capacity, action) } @@ -97,7 +97,7 @@ suspend fun RecyclerView.flingEvents( @CheckResult fun RecyclerView.flingEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { onFlingListener = listener(scope, this@flingEvents, ::trySend) invokeOnClose { onFlingListener = null } @@ -128,7 +128,7 @@ fun RecyclerView.flingEvents(): Flow = channelFlow { private fun listener( scope: CoroutineScope, recyclerView: RecyclerView, - emitter: (RecyclerViewFlingEvent) -> Unit + emitter: (RecyclerViewFlingEvent) -> Unit, ) = object : RecyclerView.OnFlingListener() { override fun onFling(velocityX: Int, velocityY: Int): Boolean { 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 8fb6895a..51954a8c 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 @@ -33,7 +33,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class RecyclerViewScrollEvent( val view: RecyclerView, val dx: Int, - val dy: Int + val dy: Int, ) /** @@ -46,7 +46,7 @@ data class RecyclerViewScrollEvent( fun RecyclerView.scrollEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewScrollEvent) -> Unit + action: suspend (RecyclerViewScrollEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -66,7 +66,7 @@ fun RecyclerView.scrollEvents( */ suspend fun RecyclerView.scrollEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RecyclerViewScrollEvent) -> Unit + action: suspend (RecyclerViewScrollEvent) -> Unit, ) = coroutineScope { scrollEvents(this, capacity, action) } @@ -89,7 +89,7 @@ suspend fun RecyclerView.scrollEvents( @CheckResult fun RecyclerView.scrollEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val scrollListener = listener(scope, ::trySend) addOnScrollListener(scrollListener) @@ -118,10 +118,10 @@ fun RecyclerView.scrollEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (RecyclerViewScrollEvent) -> Unit + emitter: (RecyclerViewScrollEvent) -> Unit, ) = object : RecyclerView.OnScrollListener() { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { - if (scope.isActive) { emitter(RecyclerViewScrollEvent(recyclerView, dx, dy)) } + if (scope.isActive) emitter(RecyclerViewScrollEvent(recyclerView, dx, dy)) } } 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 42d86b22..9ff12442 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun RecyclerView.scrollStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -59,7 +59,7 @@ fun RecyclerView.scrollStateChanges( */ suspend fun RecyclerView.scrollStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { scrollStateChanges(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun RecyclerView.scrollStateChanges( @CheckResult fun RecyclerView.scrollStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val scrollListener = listener(scope, ::trySend) addOnScrollListener(scrollListener) @@ -111,10 +111,10 @@ fun RecyclerView.scrollStateChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : RecyclerView.OnScrollListener() { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { - if (scope.isActive) { emitter(newState) } + if (scope.isActive) emitter(newState) } } 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 bea2d341..6b13f5cf 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 @@ -42,7 +42,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SlidingPaneLayout.panelOpens( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -66,7 +66,7 @@ fun SlidingPaneLayout.panelOpens( */ suspend fun SlidingPaneLayout.panelOpens( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { panelOpens(this, capacity, action) } @@ -91,7 +91,7 @@ suspend fun SlidingPaneLayout.panelOpens( @CheckResult fun SlidingPaneLayout.panelOpens( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(isOpen) val listener = listener(scope, ::trySend) @@ -131,14 +131,14 @@ fun SlidingPaneLayout.panelOpens(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = object : SlidingPaneLayout.PanelSlideListener { override fun onPanelSlide(panel: View, slideOffset: Float) = Unit - override fun onPanelOpened(panel: View) { onEvent(true) } - override fun onPanelClosed(panel: View) { onEvent(false) } + override fun onPanelOpened(panel: View) = onEvent(true) + override fun onPanelClosed(panel: View) = onEvent(false) private fun onEvent(event: Boolean) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 ef1d75cc..d109049c 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SlidingPaneLayout.panelSlides( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (slide in channel) action(slide) @@ -64,7 +64,7 @@ fun SlidingPaneLayout.panelSlides( */ suspend fun SlidingPaneLayout.panelSlides( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) = coroutineScope { panelSlides(this, capacity, action) } @@ -87,7 +87,7 @@ suspend fun SlidingPaneLayout.panelSlides( @CheckResult fun SlidingPaneLayout.panelSlides( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addPanelSlideListener(listener) @@ -116,11 +116,11 @@ fun SlidingPaneLayout.panelSlides(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Float) -> Unit + emitter: (Float) -> Unit, ) = object : SlidingPaneLayout.PanelSlideListener { override fun onPanelSlide(panel: View, slideOffset: Float) { - if (scope.isActive) { emitter(slideOffset) } + if (scope.isActive) emitter(slideOffset) } override fun onPanelOpened(panel: View) = Unit 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 d3e06294..a20c8606 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 @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SwipeRefreshLayout.refreshes( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -64,7 +64,7 @@ fun SwipeRefreshLayout.refreshes( */ suspend fun SwipeRefreshLayout.refreshes( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { refreshes(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun SwipeRefreshLayout.refreshes( @CheckResult fun SwipeRefreshLayout.refreshes( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnRefreshListener(listener(scope, ::trySend)) invokeOnClose { setOnRefreshListener(null) } @@ -120,7 +120,7 @@ fun SwipeRefreshLayout.refreshes(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = SwipeRefreshLayout.OnRefreshListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 c5aacf72..f82d2542 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 @@ -34,7 +34,7 @@ data class ViewPagerPageScrollEvent( val viewPager: ViewPager, val position: Int, val positionOffset: Float, - val positionOffsetPixels: Int + val positionOffsetPixels: Int, ) /** @@ -47,7 +47,7 @@ data class ViewPagerPageScrollEvent( fun ViewPager.pageScrollEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewPagerPageScrollEvent) -> Unit + action: suspend (ViewPagerPageScrollEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -67,7 +67,7 @@ fun ViewPager.pageScrollEvents( */ suspend fun ViewPager.pageScrollEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewPagerPageScrollEvent) -> Unit + action: suspend (ViewPagerPageScrollEvent) -> Unit, ) = coroutineScope { pageScrollEvents(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun ViewPager.pageScrollEvents( @CheckResult fun ViewPager.pageScrollEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, this@pageScrollEvents, ::trySend) addOnPageChangeListener(listener) @@ -120,7 +120,7 @@ fun ViewPager.pageScrollEvents(): Flow = channelFlow { private fun listener( scope: CoroutineScope, viewPager: ViewPager, - emitter: (ViewPagerPageScrollEvent) -> Unit + emitter: (ViewPagerPageScrollEvent) -> Unit, ) = object : ViewPager.OnPageChangeListener { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { @@ -129,7 +129,7 @@ private fun listener( viewPager = viewPager, position = position, positionOffset = positionOffset, - positionOffsetPixels = positionOffsetPixels + positionOffsetPixels = positionOffsetPixels, ) emitter(event) } 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 308f54a2..09fd7f2f 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun ViewPager.pageScrollStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -59,7 +59,7 @@ fun ViewPager.pageScrollStateChanges( */ suspend fun ViewPager.pageScrollStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { pageScrollStateChanges(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun ViewPager.pageScrollStateChanges( @CheckResult fun ViewPager.pageScrollStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnPageChangeListener(listener) @@ -111,13 +111,13 @@ fun ViewPager.pageScrollStateChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : ViewPager.OnPageChangeListener { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit override fun onPageSelected(position: Int) = Unit override fun onPageScrollStateChanged(state: Int) { - if (scope.isActive) { emitter(state) } + if (scope.isActive) emitter(state) } } 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 bca80757..52d318c0 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun ViewPager.pageSelections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (position in channel) action(position) @@ -61,7 +61,7 @@ fun ViewPager.pageSelections( */ suspend fun ViewPager.pageSelections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { pageSelections(this, capacity, action) } @@ -87,7 +87,7 @@ suspend fun ViewPager.pageSelections( @CheckResult fun ViewPager.pageSelections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(currentItem) val listener = listener(scope, ::trySend) @@ -127,13 +127,13 @@ fun ViewPager.pageSelections(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : ViewPager.OnPageChangeListener { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit override fun onPageSelected(position: Int) { - if (scope.isActive) { emitter(position) } + if (scope.isActive) emitter(position) } override fun onPageScrollStateChanged(state: Int) = Unit 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 c96b0b2b..addeb887 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 @@ -34,7 +34,7 @@ data class ViewPager2PageScrollEvent( val viewPager: ViewPager2, val position: Int, val positionOffset: Float, - val positionOffsetPixels: Int + val positionOffsetPixels: Int, ) /** @@ -47,7 +47,7 @@ data class ViewPager2PageScrollEvent( fun ViewPager2.pageScrollEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewPager2PageScrollEvent) -> Unit + action: suspend (ViewPager2PageScrollEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -67,7 +67,7 @@ fun ViewPager2.pageScrollEvents( */ suspend fun ViewPager2.pageScrollEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewPager2PageScrollEvent) -> Unit + action: suspend (ViewPager2PageScrollEvent) -> Unit, ) = coroutineScope { pageScrollEvents(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun ViewPager2.pageScrollEvents( @CheckResult fun ViewPager2.pageScrollEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, this@pageScrollEvents, ::trySend) registerOnPageChangeCallback(callback) @@ -120,7 +120,7 @@ fun ViewPager2.pageScrollEvents(): Flow = channelFlow private fun callback( scope: CoroutineScope, viewPager: ViewPager2, - emitter: (ViewPager2PageScrollEvent) -> Unit + emitter: (ViewPager2PageScrollEvent) -> Unit, ) = object : ViewPager2.OnPageChangeCallback() { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) { @@ -129,7 +129,7 @@ private fun callback( viewPager = viewPager, position = position, positionOffset = positionOffset, - positionOffsetPixels = positionOffsetPixels + positionOffsetPixels = positionOffsetPixels, ) emitter(event) } 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 f0985843..3b38aa10 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 @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun ViewPager2.pageScrollStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -59,7 +59,7 @@ fun ViewPager2.pageScrollStateChanges( */ suspend fun ViewPager2.pageScrollStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { pageScrollStateChanges(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun ViewPager2.pageScrollStateChanges( @CheckResult fun ViewPager2.pageScrollStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val callback = callback(scope, ::trySend) registerOnPageChangeCallback(callback) @@ -111,13 +111,13 @@ fun ViewPager2.pageScrollStateChanges(): Flow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : ViewPager2.OnPageChangeCallback() { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit override fun onPageSelected(position: Int) = Unit override fun onPageScrollStateChanged(state: Int) { - if (scope.isActive) { emitter(state) } + if (scope.isActive) emitter(state) } } 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 f727b628..8afedfda 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 @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun ViewPager2.pageSelections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (position in channel) action(position) @@ -61,7 +61,7 @@ fun ViewPager2.pageSelections( */ suspend fun ViewPager2.pageSelections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { pageSelections(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun ViewPager2.pageSelections( @CheckResult fun ViewPager2.pageSelections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(currentItem) val callback = callback(scope, ::trySend) @@ -126,13 +126,13 @@ fun ViewPager2.pageSelections(): InitialValueFlow = channelFlow { @CheckResult private fun callback( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : ViewPager2.OnPageChangeCallback() { override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) = Unit override fun onPageSelected(position: Int) { - if (scope.isActive) { emitter(position) } + if (scope.isActive) emitter(position) } override fun onPageScrollStateChanged(state: Int) = Unit 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 1c886cae..71381259 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/app/DatePickerDialogDateSetEvents.kt @@ -37,7 +37,7 @@ data class DatePickerDialogSetEvent( val view: DatePicker, val year: Int, val monthOfYear: Int, - val dayOfMonth: Int + val dayOfMonth: Int, ) /** @@ -54,7 +54,7 @@ data class DatePickerDialogSetEvent( fun DatePickerDialog.dateSetEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (DatePickerDialogSetEvent) -> Unit + action: suspend (DatePickerDialogSetEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -77,7 +77,7 @@ fun DatePickerDialog.dateSetEvents( @RequiresApi(Build.VERSION_CODES.N) suspend fun DatePickerDialog.dateSetEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (DatePickerDialogSetEvent) -> Unit + action: suspend (DatePickerDialogSetEvent) -> Unit, ) = coroutineScope { dateSetEvents(this, capacity, action) } @@ -105,7 +105,7 @@ suspend fun DatePickerDialog.dateSetEvents( @CheckResult fun DatePickerDialog.dateSetEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnDateSetListener(listener(scope, ::trySend)) invokeOnClose { setOnDateSetListener(null) } @@ -136,7 +136,9 @@ fun DatePickerDialog.dateSetEvents(): Flow = channelFl @CheckResult private fun listener( scope: CoroutineScope, - emitter: (DatePickerDialogSetEvent) -> Unit + emitter: (DatePickerDialogSetEvent) -> Unit, ) = DatePickerDialog.OnDateSetListener { view, year, month, dayOfMonth -> - if (scope.isActive) { emitter(DatePickerDialogSetEvent(view, year, month, dayOfMonth)) } + if (scope.isActive) { + emitter(DatePickerDialogSetEvent(view, year, month, dayOfMonth)) + } } 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 3244f83e..d3991bc5 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt @@ -45,7 +45,7 @@ fun Context.receivesBroadcast( scope: CoroutineScope, intentFilter: IntentFilter, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Intent) -> Unit + action: suspend (Intent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (intent in channel) action(intent) @@ -67,7 +67,7 @@ fun Context.receivesBroadcast( suspend fun Context.receivesBroadcast( intentFilter: IntentFilter, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Intent) -> Unit + action: suspend (Intent) -> Unit, ) = coroutineScope { receivesBroadcast(this, intentFilter, capacity, action) } @@ -96,7 +96,7 @@ suspend fun Context.receivesBroadcast( fun Context.receivesBroadcast( scope: CoroutineScope, intentFilter: IntentFilter, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val receiver = receiver(scope, ::trySend) registerReceiver(receiver, intentFilter) @@ -129,10 +129,10 @@ fun Context.receivesBroadcast(intentFilter: IntentFilter): Flow = channe @CheckResult private fun receiver( scope: CoroutineScope, - emitter: (Intent) -> Unit + emitter: (Intent) -> Unit, ) = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { - if (scope.isActive) { emitter(intent) } + if (scope.isActive) emitter(intent) } } diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/CorbindReceiveChannel.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/CorbindReceiveChannel.kt index 0bde7bbe..381baf22 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/CorbindReceiveChannel.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/CorbindReceiveChannel.kt @@ -23,5 +23,5 @@ import kotlinx.coroutines.channels.ReceiveChannel @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) inline fun corbindReceiveChannel( capacity: Int = Channel.RENDEZVOUS, - block: Channel.() -> Unit + block: Channel.() -> Unit, ): ReceiveChannel = Channel(capacity).apply(block) diff --git a/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/InitialValueFlow.kt b/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/InitialValueFlow.kt index 81f61e89..fc835c11 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/InitialValueFlow.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/internal/InitialValueFlow.kt @@ -31,5 +31,5 @@ class InitialValueFlow(private val flow: Flow) : Flow by flow { @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) fun Flow.asInitialValueFlow(value: T): InitialValueFlow = InitialValueFlow( - onStart { emit(value) } + onStart { emit(value) }, ) 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 acb6c1b7..95ae8ed6 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemActionViewEvents.kt @@ -36,11 +36,11 @@ sealed interface MenuItemActionViewEvent { } data class MenuItemActionViewCollapseEvent( - override val menuItem: MenuItem + override val menuItem: MenuItem, ) : MenuItemActionViewEvent data class MenuItemActionViewExpandEvent( - override val menuItem: MenuItem + override val menuItem: MenuItem, ) : MenuItemActionViewEvent /** @@ -59,7 +59,7 @@ fun MenuItem.actionViewEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue, - action: suspend (MenuItemActionViewEvent) -> Unit + action: suspend (MenuItemActionViewEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -84,7 +84,7 @@ fun MenuItem.actionViewEvents( suspend fun MenuItem.actionViewEvents( capacity: Int = Channel.RENDEZVOUS, handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue, - action: suspend (MenuItemActionViewEvent) -> Unit + action: suspend (MenuItemActionViewEvent) -> Unit, ) = coroutineScope { actionViewEvents(this, capacity, handled, action) } @@ -126,7 +126,7 @@ suspend fun MenuItem.actionViewEvents( fun MenuItem.actionViewEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue + handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnActionExpandListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnActionExpandListener(null) } @@ -165,7 +165,7 @@ fun MenuItem.actionViewEvents( */ @CheckResult fun MenuItem.actionViewEvents( - handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue + handled: (MenuItemActionViewEvent) -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnActionExpandListener(listener(this, handled, ::trySend)) awaitClose { setOnActionExpandListener(null) } @@ -175,7 +175,7 @@ fun MenuItem.actionViewEvents( private fun listener( scope: CoroutineScope, handled: (MenuItemActionViewEvent) -> Boolean, - emitter: (MenuItemActionViewEvent) -> Unit + emitter: (MenuItemActionViewEvent) -> Unit, ) = object : MenuItem.OnActionExpandListener { override fun onMenuItemActionExpand(item: MenuItem): Boolean { 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 aa58e6ab..6b8519fa 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/MenuItemClicks.kt @@ -47,7 +47,7 @@ fun MenuItem.clicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (MenuItem) -> Boolean = AlwaysTrue, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -71,7 +71,7 @@ fun MenuItem.clicks( suspend fun MenuItem.clicks( capacity: Int = Channel.RENDEZVOUS, handled: (MenuItem) -> Boolean = AlwaysTrue, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { clicks(this, capacity, handled, action) } @@ -100,7 +100,7 @@ suspend fun MenuItem.clicks( fun MenuItem.clicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (MenuItem) -> Boolean = AlwaysTrue + handled: (MenuItem) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -126,7 +126,7 @@ fun MenuItem.clicks( */ @CheckResult fun MenuItem.clicks( - handled: (MenuItem) -> Boolean = AlwaysTrue + handled: (MenuItem) -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnMenuItemClickListener(listener(this, handled, ::trySend)) awaitClose { setOnMenuItemClickListener(null) } @@ -136,7 +136,7 @@ fun MenuItem.clicks( private fun listener( scope: CoroutineScope, handled: (MenuItem) -> Boolean, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = MenuItem.OnMenuItemClickListener { item -> if (scope.isActive && handled(item)) { emitter(item) 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 1e4aae38..3b70c461 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttachEvents.kt @@ -35,11 +35,11 @@ sealed interface ViewAttachEvent { } data class ViewAttachAttachedEvent( - override val view: View + override val view: View, ) : ViewAttachEvent data class ViewAttachDetachedEvent( - override val view: View + override val view: View, ) : ViewAttachEvent /** @@ -52,7 +52,7 @@ data class ViewAttachDetachedEvent( fun View.attachEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewAttachEvent) -> Unit + action: suspend (ViewAttachEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -72,7 +72,7 @@ fun View.attachEvents( */ suspend fun View.attachEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewAttachEvent) -> Unit + action: suspend (ViewAttachEvent) -> Unit, ) = coroutineScope { attachEvents(this, capacity, action) } @@ -108,7 +108,7 @@ suspend fun View.attachEvents( @CheckResult fun View.attachEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnAttachStateChangeListener(listener) @@ -150,13 +150,13 @@ fun View.attachEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (ViewAttachEvent) -> Unit + emitter: (ViewAttachEvent) -> Unit, ) = object : View.OnAttachStateChangeListener { - override fun onViewAttachedToWindow(v: View) { onEvent(ViewAttachAttachedEvent(v)) } - override fun onViewDetachedFromWindow(v: View) { onEvent(ViewAttachDetachedEvent(v)) } + override fun onViewAttachedToWindow(v: View) = onEvent(ViewAttachAttachedEvent(v)) + override fun onViewDetachedFromWindow(v: View) = onEvent(ViewAttachDetachedEvent(v)) private fun onEvent(event: ViewAttachEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 2de0c9e8..bb07a932 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewAttaches.kt @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.attaches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -59,7 +59,7 @@ fun View.attaches( */ suspend fun View.attaches( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { attaches(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun View.attaches( @CheckResult fun View.attaches( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, true, ::trySend) addOnAttachStateChangeListener(listener) @@ -118,7 +118,7 @@ fun View.attaches(): Flow = channelFlow { fun View.detaches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -137,7 +137,7 @@ fun View.detaches( */ suspend fun View.detaches( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { detaches(this, capacity, action) } @@ -160,7 +160,7 @@ suspend fun View.detaches( @CheckResult fun View.detaches( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, false, ::trySend) addOnAttachStateChangeListener(listener) @@ -190,14 +190,14 @@ fun View.detaches(): Flow = channelFlow { private fun listener( scope: CoroutineScope, callOnAttach: Boolean, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = object : View.OnAttachStateChangeListener { override fun onViewDetachedFromWindow(v: View) { - if (callOnAttach && scope.isActive) { emitter(Unit) } + if (callOnAttach && scope.isActive) emitter(Unit) } override fun onViewAttachedToWindow(v: View) { - if (!callOnAttach && scope.isActive) { emitter(Unit) } + if (!callOnAttach && scope.isActive) emitter(Unit) } } 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 4c7f2a98..8a971cf7 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewClicks.kt @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.clicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -64,7 +64,7 @@ fun View.clicks( */ suspend fun View.clicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { clicks(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun View.clicks( @CheckResult fun View.clicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnClickListener(listener(scope, ::trySend)) invokeOnClose { setOnClickListener(null) } @@ -119,7 +119,7 @@ fun View.clicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 477bedf2..32919479 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewDrags.kt @@ -47,7 +47,7 @@ fun View.drags( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (DragEvent) -> Boolean = AlwaysTrue, - action: suspend (DragEvent) -> Unit + action: suspend (DragEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (drag in channel) action(drag) @@ -70,7 +70,7 @@ fun View.drags( suspend fun View.drags( capacity: Int = Channel.RENDEZVOUS, handled: (DragEvent) -> Boolean = AlwaysTrue, - action: suspend (DragEvent) -> Unit + action: suspend (DragEvent) -> Unit, ) = coroutineScope { drags(this, capacity, handled, action) } @@ -99,7 +99,7 @@ suspend fun View.drags( fun View.drags( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (DragEvent) -> Boolean = AlwaysTrue + handled: (DragEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnDragListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnDragListener(null) } @@ -124,7 +124,7 @@ fun View.drags( */ @CheckResult fun View.drags( - handled: (DragEvent) -> Boolean = AlwaysTrue + handled: (DragEvent) -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnDragListener(listener(this, handled, ::trySend)) awaitClose { setOnDragListener(null) } @@ -134,7 +134,7 @@ fun View.drags( private fun listener( scope: CoroutineScope, handled: (DragEvent) -> Boolean, - emitter: (DragEvent) -> Unit + emitter: (DragEvent) -> Unit, ) = View.OnDragListener { _, dragEvent -> if (scope.isActive && handled(dragEvent)) { emitter(dragEvent) 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 9799f499..683c714f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewFocusChanges.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.focusChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (focus in channel) action(focus) @@ -66,7 +66,7 @@ fun View.focusChanges( */ suspend fun View.focusChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { focusChanges(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun View.focusChanges( @CheckResult fun View.focusChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(hasFocus()) onFocusChangeListener = listener(scope, ::trySend) @@ -135,7 +135,7 @@ fun View.focusChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = View.OnFocusChangeListener { _, hasFocus -> - if (scope.isActive) { emitter(hasFocus) } + if (scope.isActive) emitter(hasFocus) } 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 53764381..89f2851a 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewGroupHierarchyChangeEvents.kt @@ -38,12 +38,12 @@ sealed interface ViewGroupHierarchyChangeEvent { data class ViewGroupHierarchyChildViewAddEvent( override val view: ViewGroup, - override val child: View + override val child: View, ) : ViewGroupHierarchyChangeEvent data class ViewGroupHierarchyChildViewRemoveEvent( override val view: ViewGroup, - override val child: View + override val child: View, ) : ViewGroupHierarchyChangeEvent /** @@ -59,7 +59,7 @@ data class ViewGroupHierarchyChildViewRemoveEvent( fun ViewGroup.changeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewGroupHierarchyChangeEvent) -> Unit + action: suspend (ViewGroupHierarchyChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -81,7 +81,7 @@ fun ViewGroup.changeEvents( */ suspend fun ViewGroup.changeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewGroupHierarchyChangeEvent) -> Unit + action: suspend (ViewGroupHierarchyChangeEvent) -> Unit, ) = coroutineScope { changeEvents(this, capacity, action) } @@ -120,7 +120,7 @@ suspend fun ViewGroup.changeEvents( @CheckResult fun ViewGroup.changeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnHierarchyChangeListener(listener(scope, this@changeEvents, ::trySend)) invokeOnClose { setOnHierarchyChangeListener(null) } @@ -164,18 +164,16 @@ fun ViewGroup.changeEvents(): Flow = channelFlow private fun listener( scope: CoroutineScope, viewGroup: ViewGroup, - emitter: (ViewGroupHierarchyChangeEvent) -> Unit + emitter: (ViewGroupHierarchyChangeEvent) -> Unit, ) = object : ViewGroup.OnHierarchyChangeListener { - override fun onChildViewAdded(parent: View, child: View) { + override fun onChildViewAdded(parent: View, child: View) = onEvent(ViewGroupHierarchyChildViewAddEvent(viewGroup, child)) - } - override fun onChildViewRemoved(parent: View, child: View) { + override fun onChildViewRemoved(parent: View, child: View) = onEvent(ViewGroupHierarchyChildViewRemoveEvent(viewGroup, child)) - } private fun onEvent(event: ViewGroupHierarchyChangeEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 62ebe540..0cece232 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewHovers.kt @@ -48,7 +48,7 @@ fun View.hovers( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (MotionEvent) -> Boolean = AlwaysTrue, - action: suspend (MotionEvent) -> Unit + action: suspend (MotionEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (motion in channel) action(motion) @@ -72,7 +72,7 @@ fun View.hovers( suspend fun View.hovers( capacity: Int = Channel.RENDEZVOUS, handled: (MotionEvent) -> Boolean = AlwaysTrue, - action: suspend (MotionEvent) -> Unit + action: suspend (MotionEvent) -> Unit, ) = coroutineScope { hovers(this, capacity, handled, action) } @@ -101,7 +101,7 @@ suspend fun View.hovers( fun View.hovers( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (MotionEvent) -> Boolean = AlwaysTrue + handled: (MotionEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnHoverListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnHoverListener(null) } @@ -134,7 +134,7 @@ fun View.hovers(handled: (MotionEvent) -> Boolean = AlwaysTrue): Flow Boolean, - emitter: (MotionEvent) -> Unit + emitter: (MotionEvent) -> Unit, ) = View.OnHoverListener { _, motionEvent -> if (scope.isActive && handled(motionEvent)) { emitter(motionEvent) 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 bd91fdfb..f8548fab 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewKeys.kt @@ -47,7 +47,7 @@ fun View.keys( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (KeyEvent) -> Boolean = AlwaysTrue, - action: suspend (KeyEvent) -> Unit + action: suspend (KeyEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (key in channel) action(key) @@ -70,7 +70,7 @@ fun View.keys( suspend fun View.keys( capacity: Int = Channel.RENDEZVOUS, handled: (KeyEvent) -> Boolean = AlwaysTrue, - action: suspend (KeyEvent) -> Unit + action: suspend (KeyEvent) -> Unit, ) = coroutineScope { keys(this, capacity, handled, action) } @@ -99,7 +99,7 @@ suspend fun View.keys( fun View.keys( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (KeyEvent) -> Boolean = AlwaysTrue + handled: (KeyEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnKeyListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnKeyListener(null) } @@ -132,7 +132,7 @@ fun View.keys(handled: (KeyEvent) -> Boolean = AlwaysTrue): Flow = cha private fun listener( scope: CoroutineScope, handled: (KeyEvent) -> Boolean, - emitter: (KeyEvent) -> Unit + emitter: (KeyEvent) -> Unit, ) = View.OnKeyListener { _, _, keyEvent -> if (scope.isActive && handled(keyEvent)) { emitter(keyEvent) 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 628561d5..c080d4d2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChangeEvents.kt @@ -39,7 +39,7 @@ data class ViewLayoutChangeEvent( val oldLeft: Int, val oldTop: Int, val oldRight: Int, - val oldBottom: Int + val oldBottom: Int, ) /** @@ -52,7 +52,7 @@ data class ViewLayoutChangeEvent( fun View.layoutChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewLayoutChangeEvent) -> Unit + action: suspend (ViewLayoutChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -72,7 +72,7 @@ fun View.layoutChangeEvents( */ suspend fun View.layoutChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewLayoutChangeEvent) -> Unit + action: suspend (ViewLayoutChangeEvent) -> Unit, ) = coroutineScope { layoutChangeEvents(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun View.layoutChangeEvents( @CheckResult fun View.layoutChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnLayoutChangeListener(listener) @@ -124,14 +124,21 @@ fun View.layoutChangeEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (ViewLayoutChangeEvent) -> Unit + emitter: (ViewLayoutChangeEvent) -> Unit, ) = View.OnLayoutChangeListener { v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom -> if (scope.isActive) { emitter( ViewLayoutChangeEvent( - v, left, top, right, bottom, oldLeft, oldTop, oldRight, - oldBottom - ) + view = v, + left = left, + top = top, + right = right, + bottom = bottom, + oldLeft = oldLeft, + oldTop = oldTop, + oldRight = oldRight, + oldBottom = oldBottom, + ), ) } } 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 d438f8bf..567bf7f7 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLayoutChanges.kt @@ -40,7 +40,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.layoutChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -59,7 +59,7 @@ fun View.layoutChanges( */ suspend fun View.layoutChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { layoutChanges(this, capacity, action) } @@ -82,7 +82,7 @@ suspend fun View.layoutChanges( @CheckResult fun View.layoutChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) addOnLayoutChangeListener(listener) @@ -109,7 +109,7 @@ fun View.layoutChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnLayoutChangeListener { _, _, _, _, _, _, _, _, _ -> - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 688ee372..9a5598f6 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewLongClicks.kt @@ -47,7 +47,7 @@ fun View.longClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -71,7 +71,7 @@ fun View.longClicks( suspend fun View.longClicks( capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { longClicks(this, capacity, handled, action) } @@ -100,7 +100,7 @@ suspend fun View.longClicks( fun View.longClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnLongClickListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnLongClickListener(null) } @@ -126,7 +126,7 @@ fun View.longClicks( */ @CheckResult fun View.longClicks( - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnLongClickListener(listener(this, handled, ::trySend)) awaitClose { setOnLongClickListener(null) } @@ -136,7 +136,7 @@ fun View.longClicks( private fun listener( scope: CoroutineScope, handled: () -> Boolean, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnLongClickListener { if (scope.isActive && handled()) { emitter(Unit) 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 6faea98f..39eb044f 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewScrollChangeEvents.kt @@ -37,7 +37,7 @@ data class ViewScrollChangeEvent( val scrollX: Int, val scrollY: Int, val oldScrollX: Int, - val oldScrollY: Int + val oldScrollY: Int, ) /** @@ -54,7 +54,7 @@ data class ViewScrollChangeEvent( fun View.scrollChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewScrollChangeEvent) -> Unit + action: suspend (ViewScrollChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -77,7 +77,7 @@ fun View.scrollChangeEvents( @RequiresApi(Build.VERSION_CODES.M) suspend fun View.scrollChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (ViewScrollChangeEvent) -> Unit + action: suspend (ViewScrollChangeEvent) -> Unit, ) = coroutineScope { scrollChangeEvents(this, capacity, action) } @@ -104,7 +104,7 @@ suspend fun View.scrollChangeEvents( @CheckResult fun View.scrollChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnScrollChangeListener(listener(scope, ::trySend)) invokeOnClose { setOnScrollChangeListener(null) } @@ -135,7 +135,7 @@ fun View.scrollChangeEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (ViewScrollChangeEvent) -> Unit + emitter: (ViewScrollChangeEvent) -> Unit, ) = View.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY -> if (scope.isActive) { emitter(ViewScrollChangeEvent(v, scrollX, scrollY, oldScrollX, oldScrollY)) 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 a3a9174e..30613010 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewSystemUiVisibilityChanges.kt @@ -49,13 +49,13 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel "{@link WindowInsets#isVisible(int)} to find out about system bar visibilities", replaceWith = ReplaceWith( expression = "windowInsetsApplyEvents(scope, capacity, action)", - imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"] - ) + imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"], + ), ) fun View.systemUiVisibilityChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (visibility in channel) action(visibility) @@ -83,12 +83,12 @@ fun View.systemUiVisibilityChanges( "{@link WindowInsets#isVisible(int)} to find out about system bar visibilities", replaceWith = ReplaceWith( expression = "windowInsetsApplyEvents(capacity, action)", - imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"] - ) + imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"], + ), ) suspend fun View.systemUiVisibilityChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { systemUiVisibilityChanges(this, capacity, action) } @@ -120,13 +120,13 @@ suspend fun View.systemUiVisibilityChanges( "{@link WindowInsets#isVisible(int)} to find out about system bar visibilities", replaceWith = ReplaceWith( expression = "windowInsetsApplyEvents(scope, capacity)", - imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"] - ) + imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"], + ), ) @CheckResult fun View.systemUiVisibilityChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnSystemUiVisibilityChangeListener(listener(scope, ::trySend)) invokeOnClose { setOnSystemUiVisibilityChangeListener(null) } @@ -156,8 +156,8 @@ fun View.systemUiVisibilityChanges( "{@link WindowInsets#isVisible(int)} to find out about system bar visibilities", replaceWith = ReplaceWith( expression = "windowInsetsApplyEvents()", - imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"] - ) + imports = ["ru.ldralighieri.corbind.view.windowInsetsApplies"], + ), ) @CheckResult fun View.systemUiVisibilityChanges(): Flow = channelFlow { @@ -169,7 +169,7 @@ fun View.systemUiVisibilityChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = View.OnSystemUiVisibilityChangeListener { - if (scope.isActive) { emitter(it) } + if (scope.isActive) emitter(it) } 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 f48eaa41..1940a58b 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTouches.kt @@ -49,7 +49,7 @@ fun View.touches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (MotionEvent) -> Boolean = AlwaysTrue, - action: suspend (MotionEvent) -> Unit + action: suspend (MotionEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (motion in channel) action(motion) @@ -73,7 +73,7 @@ fun View.touches( suspend fun View.touches( capacity: Int = Channel.RENDEZVOUS, handled: (MotionEvent) -> Boolean = AlwaysTrue, - action: suspend (MotionEvent) -> Unit + action: suspend (MotionEvent) -> Unit, ) = coroutineScope { touches(this, capacity, handled, action) } @@ -102,7 +102,7 @@ suspend fun View.touches( fun View.touches( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (MotionEvent) -> Boolean = AlwaysTrue + handled: (MotionEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnTouchListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnTouchListener(null) } @@ -127,7 +127,7 @@ fun View.touches( */ @CheckResult fun View.touches( - handled: (MotionEvent) -> Boolean = AlwaysTrue + handled: (MotionEvent) -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnTouchListener(listener(this, handled, ::trySend)) awaitClose { setOnTouchListener(null) } @@ -138,7 +138,7 @@ fun View.touches( private fun listener( scope: CoroutineScope, handled: (MotionEvent) -> Boolean, - emitter: (MotionEvent) -> Unit + emitter: (MotionEvent) -> Unit, ) = View.OnTouchListener { _, motionEvent -> if (scope.isActive && handled(motionEvent)) { 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 84fc4f62..3ce72177 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverDraws.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.draws( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -64,7 +64,7 @@ fun View.draws( @RequiresApi(Build.VERSION_CODES.JELLY_BEAN) suspend fun View.draws( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { draws(this, capacity, action) } @@ -88,7 +88,7 @@ suspend fun View.draws( @CheckResult fun View.draws( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) viewTreeObserver.addOnDrawListener(listener) @@ -118,7 +118,7 @@ fun View.draws(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = ViewTreeObserver.OnDrawListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 e69b1ed3..9dc920db 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverGlobalLayouts.kt @@ -41,7 +41,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun View.globalLayouts( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -63,7 +63,7 @@ fun View.globalLayouts( */ suspend fun View.globalLayouts( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { globalLayouts(this, capacity, action) } @@ -86,7 +86,7 @@ suspend fun View.globalLayouts( @CheckResult fun View.globalLayouts( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, ::trySend) viewTreeObserver.addOnGlobalLayoutListener(listener) @@ -121,7 +121,7 @@ fun View.globalLayouts(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = ViewTreeObserver.OnGlobalLayoutListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 1671b39b..c13425ee 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewTreeObserverPreDraws.kt @@ -43,7 +43,7 @@ fun View.preDraws( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, proceedDrawingPass: () -> Boolean, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -64,7 +64,7 @@ fun View.preDraws( suspend fun View.preDraws( capacity: Int = Channel.RENDEZVOUS, proceedDrawingPass: () -> Boolean, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { preDraws(this, capacity, proceedDrawingPass, action) } @@ -89,7 +89,7 @@ suspend fun View.preDraws( fun View.preDraws( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - proceedDrawingPass: () -> Boolean + proceedDrawingPass: () -> Boolean, ): ReceiveChannel = corbindReceiveChannel(capacity) { val listener = listener(scope, proceedDrawingPass, ::trySend) viewTreeObserver.addOnPreDrawListener(listener) @@ -112,7 +112,7 @@ fun View.preDraws( */ @CheckResult fun View.preDraws( - proceedDrawingPass: () -> Boolean + proceedDrawingPass: () -> Boolean, ): Flow = channelFlow { val listener = listener(this, proceedDrawingPass, ::trySend) viewTreeObserver.addOnPreDrawListener(listener) @@ -123,7 +123,7 @@ fun View.preDraws( private fun listener( scope: CoroutineScope, proceedDrawingPass: () -> Boolean, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = ViewTreeObserver.OnPreDrawListener { if (scope.isActive) { emitter(Unit) 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 97ede402..15f6281c 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/view/ViewWindowInsetsApplyEvents.kt @@ -35,7 +35,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class WindowInsetsEvent( val view: View, - val insets: WindowInsets + val insets: WindowInsets, ) /** @@ -49,7 +49,7 @@ data class WindowInsetsEvent( fun View.windowInsetsApplyEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (WindowInsetsEvent) -> Unit + action: suspend (WindowInsetsEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (insets in channel) action(insets) @@ -69,7 +69,7 @@ fun View.windowInsetsApplyEvents( @RequiresApi(Build.VERSION_CODES.KITKAT_WATCH) suspend fun View.windowInsetsApplyEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (WindowInsetsEvent) -> Unit + action: suspend (WindowInsetsEvent) -> Unit, ) = coroutineScope { windowInsetsApplyEvents(this, capacity, action) } @@ -93,7 +93,7 @@ suspend fun View.windowInsetsApplyEvents( @CheckResult fun View.windowInsetsApplyEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnApplyWindowInsetsListener(listener(scope, ::trySend)) invokeOnClose { setOnApplyWindowInsetsListener(null) } @@ -137,8 +137,8 @@ fun View.windowInsetsApplyEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (WindowInsetsEvent) -> Unit + emitter: (WindowInsetsEvent) -> Unit, ) = View.OnApplyWindowInsetsListener { v, insets -> - if (scope.isActive) { emitter(WindowInsetsEvent(v, insets)) } + if (scope.isActive) emitter(WindowInsetsEvent(v, insets)) insets } 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 bfa463fa..6bd6d1b6 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AbsListViewScrollEvents.kt @@ -35,7 +35,7 @@ data class AbsListViewScrollEvent( val scrollState: Int, val firstVisibleItem: Int, val visibleItemCount: Int, - val totalItemCount: Int + val totalItemCount: Int, ) /** @@ -51,7 +51,7 @@ data class AbsListViewScrollEvent( fun AbsListView.scrollEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (AbsListViewScrollEvent) -> Unit + action: suspend (AbsListViewScrollEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -73,7 +73,7 @@ fun AbsListView.scrollEvents( */ suspend fun AbsListView.scrollEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (AbsListViewScrollEvent) -> Unit + action: suspend (AbsListViewScrollEvent) -> Unit, ) = coroutineScope { scrollEvents(this, capacity, action) } @@ -99,7 +99,7 @@ suspend fun AbsListView.scrollEvents( @CheckResult fun AbsListView.scrollEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnScrollListener(listener(scope, ::trySend)) invokeOnClose { setOnScrollListener(null) } @@ -129,7 +129,7 @@ fun AbsListView.scrollEvents(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (AbsListViewScrollEvent) -> Unit + emitter: (AbsListViewScrollEvent) -> Unit, ) = object : AbsListView.OnScrollListener { private var currentScrollState = AbsListView.OnScrollListener.SCROLL_STATE_IDLE @@ -142,7 +142,7 @@ private fun listener( scrollState = scrollState, firstVisibleItem = absListView.firstVisiblePosition, visibleItemCount = absListView.childCount, - totalItemCount = absListView.count + totalItemCount = absListView.count, ) emitter(event) } @@ -152,7 +152,7 @@ private fun listener( absListView: AbsListView, firstVisibleItem: Int, visibleItemCount: Int, - totalItemCount: Int + totalItemCount: Int, ) { if (scope.isActive) { val event = AbsListViewScrollEvent( @@ -160,7 +160,7 @@ private fun listener( scrollState = currentScrollState, firstVisibleItem = firstVisibleItem, visibleItemCount = visibleItemCount, - totalItemCount = totalItemCount + totalItemCount = totalItemCount, ) emitter(event) } 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 083f1e58..5e59cd90 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterDataChanges.kt @@ -42,7 +42,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun T.dataChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (T) -> Unit + action: suspend (T) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (adapter in channel) action(adapter) @@ -62,7 +62,7 @@ fun T.dataChanges( */ suspend fun T.dataChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (T) -> Unit + action: suspend (T) -> Unit, ) = coroutineScope { dataChanges(this, capacity, action) } @@ -87,7 +87,7 @@ suspend fun T.dataChanges( @CheckResult fun T.dataChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(this@dataChanges) val dataSetObserver = observer(scope, this@dataChanges, ::trySend) @@ -128,10 +128,10 @@ fun T.dataChanges(): InitialValueFlow = channelFlow { private fun observer( scope: CoroutineScope, adapter: T, - emitter: (T) -> Unit + emitter: (T) -> Unit, ) = object : DataSetObserver() { override fun onChanged() { - if (scope.isActive) { emitter(adapter) } + if (scope.isActive) emitter(adapter) } } 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 cafbd0e5..4b910521 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClickEvents.kt @@ -36,7 +36,7 @@ data class AdapterViewItemClickEvent( val view: AdapterView<*>, val clickedView: View?, val position: Int, - val id: Long + val id: Long, ) /** @@ -52,7 +52,7 @@ data class AdapterViewItemClickEvent( fun AdapterView.itemClickEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewItemClickEvent) -> Unit + action: suspend (AdapterViewItemClickEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -74,7 +74,7 @@ fun AdapterView.itemClickEvents( */ suspend fun AdapterView.itemClickEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewItemClickEvent) -> Unit + action: suspend (AdapterViewItemClickEvent) -> Unit, ) = coroutineScope { itemClickEvents(this, capacity, action) } @@ -100,7 +100,7 @@ suspend fun AdapterView.itemClickEvents( @CheckResult fun AdapterView.itemClickEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { onItemClickListener = listener(scope, ::trySend) invokeOnClose { onItemClickListener = null } @@ -130,7 +130,7 @@ fun AdapterView.itemClickEvents(): Flow Unit + emitter: (AdapterViewItemClickEvent) -> Unit, ) = AdapterView.OnItemClickListener { parent, view: View?, position, id -> if (scope.isActive) { emitter(AdapterViewItemClickEvent(parent, view, position, id)) 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 f2ddc805..c95a02cb 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemClicks.kt @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun AdapterView.itemClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (position in channel) action(position) @@ -66,7 +66,7 @@ fun AdapterView.itemClicks( */ suspend fun AdapterView.itemClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { itemClicks(this, capacity, action) } @@ -92,7 +92,7 @@ suspend fun AdapterView.itemClicks( @CheckResult fun AdapterView.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { onItemClickListener = listener(scope, ::trySend) invokeOnClose { onItemClickListener = null } @@ -122,7 +122,7 @@ fun AdapterView.itemClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = AdapterView.OnItemClickListener { _, _: View?, position, _ -> - if (scope.isActive) { emitter(position) } + if (scope.isActive) emitter(position) } 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 3468d405..e4638eae 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClickEvents.kt @@ -37,7 +37,7 @@ data class AdapterViewItemLongClickEvent( val view: AdapterView<*>, val clickedView: View?, val position: Int, - val id: Long + val id: Long, ) /** @@ -56,7 +56,7 @@ fun AdapterView.itemLongClickEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue, - action: suspend (AdapterViewItemLongClickEvent) -> Unit + action: suspend (AdapterViewItemLongClickEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -81,7 +81,7 @@ fun AdapterView.itemLongClickEvents( suspend fun AdapterView.itemLongClickEvents( capacity: Int = Channel.RENDEZVOUS, handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue, - action: suspend (AdapterViewItemLongClickEvent) -> Unit + action: suspend (AdapterViewItemLongClickEvent) -> Unit, ) = coroutineScope { itemLongClickEvents(this, capacity, handled, action) } @@ -111,7 +111,7 @@ suspend fun AdapterView.itemLongClickEvents( fun AdapterView.itemLongClickEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue + handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { onItemLongClickListener = listener(scope, handled, ::trySend) invokeOnClose { onItemLongClickListener = null } @@ -137,7 +137,7 @@ fun AdapterView.itemLongClickEvents( */ @CheckResult fun AdapterView.itemLongClickEvents( - handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue + handled: (AdapterViewItemLongClickEvent) -> Boolean = AlwaysTrue, ): Flow = channelFlow { onItemLongClickListener = listener(this, handled, ::trySend) awaitClose { onItemLongClickListener = null } @@ -147,7 +147,7 @@ fun AdapterView.itemLongClickEvents( private fun listener( scope: CoroutineScope, handled: (AdapterViewItemLongClickEvent) -> Boolean, - emitter: (AdapterViewItemLongClickEvent) -> Unit + emitter: (AdapterViewItemLongClickEvent) -> Unit, ) = AdapterView.OnItemLongClickListener { parent, view: View?, position, id -> if (scope.isActive) { val event = AdapterViewItemLongClickEvent(parent, view, position, id) 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 dcd60573..36209961 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemLongClicks.kt @@ -49,7 +49,7 @@ fun AdapterView.itemLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (position in channel) action(position) @@ -73,7 +73,7 @@ fun AdapterView.itemLongClicks( suspend fun AdapterView.itemLongClicks( capacity: Int = Channel.RENDEZVOUS, handled: () -> Boolean = AlwaysTrue, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { itemLongClicks(this, capacity, handled, action) } @@ -102,7 +102,7 @@ suspend fun AdapterView.itemLongClicks( fun AdapterView.itemLongClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { onItemLongClickListener = listener(scope, handled, ::trySend) invokeOnClose { onItemLongClickListener = null } @@ -128,7 +128,7 @@ fun AdapterView.itemLongClicks( */ @CheckResult fun AdapterView.itemLongClicks( - handled: () -> Boolean = AlwaysTrue + handled: () -> Boolean = AlwaysTrue, ): Flow = channelFlow { onItemLongClickListener = listener(this, handled, ::trySend) awaitClose { onItemLongClickListener = null } @@ -138,7 +138,7 @@ fun AdapterView.itemLongClicks( private fun listener( scope: CoroutineScope, handled: () -> Boolean, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = AdapterView.OnItemLongClickListener { _, _: View?, position, _ -> if (scope.isActive && handled()) { emitter(position) 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 01f21415..58a8c0b5 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewItemSelections.kt @@ -46,7 +46,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun AdapterView.itemSelections( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (position in channel) action(position) @@ -68,7 +68,7 @@ fun AdapterView.itemSelections( */ suspend fun AdapterView.itemSelections( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { itemSelections(this, capacity, action) } @@ -97,7 +97,7 @@ suspend fun AdapterView.itemSelections( @CheckResult fun AdapterView.itemSelections( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(selectedItemPosition) onItemSelectedListener = listener(scope, ::trySend) @@ -139,16 +139,16 @@ fun AdapterView.itemSelections(): InitialValueFlow = chann @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) { onEvent(position) } - override fun onNothingSelected(parent: AdapterView<*>) { onEvent(AdapterView.INVALID_POSITION) } + override fun onNothingSelected(parent: AdapterView<*>) = onEvent(AdapterView.INVALID_POSITION) private fun onEvent(position: Int) { - if (scope.isActive) { emitter(position) } + if (scope.isActive) emitter(position) } } 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 6425f344..30ab996b 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AdapterViewSelectionEvents.kt @@ -41,11 +41,11 @@ data class AdapterViewItemSelectionEvent( override val view: AdapterView<*>, val selectedView: View?, val position: Int, - val id: Long + val id: Long, ) : AdapterViewSelectionEvent data class AdapterViewNothingSelectionEvent( - override val view: AdapterView<*> + override val view: AdapterView<*>, ) : AdapterViewSelectionEvent /** @@ -61,7 +61,7 @@ data class AdapterViewNothingSelectionEvent( fun AdapterView.selectionEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewSelectionEvent) -> Unit + action: suspend (AdapterViewSelectionEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -84,7 +84,7 @@ fun AdapterView.selectionEvents( */ suspend fun AdapterView.selectionEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewSelectionEvent) -> Unit + action: suspend (AdapterViewSelectionEvent) -> Unit, ) = coroutineScope { selectionEvents(this, capacity, action) } @@ -125,7 +125,7 @@ suspend fun AdapterView.selectionEvents( @CheckResult fun AdapterView.selectionEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@selectionEvents)) onItemSelectedListener = listener(scope, ::trySend) @@ -185,7 +185,7 @@ private fun initialValue(adapterView: AdapterView): AdapterView view = adapterView, selectedView = adapterView.selectedView, position = adapterView.selectedItemPosition, - id = adapterView.selectedItemId + id = adapterView.selectedItemId, ) } } @@ -193,7 +193,7 @@ private fun initialValue(adapterView: AdapterView): AdapterView @CheckResult private fun listener( scope: CoroutineScope, - emitter: (AdapterViewSelectionEvent) -> Unit + emitter: (AdapterViewSelectionEvent) -> Unit, ) = object : AdapterView.OnItemSelectedListener { override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) { @@ -205,6 +205,6 @@ private fun listener( } private fun onEvent(event: AdapterViewSelectionEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 c91c1f49..651529db 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewDismisses.kt @@ -46,7 +46,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun AutoCompleteTextView.dismisses( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -68,7 +68,7 @@ fun AutoCompleteTextView.dismisses( @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1) suspend fun AutoCompleteTextView.dismisses( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { dismisses(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun AutoCompleteTextView.dismisses( @CheckResult fun AutoCompleteTextView.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnDismissListener(listener(scope, ::trySend)) invokeOnClose { setOnDismissListener(null) } @@ -126,7 +126,7 @@ fun AutoCompleteTextView.dismisses(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = AutoCompleteTextView.OnDismissListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } 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 dba35ea2..2afeaba4 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/AutoCompleteTextViewItemClickEvents.kt @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun AutoCompleteTextView.itemClickEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewItemClickEvent) -> Unit + action: suspend (AdapterViewItemClickEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -67,7 +67,7 @@ fun AutoCompleteTextView.itemClickEvents( */ suspend fun AutoCompleteTextView.itemClickEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (AdapterViewItemClickEvent) -> Unit + action: suspend (AdapterViewItemClickEvent) -> Unit, ) = coroutineScope { itemClickEvents(this, capacity, action) } @@ -93,7 +93,7 @@ suspend fun AutoCompleteTextView.itemClickEvents( @CheckResult fun AutoCompleteTextView.itemClickEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { onItemClickListener = listener(scope, ::trySend) invokeOnClose { onItemClickListener = null } @@ -123,7 +123,7 @@ fun AutoCompleteTextView.itemClickEvents(): Flow = ch @CheckResult private fun listener( scope: CoroutineScope, - emitter: (AdapterViewItemClickEvent) -> Unit + emitter: (AdapterViewItemClickEvent) -> Unit, ) = AdapterView.OnItemClickListener { parent, view: View?, position, id -> if (scope.isActive) { emitter(AdapterViewItemClickEvent(parent, view, position, id)) 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 b21f5ee0..ff35c01a 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CalendarViewDateChangeEvents.kt @@ -36,7 +36,7 @@ data class CalendarViewDateChangeEvent( val view: CalendarView, val year: Int, val month: Int, - val dayOfMonth: Int + val dayOfMonth: Int, ) /** @@ -52,7 +52,7 @@ data class CalendarViewDateChangeEvent( fun CalendarView.dateChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (CalendarViewDateChangeEvent) -> Unit + action: suspend (CalendarViewDateChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -75,7 +75,7 @@ fun CalendarView.dateChangeEvents( */ suspend fun CalendarView.dateChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (CalendarViewDateChangeEvent) -> Unit + action: suspend (CalendarViewDateChangeEvent) -> Unit, ) = coroutineScope { dateChangeEvents(this, capacity, action) } @@ -104,7 +104,7 @@ suspend fun CalendarView.dateChangeEvents( @CheckResult fun CalendarView.dateChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@dateChangeEvents)) setOnDateChangeListener(listener(scope, ::trySend)) @@ -154,7 +154,9 @@ private fun initialValue(calendar: CalendarView): CalendarViewDateChangeEvent = @CheckResult private fun listener( scope: CoroutineScope, - emitter: (CalendarViewDateChangeEvent) -> Unit + emitter: (CalendarViewDateChangeEvent) -> Unit, ) = CalendarView.OnDateChangeListener { view, year, month, dayOfMonth -> - if (scope.isActive) { emitter(CalendarViewDateChangeEvent(view, year, month, dayOfMonth)) } + if (scope.isActive) { + emitter(CalendarViewDateChangeEvent(view, year, month, dayOfMonth)) + } } 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 8e8af51d..820e17de 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/CompoundButtonCheckedChanges.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun CompoundButton.checkedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (checked in channel) action(checked) @@ -66,7 +66,7 @@ fun CompoundButton.checkedChanges( */ suspend fun CompoundButton.checkedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Boolean) -> Unit + action: suspend (Boolean) -> Unit, ) = coroutineScope { checkedChanges(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun CompoundButton.checkedChanges( @CheckResult fun CompoundButton.checkedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(isChecked) setOnCheckedChangeListener(listener(scope, ::trySend)) @@ -135,7 +135,7 @@ fun CompoundButton.checkedChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Boolean) -> Unit + emitter: (Boolean) -> Unit, ) = CompoundButton.OnCheckedChangeListener { _, isChecked -> - if (scope.isActive) { emitter(isChecked) } + if (scope.isActive) emitter(isChecked) } 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 90c39342..70f025a2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/DatePickerChangedEvents.kt @@ -37,7 +37,7 @@ data class DateChangedEvent( val view: DatePicker, val year: Int, val monthOfYear: Int, - val dayOfMonth: Int + val dayOfMonth: Int, ) /** @@ -54,7 +54,7 @@ data class DateChangedEvent( fun DatePicker.dateChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (DateChangedEvent) -> Unit + action: suspend (DateChangedEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -78,7 +78,7 @@ fun DatePicker.dateChangeEvents( @RequiresApi(Build.VERSION_CODES.O) suspend fun DatePicker.dateChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (DateChangedEvent) -> Unit + action: suspend (DateChangedEvent) -> Unit, ) = coroutineScope { dateChangeEvents(this, capacity, action) } @@ -107,7 +107,7 @@ suspend fun DatePicker.dateChangeEvents( @CheckResult fun DatePicker.dateChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(DateChangedEvent(this@dateChangeEvents, year, month, dayOfMonth)) setOnDateChangedListener(listener(scope, ::trySend)) @@ -149,7 +149,9 @@ fun DatePicker.dateChangeEvents(): InitialValueFlow = channelF @CheckResult private fun listener( scope: CoroutineScope, - emitter: (DateChangedEvent) -> Unit + emitter: (DateChangedEvent) -> Unit, ) = DatePicker.OnDateChangedListener { view, year, monthOfYear, dayOfMonth -> - if (scope.isActive) { emitter(DateChangedEvent(view, year, monthOfYear, dayOfMonth)) } + if (scope.isActive) { + emitter(DateChangedEvent(view, year, monthOfYear, dayOfMonth)) + } } 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 f1524b34..6585d8a3 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerScrollStateChanges.kt @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun NumberPicker.scrollStateChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (state in channel) action(state) @@ -73,7 +73,7 @@ fun NumberPicker.scrollStateChanges( */ suspend fun NumberPicker.scrollStateChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { scrollStateChanges(this, capacity, action) } @@ -90,7 +90,7 @@ suspend fun NumberPicker.scrollStateChanges( @CheckResult fun NumberPicker.scrollStateChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnScrollListener(listener(scope, ::trySend)) invokeOnClose { setOnScrollListener(null) } @@ -120,7 +120,7 @@ fun NumberPicker.scrollStateChanges(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = NumberPicker.OnScrollListener { _, scrollState -> - if (scope.isActive) { emitter(scrollState) } + if (scope.isActive) emitter(scrollState) } 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 6ffe1d75..773f805d 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/NumberPickerValueChangeEvents.kt @@ -34,7 +34,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class NumberPickerValueChangeEvent( val picker: NumberPicker, val oldVal: Int, - val newVal: Int + val newVal: Int, ) /** @@ -50,7 +50,7 @@ data class NumberPickerValueChangeEvent( fun NumberPicker.valueChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (NumberPickerValueChangeEvent) -> Unit + action: suspend (NumberPickerValueChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -73,7 +73,7 @@ fun NumberPicker.valueChangeEvents( */ suspend fun NumberPicker.valueChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (NumberPickerValueChangeEvent) -> Unit + action: suspend (NumberPickerValueChangeEvent) -> Unit, ) = coroutineScope { valueChangeEvents(this, capacity, action) } @@ -102,7 +102,7 @@ suspend fun NumberPicker.valueChangeEvents( @CheckResult fun NumberPicker.valueChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(NumberPickerValueChangeEvent(this@valueChangeEvents, value, value)) setOnValueChangedListener(listener(scope, ::trySend)) @@ -144,7 +144,9 @@ fun NumberPicker.valueChangeEvents(): InitialValueFlow Unit + emitter: (NumberPickerValueChangeEvent) -> Unit, ) = NumberPicker.OnValueChangeListener { picker, oldVal, newVal -> - if (scope.isActive) { emitter(NumberPickerValueChangeEvent(picker, oldVal, newVal)); } + if (scope.isActive) { + emitter(NumberPickerValueChangeEvent(picker, oldVal, newVal)) + } } 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 0ef37aa4..a5c42abc 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuDismisses.kt @@ -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(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -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) } @@ -90,7 +90,7 @@ suspend fun PopupMenu.dismisses( @CheckResult fun PopupMenu.dismisses( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnDismissListener(listener(scope, ::trySend)) invokeOnClose { setOnDismissListener(null) } @@ -120,7 +120,7 @@ fun PopupMenu.dismisses(): Flow = 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) } 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 42434283..ba7233d6 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/PopupMenuItemClicks.kt @@ -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(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -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) } @@ -91,7 +91,7 @@ suspend fun PopupMenu.itemClicks( @CheckResult fun PopupMenu.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -121,7 +121,7 @@ fun PopupMenu.itemClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = PopupMenu.OnMenuItemClickListener { if (scope.isActive) { emitter(it) 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 0faa015f..3e064b3a 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RadioGroupCheckedChanges.kt @@ -45,7 +45,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun RadioGroup.checkedChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (checkedId in channel) action(checkedId) @@ -67,7 +67,7 @@ fun RadioGroup.checkedChanges( */ suspend fun RadioGroup.checkedChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { checkedChanges(this, capacity, action) } @@ -96,7 +96,7 @@ suspend fun RadioGroup.checkedChanges( @CheckResult fun RadioGroup.checkedChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(checkedRadioButtonId) setOnCheckedChangeListener(listener(scope, ::trySend)) @@ -138,7 +138,7 @@ fun RadioGroup.checkedChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : RadioGroup.OnCheckedChangeListener { private var lastChecked = View.NO_ID 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 08a5bf0b..be2a464d 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChangeEvents.kt @@ -34,7 +34,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class RatingBarChangeEvent( val view: RatingBar, val rating: Float, - val fromUser: Boolean + val fromUser: Boolean, ) /** @@ -50,7 +50,7 @@ data class RatingBarChangeEvent( fun RatingBar.ratingChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (RatingBarChangeEvent) -> Unit + action: suspend (RatingBarChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -73,7 +73,7 @@ fun RatingBar.ratingChangeEvents( */ suspend fun RatingBar.ratingChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (RatingBarChangeEvent) -> Unit + action: suspend (RatingBarChangeEvent) -> Unit, ) = coroutineScope { ratingChangeEvents(this, capacity, action) } @@ -101,7 +101,7 @@ suspend fun RatingBar.ratingChangeEvents( @CheckResult fun RatingBar.ratingChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@ratingChangeEvents)) onRatingBarChangeListener = listener(scope, ::trySend) @@ -146,7 +146,9 @@ private fun initialValue(ratingBar: RatingBar): RatingBarChangeEvent = @CheckResult private fun listener( scope: CoroutineScope, - emitter: (RatingBarChangeEvent) -> Unit + emitter: (RatingBarChangeEvent) -> Unit, ) = RatingBar.OnRatingBarChangeListener { ratingBar, rating, fromUser -> - if (scope.isActive) { emitter(RatingBarChangeEvent(ratingBar, rating, fromUser)) } + if (scope.isActive) { + emitter(RatingBarChangeEvent(ratingBar, rating, fromUser)) + } } 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 9e99bc2f..68375720 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/RatingBarRatingChanges.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun RatingBar.ratingChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (rating in channel) action(rating) @@ -66,7 +66,7 @@ fun RatingBar.ratingChanges( */ suspend fun RatingBar.ratingChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Float) -> Unit + action: suspend (Float) -> Unit, ) = coroutineScope { ratingChanges(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun RatingBar.ratingChanges( @CheckResult fun RatingBar.ratingChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(rating) onRatingBarChangeListener = listener(scope, ::trySend) @@ -135,7 +135,7 @@ fun RatingBar.ratingChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Float) -> Unit + emitter: (Float) -> Unit, ) = RatingBar.OnRatingBarChangeListener { _, rating, _ -> - if (scope.isActive) { emitter(rating) } + if (scope.isActive) emitter(rating) } 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 fc0a5cd0..6473fac6 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChangeEvents.kt @@ -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, ) /** @@ -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(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -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) } @@ -101,7 +101,7 @@ suspend fun SearchView.queryTextChangeEvents( @CheckResult fun SearchView.queryTextChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@queryTextChangeEvents)) setOnQueryTextListener(listener(scope, this@queryTextChangeEvents, ::trySend)) @@ -147,7 +147,7 @@ private fun initialValue(searchView: SearchView): SearchViewQueryTextEvent = private fun listener( scope: CoroutineScope, searchView: SearchView, - emitter: (SearchViewQueryTextEvent) -> Unit + emitter: (SearchViewQueryTextEvent) -> Unit, ) = object : SearchView.OnQueryTextListener { override fun onQueryTextChange(s: String): Boolean { 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 7a07e692..7212d90a 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SearchViewQueryTextChanges.kt @@ -44,7 +44,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun SearchView.queryTextChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (chars in channel) action(chars) @@ -67,7 +67,7 @@ fun SearchView.queryTextChanges( */ suspend fun SearchView.queryTextChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) = coroutineScope { queryTextChanges(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun SearchView.queryTextChanges( @CheckResult fun SearchView.queryTextChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(query) setOnQueryTextListener(listener(scope, ::trySend)) @@ -136,7 +136,7 @@ fun SearchView.queryTextChanges(): InitialValueFlow = channelFlow @CheckResult private fun listener( scope: CoroutineScope, - emitter: (CharSequence) -> Unit + emitter: (CharSequence) -> Unit, ) = object : SearchView.OnQueryTextListener { override fun onQueryTextChange(s: String): Boolean { 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 45d76473..ea016d27 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChangeEvents.kt @@ -38,15 +38,15 @@ sealed interface SeekBarChangeEvent { data class SeekBarProgressChangeEvent( override val view: SeekBar, val progress: Int, - val fromUser: Boolean + val fromUser: Boolean, ) : SeekBarChangeEvent data class SeekBarStartChangeEvent( - override val view: SeekBar + override val view: SeekBar, ) : SeekBarChangeEvent data class SeekBarStopChangeEvent( - override val view: SeekBar + override val view: SeekBar, ) : SeekBarChangeEvent /** @@ -62,7 +62,7 @@ data class SeekBarStopChangeEvent( fun SeekBar.changeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (SeekBarChangeEvent) -> Unit + action: suspend (SeekBarChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -85,7 +85,7 @@ fun SeekBar.changeEvents( */ suspend fun SeekBar.changeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (SeekBarChangeEvent) -> Unit + action: suspend (SeekBarChangeEvent) -> Unit, ) = coroutineScope { changeEvents(this, capacity, action) } @@ -127,7 +127,7 @@ suspend fun SeekBar.changeEvents( @CheckResult fun SeekBar.changeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@changeEvents)) setOnSeekBarChangeListener(listener(scope, ::trySend)) @@ -185,7 +185,7 @@ private fun initialValue(seekBar: SeekBar): SeekBarChangeEvent = @CheckResult private fun listener( scope: CoroutineScope, - emitter: (SeekBarChangeEvent) -> Unit + emitter: (SeekBarChangeEvent) -> Unit, ) = object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { @@ -201,6 +201,6 @@ private fun listener( } private fun onEvent(event: SeekBarChangeEvent) { - if (scope.isActive) { emitter(event) } + if (scope.isActive) emitter(event) } } 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 8d60c753..12822428 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/SeekBarChanges.kt @@ -35,7 +35,7 @@ private fun SeekBar.changes( scope: CoroutineScope, capacity: Int, shouldBeFromUser: Boolean?, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (progress in channel) action(progress) @@ -49,7 +49,7 @@ private fun SeekBar.changes( private suspend fun SeekBar.changes( capacity: Int, shouldBeFromUser: Boolean?, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { changes(this, capacity, shouldBeFromUser, action) } @@ -58,7 +58,7 @@ private suspend fun SeekBar.changes( private fun SeekBar.changes( scope: CoroutineScope, capacity: Int, - shouldBeFromUser: Boolean? + shouldBeFromUser: Boolean?, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(progress) setOnSeekBarChangeListener(listener(scope, shouldBeFromUser, ::trySend)) @@ -84,7 +84,7 @@ private fun SeekBar.changes(shouldBeFromUser: Boolean?): InitialValueFlow = fun SeekBar.changes( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(scope, capacity, null, action) /** @@ -98,7 +98,7 @@ fun SeekBar.changes( */ suspend fun SeekBar.changes( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(capacity, null, action) /** @@ -124,7 +124,7 @@ suspend fun SeekBar.changes( @CheckResult fun SeekBar.changes( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = changes(scope, capacity, null) /** @@ -168,7 +168,7 @@ fun SeekBar.changes(): InitialValueFlow = changes(null) fun SeekBar.userChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(scope, capacity, true, action) /** @@ -183,7 +183,7 @@ fun SeekBar.userChanges( */ suspend fun SeekBar.userChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(capacity, true, action) /** @@ -209,7 +209,7 @@ suspend fun SeekBar.userChanges( @CheckResult fun SeekBar.userChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = changes(scope, capacity, true) /** @@ -253,7 +253,7 @@ fun SeekBar.userChanges(): InitialValueFlow = changes(true) fun SeekBar.systemChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(scope, capacity, false, action) /** @@ -268,7 +268,7 @@ fun SeekBar.systemChanges( */ suspend fun SeekBar.systemChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = changes(capacity, false, action) /** @@ -294,7 +294,7 @@ suspend fun SeekBar.systemChanges( @CheckResult fun SeekBar.systemChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = changes(scope, capacity, false) /** @@ -329,7 +329,7 @@ fun SeekBar.systemChanges(): InitialValueFlow = changes(false) private fun listener( scope: CoroutineScope, shouldBeFromUser: Boolean?, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = object : SeekBar.OnSeekBarChangeListener { override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) { 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 27282997..9148eeb2 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewAfterTextChangeEvents.kt @@ -35,7 +35,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class TextViewAfterTextChangeEvent( val view: TextView, - val editable: Editable? + val editable: Editable?, ) /** @@ -48,7 +48,7 @@ data class TextViewAfterTextChangeEvent( fun TextView.afterTextChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewAfterTextChangeEvent) -> Unit + action: suspend (TextViewAfterTextChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -69,7 +69,7 @@ fun TextView.afterTextChangeEvents( */ suspend fun TextView.afterTextChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewAfterTextChangeEvent) -> Unit + action: suspend (TextViewAfterTextChangeEvent) -> Unit, ) = coroutineScope { afterTextChangeEvents(this, capacity, action) } @@ -94,7 +94,7 @@ suspend fun TextView.afterTextChangeEvents( @CheckResult fun TextView.afterTextChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@afterTextChangeEvents)) val listener = listener(scope, this@afterTextChangeEvents, ::trySend) @@ -139,13 +139,15 @@ private fun initialValue(textView: TextView): TextViewAfterTextChangeEvent = private fun listener( scope: CoroutineScope, textView: TextView, - emitter: (TextViewAfterTextChangeEvent) -> Unit + emitter: (TextViewAfterTextChangeEvent) -> Unit, ) = object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) = Unit override fun afterTextChanged(s: Editable) { - if (scope.isActive) { emitter(TextViewAfterTextChangeEvent(textView, s)) } + if (scope.isActive) { + emitter(TextViewAfterTextChangeEvent(textView, s)) + } } } 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 91421908..873afe8e 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewBeforeTextChangeEvents.kt @@ -38,7 +38,7 @@ data class TextViewBeforeTextChangeEvent( val text: CharSequence, val start: Int, val count: Int, - val after: Int + val after: Int, ) /** @@ -51,7 +51,7 @@ data class TextViewBeforeTextChangeEvent( fun TextView.beforeTextChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewBeforeTextChangeEvent) -> Unit + action: suspend (TextViewBeforeTextChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -72,7 +72,7 @@ fun TextView.beforeTextChangeEvents( */ suspend fun TextView.beforeTextChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewBeforeTextChangeEvent) -> Unit + action: suspend (TextViewBeforeTextChangeEvent) -> Unit, ) = coroutineScope { beforeTextChangeEvents(this, capacity, action) } @@ -95,7 +95,7 @@ suspend fun TextView.beforeTextChangeEvents( @CheckResult fun TextView.beforeTextChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@beforeTextChangeEvents)) val listener = listener(scope, this@beforeTextChangeEvents, ::trySend) @@ -141,7 +141,7 @@ private fun initialValue(textView: TextView): TextViewBeforeTextChangeEvent = private fun listener( scope: CoroutineScope, textView: TextView, - emitter: (TextViewBeforeTextChangeEvent) -> Unit + emitter: (TextViewBeforeTextChangeEvent) -> Unit, ) = object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) { 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 eb9a7896..55f58756 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActionEvents.kt @@ -35,7 +35,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class TextViewEditorActionEvent( val view: TextView, val actionId: Int, - val keyEvent: KeyEvent? + val keyEvent: KeyEvent?, ) /** @@ -54,7 +54,7 @@ fun TextView.editorActionEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue, - action: suspend (TextViewEditorActionEvent) -> Unit + action: suspend (TextViewEditorActionEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -79,7 +79,7 @@ fun TextView.editorActionEvents( suspend fun TextView.editorActionEvents( capacity: Int = Channel.RENDEZVOUS, handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue, - action: suspend (TextViewEditorActionEvent) -> Unit + action: suspend (TextViewEditorActionEvent) -> Unit, ) = coroutineScope { editorActionEvents(this, capacity, handled, action) } @@ -108,7 +108,7 @@ suspend fun TextView.editorActionEvents( fun TextView.editorActionEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue + handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnEditorActionListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnEditorActionListener(null) } @@ -134,7 +134,7 @@ fun TextView.editorActionEvents( */ @CheckResult fun TextView.editorActionEvents( - handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue + handled: (TextViewEditorActionEvent) -> Boolean = AlwaysTrue, ): Flow = channelFlow { setOnEditorActionListener(listener(this, handled, ::trySend)) awaitClose { setOnEditorActionListener(null) } @@ -144,7 +144,7 @@ fun TextView.editorActionEvents( private fun listener( scope: CoroutineScope, handled: (TextViewEditorActionEvent) -> Boolean, - emitter: (TextViewEditorActionEvent) -> Unit + emitter: (TextViewEditorActionEvent) -> Unit, ) = TextView.OnEditorActionListener { v, actionId, keyEvent -> if (scope.isActive) { val event = TextViewEditorActionEvent(v, actionId, keyEvent) 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 c2d274f2..677b5233 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewEditorActions.kt @@ -47,7 +47,7 @@ fun TextView.editorActions( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, handled: (Int) -> Boolean = AlwaysTrue, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (actionId in channel) action(actionId) @@ -71,7 +71,7 @@ fun TextView.editorActions( suspend fun TextView.editorActions( capacity: Int = Channel.RENDEZVOUS, handled: (Int) -> Boolean = AlwaysTrue, - action: suspend (Int) -> Unit + action: suspend (Int) -> Unit, ) = coroutineScope { editorActions(this, capacity, handled, action) } @@ -100,7 +100,7 @@ suspend fun TextView.editorActions( fun TextView.editorActions( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - handled: (Int) -> Boolean = AlwaysTrue + handled: (Int) -> Boolean = AlwaysTrue, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnEditorActionListener(listener(scope, handled, ::trySend)) invokeOnClose { setOnEditorActionListener(null) } @@ -134,7 +134,7 @@ fun TextView.editorActions(handled: (Int) -> Boolean = AlwaysTrue): Flow = private fun listener( scope: CoroutineScope, handled: (Int) -> Boolean, - emitter: (Int) -> Unit + emitter: (Int) -> Unit, ) = TextView.OnEditorActionListener { _, actionId, _ -> if (scope.isActive && handled(actionId)) { emitter(actionId) 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 b7ee106f..1da6cc9c 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChangeEvents.kt @@ -38,7 +38,7 @@ data class TextViewTextChangeEvent( val text: CharSequence, val start: Int, val before: Int, - val count: Int + val count: Int, ) /** @@ -51,7 +51,7 @@ data class TextViewTextChangeEvent( fun TextView.textChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewTextChangeEvent) -> Unit + action: suspend (TextViewTextChangeEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -72,7 +72,7 @@ fun TextView.textChangeEvents( */ suspend fun TextView.textChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TextViewTextChangeEvent) -> Unit + action: suspend (TextViewTextChangeEvent) -> Unit, ) = coroutineScope { textChangeEvents(this, capacity, action) } @@ -97,7 +97,7 @@ suspend fun TextView.textChangeEvents( @CheckResult fun TextView.textChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(initialValue(this@textChangeEvents)) val listener = listener(scope, this@textChangeEvents, ::trySend) @@ -142,7 +142,7 @@ private fun initialValue(textView: TextView): TextViewTextChangeEvent = private fun listener( scope: CoroutineScope, textView: TextView, - emitter: (TextViewTextChangeEvent) -> Unit + emitter: (TextViewTextChangeEvent) -> Unit, ) = object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit 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 c45905be..5bdb2af5 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TextViewTextChanges.kt @@ -43,7 +43,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun TextView.textChanges( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (chars in channel) action(chars) @@ -64,7 +64,7 @@ fun TextView.textChanges( */ suspend fun TextView.textChanges( capacity: Int = Channel.RENDEZVOUS, - action: suspend (CharSequence) -> Unit + action: suspend (CharSequence) -> Unit, ) = coroutineScope { textChanges(this, capacity, action) } @@ -89,7 +89,7 @@ suspend fun TextView.textChanges( @CheckResult fun TextView.textChanges( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(text) val listener = listener(scope, ::trySend) @@ -129,13 +129,13 @@ fun TextView.textChanges(): InitialValueFlow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (CharSequence) -> Unit + emitter: (CharSequence) -> Unit, ) = object : TextWatcher { override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) = Unit override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { - if (scope.isActive) { emitter(s) } + if (scope.isActive) emitter(s) } override fun afterTextChanged(s: Editable) = Unit 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 300194aa..d51dba5b 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/TimePickerChangedEvents.kt @@ -36,7 +36,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel data class TimeChangedEvent( val view: TimePicker, val hourOfDay: Int, - val minute: Int + val minute: Int, ) /** @@ -53,7 +53,7 @@ data class TimeChangedEvent( fun TimePicker.timeChangeEvents( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (TimeChangedEvent) -> Unit + action: suspend (TimeChangedEvent) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (event in channel) action(event) @@ -77,7 +77,7 @@ fun TimePicker.timeChangeEvents( @RequiresApi(Build.VERSION_CODES.M) suspend fun TimePicker.timeChangeEvents( capacity: Int = Channel.RENDEZVOUS, - action: suspend (TimeChangedEvent) -> Unit + action: suspend (TimeChangedEvent) -> Unit, ) = coroutineScope { timeChangeEvents(this, capacity, action) } @@ -106,7 +106,7 @@ suspend fun TimePicker.timeChangeEvents( @CheckResult fun TimePicker.timeChangeEvents( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { trySend(TimeChangedEvent(this@timeChangeEvents, hour, minute)) setOnTimeChangedListener(listener(scope, ::trySend)) @@ -148,7 +148,9 @@ fun TimePicker.timeChangeEvents(): InitialValueFlow = channelF @CheckResult private fun listener( scope: CoroutineScope, - emitter: (TimeChangedEvent) -> Unit + emitter: (TimeChangedEvent) -> Unit, ) = TimePicker.OnTimeChangedListener { view, hourOfDay, minute -> - if (scope.isActive) { emitter(TimeChangedEvent(view, hourOfDay, minute)) } + if (scope.isActive) { + emitter(TimeChangedEvent(view, hourOfDay, minute)) + } } 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 e67047e2..ccf82699 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarItemClicks.kt @@ -47,7 +47,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Toolbar.itemClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (item in channel) action(item) @@ -69,7 +69,7 @@ fun Toolbar.itemClicks( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) suspend fun Toolbar.itemClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend (MenuItem) -> Unit + action: suspend (MenuItem) -> Unit, ) = coroutineScope { itemClicks(this, capacity, action) } @@ -96,7 +96,7 @@ suspend fun Toolbar.itemClicks( @CheckResult fun Toolbar.itemClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setOnMenuItemClickListener(listener(scope, ::trySend)) invokeOnClose { setOnMenuItemClickListener(null) } @@ -127,7 +127,7 @@ fun Toolbar.itemClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (MenuItem) -> Unit + emitter: (MenuItem) -> Unit, ) = Toolbar.OnMenuItemClickListener { if (scope.isActive) { emitter(it) 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 f5fc78aa..6d62c251 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/widget/ToolbarNavigationClicks.kt @@ -47,7 +47,7 @@ import ru.ldralighieri.corbind.internal.corbindReceiveChannel fun Toolbar.navigationClicks( scope: CoroutineScope, capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) { val events = scope.actor(Dispatchers.Main.immediate, capacity) { for (ignored in channel) action() @@ -69,7 +69,7 @@ fun Toolbar.navigationClicks( @RequiresApi(Build.VERSION_CODES.LOLLIPOP) suspend fun Toolbar.navigationClicks( capacity: Int = Channel.RENDEZVOUS, - action: suspend () -> Unit + action: suspend () -> Unit, ) = coroutineScope { navigationClicks(this, capacity, action) } @@ -96,7 +96,7 @@ suspend fun Toolbar.navigationClicks( @CheckResult fun Toolbar.navigationClicks( scope: CoroutineScope, - capacity: Int = Channel.RENDEZVOUS + capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { setNavigationOnClickListener(listener(scope, ::trySend)) invokeOnClose { setNavigationOnClickListener(null) } @@ -127,7 +127,7 @@ fun Toolbar.navigationClicks(): Flow = channelFlow { @CheckResult private fun listener( scope: CoroutineScope, - emitter: (Unit) -> Unit + emitter: (Unit) -> Unit, ) = View.OnClickListener { - if (scope.isActive) { emitter(Unit) } + if (scope.isActive) emitter(Unit) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c2ef8d98..c6ecf835 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,7 +2,7 @@ # Plugins agp = "8.4.0" dokka = "1.9.20" -spotless = "6.18.0" +spotless = "6.25.0" mavenPublish = "0.28.0" bcv = "0.14.0" gver = "0.50.0" @@ -32,7 +32,7 @@ androidxConstraintlayout = "2.1.4" material = "1.11.0" # Lint -ktlint = "0.46.1" +ktlint = "1.2.1" [libraries] From 040a10e44626d19697ab6f1b5077d84c789bf9e3 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:09:02 +0300 Subject: [PATCH 04/13] Added flag for registerReceiver method --- .../content/ContextReceivesBroadcast.kt | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) 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 d3991bc5..60a82851 100644 --- a/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt +++ b/corbind/src/main/kotlin/ru/ldralighieri/corbind/content/ContextReceivesBroadcast.kt @@ -14,12 +14,15 @@ * limitations under the License. */ +@file:SuppressWarnings("UnspecifiedRegisterReceiverFlag") + package ru.ldralighieri.corbind.content import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter +import android.os.Build import androidx.annotation.CheckResult import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers @@ -52,7 +55,13 @@ fun Context.receivesBroadcast( } val receiver = receiver(scope, events::trySend) - registerReceiver(receiver, intentFilter) + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + registerReceiver(receiver, intentFilter) + } else { + registerReceiver(receiver, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } + events.invokeOnClose { unregisterReceiver(receiver) } } @@ -99,7 +108,13 @@ fun Context.receivesBroadcast( capacity: Int = Channel.RENDEZVOUS, ): ReceiveChannel = corbindReceiveChannel(capacity) { val receiver = receiver(scope, ::trySend) - registerReceiver(receiver, intentFilter) + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + registerReceiver(receiver, intentFilter) + } else { + registerReceiver(receiver, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } + invokeOnClose { unregisterReceiver(receiver) } } @@ -122,7 +137,13 @@ fun Context.receivesBroadcast( */ fun Context.receivesBroadcast(intentFilter: IntentFilter): Flow = channelFlow { val receiver = receiver(this, ::trySend) - registerReceiver(receiver, intentFilter) + + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) { + registerReceiver(receiver, intentFilter) + } else { + registerReceiver(receiver, intentFilter, Context.RECEIVER_NOT_EXPORTED) + } + awaitClose { unregisterReceiver(receiver) } } From b8a5b372bcb7c6eed4471e50a20700ae5a86e915 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:34:59 +0300 Subject: [PATCH 05/13] Update kotlin to v1.9.23 --- corbind-leanback/src/main/AndroidManifest.xml | 5 ++++- gradle/libs.versions.toml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/corbind-leanback/src/main/AndroidManifest.xml b/corbind-leanback/src/main/AndroidManifest.xml index edf10ff3..ece334a6 100644 --- a/corbind-leanback/src/main/AndroidManifest.xml +++ b/corbind-leanback/src/main/AndroidManifest.xml @@ -15,4 +15,7 @@ --> + tools:ignore="ImpliedTouchscreenHardware,MissingLeanbackLauncher,MissingLeanbackSupport"> + + + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c6ecf835..9745c4a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,7 @@ bcv = "0.14.0" gver = "0.50.0" # Kotlin -kotlin = "1.9.21" +kotlin = "1.9.23" kotlinCoroutines = "1.7.3" # Androidx From f625b1ed69a7577c5d41a07bc44b8a9da53cbca2 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:38:44 +0300 Subject: [PATCH 06/13] Update coroutines to v1.8.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9745c4a8..d1992983 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,7 +9,7 @@ gver = "0.50.0" # Kotlin kotlin = "1.9.23" -kotlinCoroutines = "1.7.3" +kotlinCoroutines = "1.8.0" # Androidx androidxCore = "1.12.0" From 79ae9c284dc5b849049bbee78b46d54e4b663243 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:39:40 +0300 Subject: [PATCH 07/13] Update androidx core to v1.13.1 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d1992983..cc4375c3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ kotlin = "1.9.23" kotlinCoroutines = "1.8.0" # Androidx -androidxCore = "1.12.0" +androidxCore = "1.13.1" androidxAnnotation = "1.7.1" androidxAppcompat = "1.6.1" androidxDrawerlayout = "1.2.0" From 328b9ef2b72f93aaeae4f4dd7949941d36047360 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:40:14 +0300 Subject: [PATCH 08/13] Update navigation to v2.7.7 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cc4375c3..1a611eff 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ androidxAnnotation = "1.7.1" androidxAppcompat = "1.6.1" androidxDrawerlayout = "1.2.0" androidxLeanback = "1.0.0" -androidxNavigation = "2.7.6" +androidxNavigation = "2.7.7" androidxRecyclerview = "1.3.2" androidxSlidingpanelayout = "1.2.0" androidxSwiperefreshlayout = "1.1.0" From 21b15108907704a59ea58efa9fc10aa05fb1da64 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:42:39 +0300 Subject: [PATCH 09/13] Update lifecycle to v2.7.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1a611eff..a6301d87 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,7 @@ androidxSlidingpanelayout = "1.2.0" androidxSwiperefreshlayout = "1.1.0" androidxViewpager = "1.0.0" androidxViewpager2 = "1.0.0" -androidxLifecycle = "2.6.2" +androidxLifecycle = "2.7.0" androidxActivity = "1.8.2" androidxFragment = "1.6.2" androidxConstraintlayout = "2.1.4" From e972cfc3345a4cd1afd59e35d22c3f4cbecce1be Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:46:28 +0300 Subject: [PATCH 10/13] Bump minSdk to 19 --- corbind-leanback/src/main/AndroidManifest.xml | 5 +---- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/corbind-leanback/src/main/AndroidManifest.xml b/corbind-leanback/src/main/AndroidManifest.xml index ece334a6..edf10ff3 100644 --- a/corbind-leanback/src/main/AndroidManifest.xml +++ b/corbind-leanback/src/main/AndroidManifest.xml @@ -15,7 +15,4 @@ --> - - - + tools:ignore="ImpliedTouchscreenHardware,MissingLeanbackLauncher,MissingLeanbackSupport" /> diff --git a/gradle.properties b/gradle.properties index 20deb94f..8347f0de 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,7 +34,7 @@ android.useAndroidX=true buildTools=34.0.0 compileSdk=34 targetSdk=34 -minSdk=14 +minSdk=19 # Build features android.defaults.buildfeatures.resvalues=false From d4898b1051e12750daed5e0807cd12880d628854 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:47:25 +0300 Subject: [PATCH 11/13] Update activity to v1.9.0 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a6301d87..0a3bfb1c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ androidxSwiperefreshlayout = "1.1.0" androidxViewpager = "1.0.0" androidxViewpager2 = "1.0.0" androidxLifecycle = "2.7.0" -androidxActivity = "1.8.2" +androidxActivity = "1.9.0" androidxFragment = "1.6.2" androidxConstraintlayout = "2.1.4" From e2c901689934fc1fd0eddcf819503961799245b4 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Fri, 3 May 2024 22:48:24 +0300 Subject: [PATCH 12/13] Update material to v1.12.0 --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0a3bfb1c..cc8b7bff 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ dokka = "1.9.20" spotless = "6.25.0" mavenPublish = "0.28.0" bcv = "0.14.0" -gver = "0.50.0" +gver = "0.51.0" # Kotlin kotlin = "1.9.23" @@ -25,11 +25,11 @@ androidxViewpager = "1.0.0" androidxViewpager2 = "1.0.0" androidxLifecycle = "2.7.0" androidxActivity = "1.9.0" -androidxFragment = "1.6.2" +androidxFragment = "1.7.0" androidxConstraintlayout = "2.1.4" # Google -material = "1.11.0" +material = "1.12.0" # Lint ktlint = "1.2.1" From d91f2094b50908617f69632e641c4cb2a40035e4 Mon Sep 17 00:00:00 2001 From: Vladimir Raupov Date: Sat, 4 May 2024 16:55:15 +0300 Subject: [PATCH 13/13] Updated README.md of each module and CHANGELOG.md for version 1.11.0 --- CHANGELOG.md | 8 ++++++++ README.md | 12 ++++++------ corbind-activity/README.md | 2 +- corbind-appcompat/README.md | 2 +- corbind-bom/README.md | 2 +- corbind-bom/gradle.properties | 2 +- corbind-core/README.md | 2 +- corbind-drawerlayout/README.md | 2 +- corbind-fragment/README.md | 2 +- corbind-leanback/README.md | 2 +- corbind-lifecycle/README.md | 2 +- corbind-material/README.md | 2 +- corbind-navigation/README.md | 2 +- corbind-recyclerview/README.md | 2 +- corbind-slidingpanelayout/README.md | 2 +- corbind-swiperefreshlayout/README.md | 2 +- corbind-viewpager/README.md | 2 +- corbind-viewpager2/README.md | 2 +- corbind/README.md | 2 +- gradle.properties | 2 +- 20 files changed, 32 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d37858e1..61b3cb8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 1cffcc6c..0742a7bb 100644 --- a/README.md +++ b/README.md @@ -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) @@ -54,7 +54,7 @@ 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") } ``` @@ -62,7 +62,7 @@ dependencies { 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") @@ -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") } ``` diff --git a/corbind-activity/README.md b/corbind-activity/README.md index 474cec55..0923e498 100644 --- a/corbind-activity/README.md +++ b/corbind-activity/README.md @@ -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") } ``` diff --git a/corbind-appcompat/README.md b/corbind-appcompat/README.md index cfbce978..6aa26a57 100644 --- a/corbind-appcompat/README.md +++ b/corbind-appcompat/README.md @@ -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") } ``` diff --git a/corbind-bom/README.md b/corbind-bom/README.md index a5b939a5..47b3de52 100644 --- a/corbind-bom/README.md +++ b/corbind-bom/README.md @@ -5,6 +5,6 @@ Corbind Libraries BOM (Bills of Materials). ```kotlin dependencies { - implementation(platform("ru.ldralighieri.corbind:corbind-bom:2023.12.00")) + implementation(platform("ru.ldralighieri.corbind:corbind-bom:2024.01.00")) } ``` diff --git a/corbind-bom/gradle.properties b/corbind-bom/gradle.properties index 3493d0f2..726f040a 100644 --- a/corbind-bom/gradle.properties +++ b/corbind-bom/gradle.properties @@ -15,7 +15,7 @@ # -VERSION_NAME=2024.01.00-SNAPSHOT +VERSION_NAME=2024.01.00 POM_ARTIFACT_ID=corbind-bom POM_NAME=Corbind Libraries BOM diff --git a/corbind-core/README.md b/corbind-core/README.md index aed50b6e..34866af4 100644 --- a/corbind-core/README.md +++ b/corbind-core/README.md @@ -5,7 +5,7 @@ To add androidx core bindings, import `corbind-core` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-core:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-core:1.11.0") } ``` diff --git a/corbind-drawerlayout/README.md b/corbind-drawerlayout/README.md index dd3262f0..29d0a4ba 100644 --- a/corbind-drawerlayout/README.md +++ b/corbind-drawerlayout/README.md @@ -5,7 +5,7 @@ To add androidx drawerlayout bindings, import `corbind-drawerlayout` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-drawerlayout:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-drawerlayout:1.11.0") } ``` diff --git a/corbind-fragment/README.md b/corbind-fragment/README.md index 8eb17a87..2169ddd6 100644 --- a/corbind-fragment/README.md +++ b/corbind-fragment/README.md @@ -5,7 +5,7 @@ To add androidx fragment bindings, import `corbind-fragment` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-fragment:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-fragment:1.11.0") } ``` diff --git a/corbind-leanback/README.md b/corbind-leanback/README.md index fdc4908f..76bd811d 100644 --- a/corbind-leanback/README.md +++ b/corbind-leanback/README.md @@ -5,7 +5,7 @@ To add androidx leanback bindings, import `corbind-leanback` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-leanback:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-leanback:1.11.0") } ``` diff --git a/corbind-lifecycle/README.md b/corbind-lifecycle/README.md index 0aaee744..c0b802aa 100644 --- a/corbind-lifecycle/README.md +++ b/corbind-lifecycle/README.md @@ -5,7 +5,7 @@ To add androidx lifecycle bindings, import `corbind-lifecycle` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-lifecycle:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-lifecycle:1.11.0") } ``` diff --git a/corbind-material/README.md b/corbind-material/README.md index 9c0f3ff9..2b5eab8c 100644 --- a/corbind-material/README.md +++ b/corbind-material/README.md @@ -5,7 +5,7 @@ To add material bindings, import `corbind-material` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-material:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-material:1.11.0") } ``` diff --git a/corbind-navigation/README.md b/corbind-navigation/README.md index 83685af8..f1bacce9 100644 --- a/corbind-navigation/README.md +++ b/corbind-navigation/README.md @@ -5,7 +5,7 @@ To add androidx navigation bindings, import `corbind-navigation` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-navigation:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-navigation:1.11.0") } ``` diff --git a/corbind-recyclerview/README.md b/corbind-recyclerview/README.md index f2798bdc..03e6889e 100644 --- a/corbind-recyclerview/README.md +++ b/corbind-recyclerview/README.md @@ -5,7 +5,7 @@ To add androidx recyclerview bindings, import `corbind-recyclerview` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-recyclerview:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-recyclerview:1.11.0") } ``` diff --git a/corbind-slidingpanelayout/README.md b/corbind-slidingpanelayout/README.md index 07141150..83065af1 100644 --- a/corbind-slidingpanelayout/README.md +++ b/corbind-slidingpanelayout/README.md @@ -5,7 +5,7 @@ To add androidx slidingpanelayout bindings, import `corbind-slidingpanelayout` m ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-slidingpanelayout:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-slidingpanelayout:1.11.0") } ``` diff --git a/corbind-swiperefreshlayout/README.md b/corbind-swiperefreshlayout/README.md index a29e9e99..46ba73b5 100644 --- a/corbind-swiperefreshlayout/README.md +++ b/corbind-swiperefreshlayout/README.md @@ -5,7 +5,7 @@ To add androidx swiperefreshlayout bindings, import `corbind-swiperefreshlayout` ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-swiperefreshlayout:1.11.0") } ``` diff --git a/corbind-viewpager/README.md b/corbind-viewpager/README.md index fd84881a..c5dad1fc 100644 --- a/corbind-viewpager/README.md +++ b/corbind-viewpager/README.md @@ -5,7 +5,7 @@ To add androidx viewpager bindings, import `corbind-viewpager` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-viewpager:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-viewpager:1.11.0") } ``` diff --git a/corbind-viewpager2/README.md b/corbind-viewpager2/README.md index 023a7d84..b8237777 100644 --- a/corbind-viewpager2/README.md +++ b/corbind-viewpager2/README.md @@ -5,7 +5,7 @@ To add androidx viewpager2 bindings, import `corbind-viewpager2` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind-viewpager2:1.10.0") + implementation("ru.ldralighieri.corbind:corbind-viewpager2:1.11.0") } ``` diff --git a/corbind/README.md b/corbind/README.md index e191f455..d3cf58b4 100644 --- a/corbind/README.md +++ b/corbind/README.md @@ -5,7 +5,7 @@ To add platform bindings, import `corbind` module: ```kotlin dependencies { - implementation("ru.ldralighieri.corbind:corbind:1.10.0") + implementation("ru.ldralighieri.corbind:corbind:1.11.0") } ``` diff --git a/gradle.properties b/gradle.properties index 8347f0de..f399bfa9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000 # Maven GROUP=ru.ldralighieri.corbind -VERSION_NAME=1.11.0-SNAPSHOT +VERSION_NAME=1.11.0 POM_DESCRIPTION=Kotlin Coroutines binding APIs for Android UI widgets.