Update sample-compose and issue-repro-compose to use the new progressProvider
diff --git a/issue-repro-compose/src/main/java/com/airbnb/lottie/issues/compose/ComposeIssueReproActivity.kt b/issue-repro-compose/src/main/java/com/airbnb/lottie/issues/compose/ComposeIssueReproActivity.kt
index 81acbed..aeecf2f 100755
--- a/issue-repro-compose/src/main/java/com/airbnb/lottie/issues/compose/ComposeIssueReproActivity.kt
+++ b/issue-repro-compose/src/main/java/com/airbnb/lottie/issues/compose/ComposeIssueReproActivity.kt
@@ -22,6 +22,6 @@
fun Content() {
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.heart))
val progress by animateLottieCompositionAsState(composition)
- LottieAnimation(composition, progress)
+ LottieAnimation(composition, { progress })
}
}
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/AnimatableExamplesPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/AnimatableExamplesPage.kt
index 562b837..f52b15d 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/AnimatableExamplesPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/AnimatableExamplesPage.kt
@@ -64,7 +64,7 @@
iterations = LottieConstants.IterateForever,
)
}
- LottieAnimation(anim.composition, anim.progress)
+ LottieAnimation(anim.composition, { anim.progress })
}
@Composable
@@ -84,7 +84,7 @@
}
}
Box {
- LottieAnimation(anim.composition, anim.progress)
+ LottieAnimation(anim.composition, { anim.progress })
Slider(
value = sliderGestureProgress ?: anim.progress,
onValueChange = { sliderGestureProgress = it },
@@ -110,7 +110,7 @@
)
}
Box {
- LottieAnimation(composition, anim.progress)
+ LottieAnimation(composition, { anim.progress })
Slider(
value = speed,
onValueChange = { speed = it },
@@ -144,7 +144,7 @@
}
LottieAnimation(
composition,
- animatable.progress,
+ { animatable.progress },
modifier = Modifier
.clickable { nonce++ }
)
@@ -162,7 +162,7 @@
}
LottieAnimation(
composition,
- animatable.progress,
+ { animatable.progress },
modifier = Modifier
.clickable { shouldPlay = !shouldPlay }
)
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/BasicUsageExamplesPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/BasicUsageExamplesPage.kt
index d592c18..f82e2ba 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/BasicUsageExamplesPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/BasicUsageExamplesPage.kt
@@ -140,7 +140,7 @@
)
LottieAnimation(
composition,
- progress,
+ { progress },
)
}
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/TransitionsExamplesPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/TransitionsExamplesPage.kt
index e6eec4e..0dbcd85 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/TransitionsExamplesPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/TransitionsExamplesPage.kt
@@ -90,7 +90,7 @@
} while (s == TransitionSection.LoopMiddle)
}
}
- LottieAnimation(composition, animatable.progress)
+ LottieAnimation(composition, { animatable.progress })
}
@Composable
@@ -113,5 +113,5 @@
)
}
- LottieAnimation(animatable.composition, animatable.progress)
+ LottieAnimation(animatable.composition, { animatable.progress })
}
\ No newline at end of file
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/ViewPagerExample.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/ViewPagerExample.kt
index 26a5146..79945be 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/ViewPagerExample.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/examples/ViewPagerExample.kt
@@ -60,7 +60,7 @@
val progress by derivedStateOf { (pagerState.currentPage + pagerState.currentPageOffset) / (pagerState.pageCount - 1f) }
LottieAnimation(
composition,
- progress,
+ { progress },
modifier = Modifier
.fillMaxSize()
)
diff --git a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerPage.kt b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerPage.kt
index e050069..3a640f2 100644
--- a/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerPage.kt
+++ b/sample-compose/src/main/java/com/airbnb/lottie/sample/compose/player/PlayerPage.kt
@@ -255,7 +255,7 @@
) {
PlayerPageLottieAnimation(
composition,
- state.animatable.progress,
+ { state.animatable.progress },
modifier = Modifier
// TODO: figure out how maxWidth can play nice with the aspectRatio modifier inside of LottieAnimation.
.fillMaxWidth()
@@ -291,12 +291,12 @@
@Composable
private fun PlayerPageLottieAnimation(
composition: LottieComposition?,
- progress: Float,
+ progressProvider: () -> Float,
modifier: Modifier = Modifier,
) {
LottieAnimation(
composition,
- progress,
+ progressProvider,
modifier = modifier,
)
}