Skip to content

Commit f29acaf

Browse files
authored
Removed ExperimentalDecomposeApi annotation from predictive back gesture API (#1004)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Removed experimental API requirements from stack animation and predictive-back components, making them easier to use without extra opt-in annotations. * Cleaned up predictive-back related imports and updated internal references for consistency. * **Style** * Minor formatting and import organization updates across animation-related code. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents c1d2cfd + 492a7fb commit f29acaf

10 files changed

Lines changed: 7 additions & 25 deletions

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/AbstractStackAnimation.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ import androidx.compose.runtime.remember
1010
import androidx.compose.runtime.setValue
1111
import androidx.compose.ui.Modifier
1212
import com.arkivanov.decompose.Child
13-
import com.arkivanov.decompose.ExperimentalDecomposeApi
1413
import com.arkivanov.decompose.extensions.compose.utils.InputConsumingOverlay
1514
import com.arkivanov.decompose.router.stack.ChildStack
1615

17-
@OptIn(ExperimentalDecomposeApi::class)
1816
internal abstract class AbstractStackAnimation<C : Any, T : Any>(
1917
private val disableInputDuringAnimation: Boolean,
2018
) : StackAnimation<C, T> {

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/MovableStackAnimation.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import androidx.compose.runtime.Composable
55
import androidx.compose.runtime.movableContentOf
66
import androidx.compose.runtime.remember
77
import com.arkivanov.decompose.Child
8-
import com.arkivanov.decompose.ExperimentalDecomposeApi
98

109
internal class MovableStackAnimation<C : Any, T : Any>(
1110
disableInputDuringAnimation: Boolean,
1211
private val selector: (child: Child.Created<C, T>, otherChild: Child.Created<C, T>, direction: Direction) -> StackAnimator?,
1312
) : AbstractStackAnimation<C, T>(disableInputDuringAnimation = disableInputDuringAnimation) {
1413

15-
@OptIn(ExperimentalDecomposeApi::class)
1614
@Composable
1715
override fun Child(
1816
item: AnimationItem<C, T>,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/SimpleStackAnimation.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import androidx.compose.foundation.layout.Box
44
import androidx.compose.runtime.Composable
55
import androidx.compose.runtime.remember
66
import com.arkivanov.decompose.Child
7-
import com.arkivanov.decompose.ExperimentalDecomposeApi
87

98
internal class SimpleStackAnimation<C : Any, T : Any>(
109
disableInputDuringAnimation: Boolean,
1110
private val selector: (Child.Created<C, T>) -> StackAnimator?,
1211
) : AbstractStackAnimation<C, T>(disableInputDuringAnimation = disableInputDuringAnimation) {
1312

14-
@OptIn(ExperimentalDecomposeApi::class)
1513
@Composable
1614
override fun Child(
1715
item: AnimationItem<C, T>,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/AndroidPredictiveBackAnimatable.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback
22

33
import androidx.compose.ui.graphics.Shape
4-
import com.arkivanov.decompose.ExperimentalDecomposeApi
54
import com.arkivanov.essenty.backhandler.BackEvent
65

76
/**
@@ -16,7 +15,6 @@ import com.arkivanov.essenty.backhandler.BackEvent
1615
* If not supplied then a [RoundedCornerShape][androidx.compose.foundation.shape.RoundedCornerShape] will be applied.
1716
* The `progress` argument is animating between 0 and 1 while the gesture is being performed.
1817
*/
19-
@ExperimentalDecomposeApi
2018
fun androidPredictiveBackAnimatableV1(
2119
initialBackEvent: BackEvent,
2220
exitShape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)? = null,
@@ -41,7 +39,6 @@ fun androidPredictiveBackAnimatableV1(
4139
* If not supplied then a [RoundedCornerShape][androidx.compose.foundation.shape.RoundedCornerShape] will be applied.
4240
* The `progress` argument is animating between 0 and 1 while the gesture is being performed.
4341
*/
44-
@ExperimentalDecomposeApi
4542
fun androidPredictiveBackAnimatableV2(
4643
initialBackEvent: BackEvent,
4744
exitShape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)? = null,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/AndroidPredictiveBackAnimatableV1.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,12 @@ import androidx.compose.ui.graphics.graphicsLayer
1515
import androidx.compose.ui.layout.onPlaced
1616
import androidx.compose.ui.unit.IntSize
1717
import androidx.compose.ui.util.lerp
18-
import com.arkivanov.decompose.ExperimentalDecomposeApi
1918
import com.arkivanov.essenty.backhandler.BackEvent
2019
import kotlinx.coroutines.CoroutineScope
2120
import kotlinx.coroutines.coroutineScope
2221
import kotlinx.coroutines.joinAll
2322
import kotlinx.coroutines.launch
2423

25-
@ExperimentalDecomposeApi
2624
internal class AndroidPredictiveBackAnimatableV1(
2725
initialEvent: BackEvent,
2826
private val exitShape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)? = null,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/AndroidPredictiveBackAnimatableV2.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
package com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback
22

33
import androidx.compose.animation.core.Animatable
4-
import androidx.compose.runtime.*
4+
import androidx.compose.runtime.Composable
5+
import androidx.compose.runtime.derivedStateOf
6+
import androidx.compose.runtime.getValue
7+
import androidx.compose.runtime.mutableFloatStateOf
8+
import androidx.compose.runtime.mutableStateOf
9+
import androidx.compose.runtime.remember
10+
import androidx.compose.runtime.setValue
511
import androidx.compose.ui.Modifier
612
import androidx.compose.ui.composed
713
import androidx.compose.ui.draw.drawWithContent
@@ -16,13 +22,11 @@ import androidx.compose.ui.unit.Density
1622
import androidx.compose.ui.unit.dp
1723
import androidx.compose.ui.unit.toSize
1824
import androidx.compose.ui.util.lerp
19-
import com.arkivanov.decompose.ExperimentalDecomposeApi
2025
import com.arkivanov.essenty.backhandler.BackEvent
2126
import kotlinx.coroutines.coroutineScope
2227
import kotlinx.coroutines.joinAll
2328
import kotlinx.coroutines.launch
2429

25-
@ExperimentalDecomposeApi
2630
internal class AndroidPredictiveBackAnimatableV2(
2731
private val initialEvent: BackEvent,
2832
private val exitShape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)?,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/DefaultPredictiveBackAnimatable.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ import androidx.compose.runtime.getValue
55
import androidx.compose.runtime.mutableStateOf
66
import androidx.compose.runtime.setValue
77
import androidx.compose.ui.Modifier
8-
import com.arkivanov.decompose.ExperimentalDecomposeApi
98
import com.arkivanov.essenty.backhandler.BackEvent
109

11-
@ExperimentalDecomposeApi
1210
internal class DefaultPredictiveBackAnimatable(
1311
initialBackEvent: BackEvent,
1412
private val getExitModifier: (progress: Float, edge: BackEvent.SwipeEdge) -> Modifier,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/MaterialPredictiveBackAnimatable.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import androidx.compose.ui.platform.LocalDensity
2121
import androidx.compose.ui.unit.Density
2222
import androidx.compose.ui.unit.dp
2323
import androidx.compose.ui.unit.toSize
24-
import com.arkivanov.decompose.ExperimentalDecomposeApi
2524
import com.arkivanov.essenty.backhandler.BackEvent
2625
import kotlinx.coroutines.coroutineScope
2726
import kotlinx.coroutines.joinAll
@@ -35,7 +34,6 @@ import kotlinx.coroutines.launch
3534
* @param shape an optional clipping shape of the child being removed (the currently active child).
3635
* If not supplied then a [RoundedCornerShape][androidx.compose.foundation.shape.RoundedCornerShape] will be applied.
3736
*/
38-
@ExperimentalDecomposeApi
3937
fun materialPredictiveBackAnimatable(
4038
initialBackEvent: BackEvent,
4139
shape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)? = null,
@@ -45,7 +43,6 @@ fun materialPredictiveBackAnimatable(
4543
exitShape = shape,
4644
)
4745

48-
@ExperimentalDecomposeApi
4946
private class MaterialPredictiveBackAnimatable(
5047
private val initialEvent: BackEvent,
5148
private val exitShape: ((progress: Float, edge: BackEvent.SwipeEdge) -> Shape)? = null,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/PredictiveBackAnimatable.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package com.arkivanov.decompose.extensions.compose.stack.animation.predictiveback
22

33
import androidx.compose.ui.Modifier
4-
import com.arkivanov.decompose.ExperimentalDecomposeApi
54
import com.arkivanov.essenty.backhandler.BackEvent
65

76
/**
87
* Animates [exitModifier] and [enterModifier] according to incoming [BackEvent] events.
98
*
109
* [Animatable][androidx.compose.animation.core.Animatable] can be used for animations.
1110
*/
12-
@ExperimentalDecomposeApi
1311
interface PredictiveBackAnimatable {
1412

1513
/**
@@ -63,7 +61,6 @@ interface PredictiveBackAnimatable {
6361
* @param enterModifier a function that returns a [Modifier] for every gesture event, for
6462
* the previous child (behind the currently active child).
6563
*/
66-
@ExperimentalDecomposeApi
6764
fun predictiveBackAnimatable(
6865
initialBackEvent: BackEvent,
6966
exitModifier: (progress: Float, edge: BackEvent.SwipeEdge) -> Modifier,

extensions-compose/src/commonMain/kotlin/com/arkivanov/decompose/extensions/compose/stack/animation/predictiveback/PredictiveBackAnimation.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import androidx.compose.runtime.rememberCoroutineScope
1313
import androidx.compose.runtime.setValue
1414
import androidx.compose.ui.Modifier
1515
import com.arkivanov.decompose.Child
16-
import com.arkivanov.decompose.ExperimentalDecomposeApi
1716
import com.arkivanov.decompose.Ref
1817
import com.arkivanov.decompose.extensions.compose.stack.animation.LocalStackAnimationProvider
1918
import com.arkivanov.decompose.extensions.compose.stack.animation.StackAnimation
@@ -37,7 +36,6 @@ import kotlinx.coroutines.launch
3736
* returns [PredictiveBackAnimatable] responsible for animations.
3837
* @param onBack a callback that is called when the gesture is finished.
3938
*/
40-
@ExperimentalDecomposeApi
4139
fun <C : Any, T : Any> predictiveBackAnimation(
4240
backHandler: BackHandler,
4341
fallbackAnimation: StackAnimation<C, T>? = null,
@@ -57,7 +55,6 @@ fun <C : Any, T : Any> predictiveBackAnimation(
5755
onBack = onBack,
5856
)
5957

60-
@OptIn(ExperimentalDecomposeApi::class)
6158
private class PredictiveBackAnimation<C : Any, T : Any>(
6259
private val backHandler: BackHandler,
6360
private val animation: StackAnimation<C, T>?,

0 commit comments

Comments
 (0)