-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[a11y] Adding reduce motion logic to LottieAnimation for compose usage #2542
[a11y] Adding reduce motion logic to LottieAnimation for compose usage #2542
Conversation
adding reduce motion logic to LottieAnimation for compose usage
if (!drawable.animationsEnabled(context) && drawable.markerForAnimationsDisabled != null) { | ||
drawable.progress = drawable.markerForAnimationsDisabled!!.startFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!drawable.animationsEnabled(context) && drawable.markerForAnimationsDisabled != null) { | |
drawable.progress = drawable.markerForAnimationsDisabled!!.startFrame | |
val markerForAnimationsDisabled = drawable.markerForAnimationsDisabled | |
if (!drawable.animationsEnabled(context) && markerForAnimationsDisabled != null) { | |
drawable.progress = markerForAnimationsDisabled.startFrame |
Let's avoid !!
here with a smart cast
@@ -853,7 +853,7 @@ public void playAnimation() { | |||
* | |||
* @return The first non-null marker from the list of allowed reduced motion markers, or null if no such marker is found. | |||
*/ | |||
private Marker getMarkerForAnimationsDisabled() { | |||
public Marker getMarkerForAnimationsDisabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a @RestrictTo(Library)
on this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@RestrictTo(RestrictTo.Scope.LIBRARY)
@gpeal thanks for merging, when you get time can you cut a . release with this change. |
yes, i saw this error for compose code but didn't realize it is happening for non compose, let me check and put a fix |
@pranayairan I just released 6.5.2 |
Our changes in #2536 didn't work for
LottieAnimation
in compose. While LottieAnimation does use LottieDrawable, it has it's own animator and draws on canvas directly.This PR addresses that issue by making some logic of reduce motion readable outside LottieDrawable and consuming that logic in
LottieAnimation
I tested this by adding a sample lottie file with reduce motion marker locally, see the attached video.
Screen_recording_20240829_125041.mp4