This is brilliant Martin, thank you very much! It’s unbelievable how messy it is to just style a TextInputLayout, it would have taken me days without your guide. Google sometimes really likes to complicate our lives.
As an addition, if you need to use a different colour for the TextInputEditText when it is focused (and it doesn’t correspond with your primaryColor), you can set a ColorStateList which takes care of the following states:
<?xml version="1.0" encoding="utf-8"?>
<item android:color="@color/yourFocusedColor" android:state_focused="true"/>
<item android:color="@color/yourUnfocusedColor" android:state_focused="false"/>