diff --git a/CHANGELOG.md b/CHANGELOG.md index 2febb08f48..a4f65537a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ of the original bitmap. This meant that if you wanted to supply a lower resolution bitmap to save memory, it would render smaller. The default behavior remains the same but you can enable [setMaintainOriginalImageBounds](https://github.com/airbnb/lottie-android/blob/c5b8318c7cf205e95db143955acbfc69f86bc339/lottie/src/main/java/com/airbnb/lottie/LottieDrawable.java#L264) to be able to supply lower resolution bitmaps ([#1706](https://github.com/airbnb/lottie-android/issues/1706)). * Add support for `LottieProperty.TEXT` to use dynamic properties for text. This enables dynamic text support for lottie-compose ([#1995](https://github.com/airbnb/lottie-android/issues/1495)). +* Add getters for Marker fields ([#1998](https://github.com/airbnb/lottie-android/pull/1998)) ### Bugs Fixed * Fixed a rare NPE multi-threaded race condition ([#1959](https://github.com/airbnb/lottie-android/pull/1959)) diff --git a/lottie/src/main/java/com/airbnb/lottie/model/Marker.java b/lottie/src/main/java/com/airbnb/lottie/model/Marker.java index a0b20c9e8b..a8ec903541 100644 --- a/lottie/src/main/java/com/airbnb/lottie/model/Marker.java +++ b/lottie/src/main/java/com/airbnb/lottie/model/Marker.java @@ -13,6 +13,18 @@ public Marker(String name, float startFrame, float durationFrames) { this.startFrame = startFrame; } + public String getName() { + return name; + } + + public float getStartFrame() { + return startFrame; + } + + public float getDurationFrames() { + return durationFrames; + } + public boolean matchesName(String name) { if (this.name.equalsIgnoreCase(name)) { return true; diff --git a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/SnapshotTestCaseContext.kt b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/SnapshotTestCaseContext.kt index b05d0b0c98..0563c6aee6 100644 --- a/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/SnapshotTestCaseContext.kt +++ b/snapshot-tests/src/androidTest/java/com/airbnb/lottie/snapshots/SnapshotTestCaseContext.kt @@ -203,7 +203,9 @@ suspend fun SnapshotTestCaseContext.snapshotComposable( log("Drawing $name - Software") var bitmap = bitmapPool.acquire(composeView.width, composeView.height) var canvas = Canvas(bitmap) - composeView.draw(canvas) + withContext(Dispatchers.Main) { + composeView.draw(canvas) + } snapshotter.record(bitmap, name, if (renderHardwareAndSoftware) "$variant - Software" else variant) bitmapPool.release(bitmap) @@ -220,7 +222,9 @@ suspend fun SnapshotTestCaseContext.snapshotComposable( log("Drawing $name - Software") bitmap = bitmapPool.acquire(composeView.width, composeView.height) canvas = Canvas(bitmap) - composeView.draw(canvas) + withContext(Dispatchers.Main) { + composeView.draw(canvas) + } snapshotter.record(bitmap, name, if (renderHardwareAndSoftware) "$variant - Hardware" else variant) bitmapPool.release(bitmap) }