Allow repeater contents to have dynamic properties
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java
index 1db7f55..2a9bf95 100644
--- a/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java
+++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/ContentGroup.java
@@ -115,6 +115,10 @@
}
}
+ public List<Content> getContents() {
+ return contents;
+ }
+
List<PathContent> getPathList() {
if (pathContents == null) {
pathContents = new ArrayList<>();
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java
index 8b6d122..4a721fb 100644
--- a/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java
+++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/RepeaterContent.java
@@ -131,6 +131,12 @@
@Override public void resolveKeyPath(
KeyPath keyPath, int depth, List<KeyPath> accumulator, KeyPath currentPartialKeyPath) {
MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, this);
+ for (int i = 0; i < contentGroup.getContents().size(); i++) {
+ Content content = contentGroup.getContents().get(i);
+ if (content instanceof KeyPathElementContent) {
+ MiscUtils.resolveKeyPath(keyPath, depth, accumulator, currentPartialKeyPath, (KeyPathElementContent) content);
+ }
+ }
}
@SuppressWarnings("unchecked")
diff --git a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/tests/DynamicPropertiesTestCase.kt b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/tests/DynamicPropertiesTestCase.kt
index f6fa19a..fd7d915 100644
--- a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/tests/DynamicPropertiesTestCase.kt
+++ b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/tests/DynamicPropertiesTestCase.kt
@@ -251,6 +251,20 @@
)
testDynamicProperty(
+ "Repeater contents",
+ KeyPath("Shape Layer 1", "Repeater Shape", "Repeater 1"),
+ LottieProperty.TRANSFORM_POSITION,
+ LottieRelativePointValueCallback(PointF(100f, 100f))
+ )
+
+ testDynamicProperty(
+ "Repeater sub-contents",
+ KeyPath("Shape Layer 1", "Repeater Shape", "Fill 1"),
+ LottieProperty.COLOR_FILTER,
+ LottieValueCallback(SimpleColorFilter(Color.GREEN))
+ )
+
+ testDynamicProperty(
"Repeater transform start opacity",
KeyPath("Shape Layer 1", "Repeater Shape", "Repeater 1"),
LottieProperty.TRANSFORM_START_OPACITY,