The Art of Readable Code
A not so deep dive into the nuances of code readability and maintainability, examining the subjective nature of what makes code readable, weird programming languages and personal preferences
I wrote a helper class for coloring almost anything in Android (including different types of drawables).
We use it to customize Bria for our customers in real time. As far as I’ve seen, the most used method is:
This name is subject to change – but it gives you a dynamically colored ripple-enabled drawable for Lollipop, OR a dynamically-colored state-list drawable for pre-Lollipop devices.
You can check out the
Coloring.getContrastColor() method too, if you need to recolor the foreground of a view into a contrasting color versus the background. It’s all working dynamically with any color you want as a base.
There’s a bunch of other useful stuff inside too! Here’s the source code.
All of these features, and more, are available now as part of the
Silly Android library.
Check it out here