I'm working on a Wear OS watchface using Jetpack WatchFace library and ComplicationSlotsManager to render complications. I'm looking into WatchFaceKotlin Wear samples for inspiration. I want to be able to change how the complications look like according to user's actions. Let's say user can chose a color style and complications will recolor accordingly.
This is also the case for the sample and it somehow works by rewriting complication slot renderer with new ComplicationDrawable each time there is a change. This is the code. Honestly I don't like this approach with casting and hoping that the type is right (which of course is, just it seems more like a workaround than a proper way to do it).
So I wonder, is there a better way to update complication slot renderer on user change? There is some invalidation mechanism on ComplicationDrawable (and WatchFaceService) but this is ultimately internal and not exactly what I'm looking for.
Since ComplicationSlotsManager is using factory (CanvasComplicationFactory) to create drawable I would expect this can be called every time it is needed but from what I can see in the source code this is just called once with lazy delegate, nothing more... Is it really it?