bluelinelabs / bluelinelabs/Conductor

Workflow custom animation question - trigger animation start

Open
#161 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.9k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

I've implemented following workflow to start animations as soon as my view is ready:

* I've sub classed an `RecyclerView` adapter for the simple reason of adding the ability to add a custom listener like following:

public interface IDataReadyListener
{
void onDataReady();
}
* I attach an empty adapter to my `RecyclerView` when the controller is created, so that an adapter is always attached to the `RecyclerView`
* I use the interface to start my animation at an arbitrary point that is not related to any view "lifecycle" event like `onPreDraw` or `onGlobalLayout` or similar... I manually notify the listener somewhere else when I know all items that are needed for the animation are ready. I need this, because my animation can only start as soon as some views of the `RecyclerView` have finished inflating AND have finished loading their images.

This works, but it looks ugly. It forces me to use a custom view (because the `ChangeHandler` only get's the from and the to `View` and I must use something offered by those `Views`).

Is there any more beautiful way to do that? Or is this really the default way and wanted so by design?
I think something like following would look nicer:

* access the controller from within my `ChangeHandler` and register my listeners in the controller (currently I can't access the controller from within the `ChangeHandler`, can I?)
* my adapter could notifiy the animation listener via the controller then and tell the listener that it is ready now

**I think it would really make sense to pass on the controllers to `ChangeHandler.performChange` so that the controllers can be used inside the `ChangeHandler`. Does anything speak against this?**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.