Android's RenderThread wrapper
This library wraps the native RenderThread, providing a type-safe way to run custom animations off the UI thread.
Read about what it means in this Medium article.
It transparently falls back to using the standard drawing methods if the hidden APIs aren't available, or whenever hardware acceleration is not enabled on the specified Canvas.
By default it will automatically try to access the RenderThread on Android versions that are known to work (Lollipop and Marshmallow), but you can force it to try on any version (like the N preview) by calling this code once before using it:
RenderThread.init(true);So far the RenderThread is capable of making the following drawing calls, which mirror the respective Canvas ones, but where each property can be animated:
drawCircle(centerX, centerY, radius, paint)drawRoundRect(left, top, right, bottom, cornerRadiusX, cornerRadiusY, paint)The paint values that can be animated are the following:
To use it, there are generally 3 steps involved:
…Check the sample for a complete implementation.
repositories {
maven {
url 'https://dl.bintray.com/takhion/maven/'
}
}
dependencies {
compile 'me.eugeniomarletti:renderthread:1.0.0'
}No open issues yet, or sync has not completed.