From 8081019ba88e7305b4d55ce49e6c505c3d915560 Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Sun, 18 Aug 2024 18:44:05 +0300 Subject: [PATCH] Renamed PredictiveBackParams#animatableSelector parameter to animatable --- .../api/android/extensions-compose-experimental.api | 2 +- .../api/extensions-compose-experimental.klib.api | 4 ++-- .../api/jvm/extensions-compose-experimental.api | 2 +- .../experimental/stack/animation/DefaultStackAnimation.kt | 2 +- .../experimental/stack/animation/PredictiveBackParams.kt | 7 +++---- .../compose/experimental/stack/ChildStackTest.kt | 2 +- .../stack/animation/PredictiveBackGestureTest.kt | 2 +- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/extensions-compose-experimental/api/android/extensions-compose-experimental.api b/extensions-compose-experimental/api/android/extensions-compose-experimental.api index e15fd6aca..28971a08d 100644 --- a/extensions-compose-experimental/api/android/extensions-compose-experimental.api +++ b/extensions-compose-experimental/api/android/extensions-compose-experimental.api @@ -12,7 +12,7 @@ public final class com/arkivanov/decompose/extensions/compose/experimental/stack public static final field $stable I public fun (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)V public synthetic fun (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getAnimatableSelector ()Lkotlin/jvm/functions/Function1; + public final fun getAnimatable ()Lkotlin/jvm/functions/Function1; public final fun getBackHandler ()Lcom/arkivanov/essenty/backhandler/BackHandler; public final fun getOnBack ()Lkotlin/jvm/functions/Function0; } diff --git a/extensions-compose-experimental/api/extensions-compose-experimental.klib.api b/extensions-compose-experimental/api/extensions-compose-experimental.klib.api index 102a42c47..17b79dc39 100644 --- a/extensions-compose-experimental/api/extensions-compose-experimental.klib.api +++ b/extensions-compose-experimental/api/extensions-compose-experimental.klib.api @@ -21,8 +21,8 @@ abstract interface com.arkivanov.decompose.extensions.compose.experimental.stack final class <#A: in kotlin/Any, #B: in kotlin/Any> com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams { // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams|null[0] constructor (com.arkivanov.essenty.backhandler/BackHandler, kotlin/Function0, kotlin/Function1 = ...) // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.|(com.arkivanov.essenty.backhandler.BackHandler;kotlin.Function0;kotlin.Function1){}[0] - final val animatableSelector // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatableSelector|{}animatableSelector[0] - final fun (): kotlin/Function1 // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatableSelector.|(){}[0] + final val animatable // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatable|{}animatable[0] + final fun (): kotlin/Function1 // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatable.|(){}[0] final val backHandler // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.backHandler|{}backHandler[0] final fun (): com.arkivanov.essenty.backhandler/BackHandler // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.backHandler.|(){}[0] final val onBack // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.onBack|{}onBack[0] diff --git a/extensions-compose-experimental/api/jvm/extensions-compose-experimental.api b/extensions-compose-experimental/api/jvm/extensions-compose-experimental.api index e15fd6aca..28971a08d 100644 --- a/extensions-compose-experimental/api/jvm/extensions-compose-experimental.api +++ b/extensions-compose-experimental/api/jvm/extensions-compose-experimental.api @@ -12,7 +12,7 @@ public final class com/arkivanov/decompose/extensions/compose/experimental/stack public static final field $stable I public fun (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)V public synthetic fun (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun getAnimatableSelector ()Lkotlin/jvm/functions/Function1; + public final fun getAnimatable ()Lkotlin/jvm/functions/Function1; public final fun getBackHandler ()Lcom/arkivanov/essenty/backhandler/BackHandler; public final fun getOnBack ()Lkotlin/jvm/functions/Function0; } diff --git a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt index ba2e43a73..bcb4c4ac0 100644 --- a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt +++ b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/DefaultStackAnimation.kt @@ -223,7 +223,7 @@ internal class DefaultStackAnimation( private var animationHandler: AnimationHandler? = null override fun onBackStarted(backEvent: BackEvent) { - val animationHandler = AnimationHandler(animatable = predictiveBackParams.animatableSelector(backEvent)) + val animationHandler = AnimationHandler(animatable = predictiveBackParams.animatable(backEvent)) this.animationHandler = animationHandler val exitChild = stack.active val enterChild = stack.backStack.last() diff --git a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt index 206a241b6..b88c2bb8e 100644 --- a/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt +++ b/extensions-compose-experimental/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackParams.kt @@ -12,9 +12,8 @@ import com.arkivanov.essenty.backhandler.BackHandler * corresponding child [ComponentContext][com.arkivanov.decompose.ComponentContext]. * @param onBack a callback to be called when the back gesture is confirmed (finished), * it should usually call [StackNavigator#pop][com.arkivanov.decompose.router.stack.pop]. - * @param animatableSelector a selector function that returns a [PredictiveBackAnimatable] - * for the given initial [BackEvent]. If not provided, then a default animation will be used - * for back gestures + * @param animatable a function that returns a [PredictiveBackAnimatable] for the given + * initial [BackEvent]. If not provided, then a default animation will be used for back gestures * (see [ChildStack][com.arkivanov.decompose.extensions.compose.experimental.stack.ChildStack]). * * @see com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback.materialPredictiveBackAnimatable @@ -24,5 +23,5 @@ import com.arkivanov.essenty.backhandler.BackHandler class PredictiveBackParams( val backHandler: BackHandler, val onBack: () -> Unit, - val animatableSelector: (initialBackEvent: BackEvent) -> PredictiveBackAnimatable? = { null }, + val animatable: (initialBackEvent: BackEvent) -> PredictiveBackAnimatable? = { null }, ) diff --git a/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt b/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt index a48da6bee..85acef553 100644 --- a/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt +++ b/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/ChildStackTest.kt @@ -246,7 +246,7 @@ class ChildStackTest( PredictiveBackParams( backHandler = BackDispatcher(), onBack = {}, - animatableSelector = ::materialPredictiveBackAnimatable, + animatable = ::materialPredictiveBackAnimatable, ) return listOf( diff --git a/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt b/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt index f79860244..801785c2d 100644 --- a/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt +++ b/extensions-compose-experimental/src/jvmTest/kotlin/com/arkivanov/decompose/extensions/compose/experimental/stack/animation/PredictiveBackGestureTest.kt @@ -289,7 +289,7 @@ class PredictiveBackGestureTest { PredictiveBackParams( backHandler = backDispatcher, onBack = onBack, - animatableSelector = ::TestAnimatable, + animatable = ::TestAnimatable, ) }, selector = { _, _, _ -> null },