Skip to content

Commit

Permalink
Merge pull request #762 from arkivanov/animatable-selector
Browse files Browse the repository at this point in the history
Renamed PredictiveBackParams#animatableSelector parameter to animatable
  • Loading branch information
arkivanov authored Aug 18, 2024
2 parents 9240a6d + 8081019 commit 92906bc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class com/arkivanov/decompose/extensions/compose/experimental/stack
public static final field $stable I
public fun <init> (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)V
public synthetic fun <init> (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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <init>(com.arkivanov.essenty.backhandler/BackHandler, kotlin/Function0<kotlin/Unit>, kotlin/Function1<com.arkivanov.essenty.backhandler/BackEvent, com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback/PredictiveBackAnimatable?> = ...) // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.<init>|<init>(com.arkivanov.essenty.backhandler.BackHandler;kotlin.Function0<kotlin.Unit>;kotlin.Function1<com.arkivanov.essenty.backhandler.BackEvent,com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback.PredictiveBackAnimatable?>){}[0]

final val animatableSelector // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatableSelector|{}animatableSelector[0]
final fun <get-animatableSelector>(): kotlin/Function1<com.arkivanov.essenty.backhandler/BackEvent, com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback/PredictiveBackAnimatable?> // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatableSelector.<get-animatableSelector>|<get-animatableSelector>(){}[0]
final val animatable // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatable|{}animatable[0]
final fun <get-animatable>(): kotlin/Function1<com.arkivanov.essenty.backhandler/BackEvent, com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback/PredictiveBackAnimatable?> // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.animatable.<get-animatable>|<get-animatable>(){}[0]
final val backHandler // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.backHandler|{}backHandler[0]
final fun <get-backHandler>(): com.arkivanov.essenty.backhandler/BackHandler // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.backHandler.<get-backHandler>|<get-backHandler>(){}[0]
final val onBack // com.arkivanov.decompose.extensions.compose.experimental.stack.animation/PredictiveBackParams.onBack|{}onBack[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class com/arkivanov/decompose/extensions/compose/experimental/stack
public static final field $stable I
public fun <init> (Lcom/arkivanov/essenty/backhandler/BackHandler;Lkotlin/jvm/functions/Function0;Lkotlin/jvm/functions/Function1;)V
public synthetic fun <init> (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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ internal class DefaultStackAnimation<C : Any, T : Any>(
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,5 +23,5 @@ import com.arkivanov.essenty.backhandler.BackHandler
class PredictiveBackParams<in C : Any, in T : Any>(
val backHandler: BackHandler,
val onBack: () -> Unit,
val animatableSelector: (initialBackEvent: BackEvent) -> PredictiveBackAnimatable? = { null },
val animatable: (initialBackEvent: BackEvent) -> PredictiveBackAnimatable? = { null },
)
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class ChildStackTest(
PredictiveBackParams<Config, Config>(
backHandler = BackDispatcher(),
onBack = {},
animatableSelector = ::materialPredictiveBackAnimatable,
animatable = ::materialPredictiveBackAnimatable,
)

return listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class PredictiveBackGestureTest {
PredictiveBackParams(
backHandler = backDispatcher,
onBack = onBack,
animatableSelector = ::TestAnimatable,
animatable = ::TestAnimatable,
)
},
selector = { _, _, _ -> null },
Expand Down

0 comments on commit 92906bc

Please sign in to comment.