I've found a lot of posts on how to make a selector for custom boolean attributes (for example How to add a custom button state). But I couldn't find how to make a selector for enums or ints. Is it possible at all?
For example, I have custom enum attribute
<declare-styleable name="status_indicator">
<attr name="status" format="enum">
<enum name="value_offline" value="0"/>
<enum name="value_away" value="1"/>
<enum name="value_online" value="2"/>
</attr>
</declare-styleable>
I want to use a background with a selector like
<selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:drawable="@drawable/status_offline" app:status="value_offline"/>
<item android:drawable="@drawable/status_away" app:status="value_away"/>
<item android:drawable="@drawable/status_online" app:status="value_online"/>
<item>
<shape android:shape="oval">
<solid android:color="#ff00ff"/>
</shape>
</item>
</selector>
This code compiles, but selector always applies the first item like it has no conditions. I've read sources and found that item matching is made by compare of attribute sets. I assume that android framework can't build valid attribute set for the condition with enums or ints?