Skip to content

Commit

Permalink
Add getters for Marker fields (#1998)
Browse files Browse the repository at this point in the history
Fixes #1990
  • Loading branch information
gpeal authored Jan 17, 2022
1 parent 1c1fe29 commit ba067ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit ba067ca

Please sign in to comment.