What's the proper way to start a Litho animation when an Activity is first displayed. All of the Litho animation examples are initiated by a user action, but I want to run one automatically.
I tried to extend a Litho animation example RTAnimationComponentSpec to fire the animation for the @OnEvent(VisibleEvent.class)
instead of just @OnEvent(ClickEvent.class)
. But it didn't fire though.
Existing click event handler:
@OnEvent(ClickEvent.class)
static void onClick(ComponentContext c) {
RTAnimationComponent.updateStateSync(c);
}
Additional event handler that I added:
@OnEvent(VisibleEvent.class)
static void onVisible(ComponentContext c) {
RTAnimationComponent.updateStateSync(c);
}
I confirmed the VisibleEvent
didn't fire by:
- Loading the Render Thread example and confirmed the animation didn't start
- Setting a breakpoint in the
onVisible()
method
How can I run a Litho animation automatically?