But what if you want different colors for the different states? So for example, grey if there’s not device to cast to, blue if there is, a blueish gradient when connecting, and finally a gradient from blue to green when connected?
For this we need to create a custom remote indicator drawable, based off the default drawable. I’ve started by creating a copy of the default white drawable, called mr_button_dark, and all other referenced drawables which are not bitmaps. As a result we now have 3 drawable XMLs, two for the connecting and connected animations, and one for the remote indicator drawable with all the states, which I named custom_cast_button.
Now we can start adding the colors to each state. First, for the disconnected and disabled state, we will add a tint: