Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getters for Marker fields #1998

Merged
merged 3 commits into from Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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))
Expand Down
12 changes: 12 additions & 0 deletions lottie/src/main/java/com/airbnb/lottie/model/Marker.java
Expand Up @@ -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;
Expand Down
Expand Up @@ -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)

Expand All @@ -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)
}
Expand Down