I have this code sample:
class MeasureTextView: TextView {
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: Attr
If you are calling setMeasureText from Java you can get it to work by creating your IntDef in Java too
// UnitType.java
@Retention(RetentionPolicy.SOURCE)
@IntDef({MeasureText.UNIT_KG, MeasureText.UNIT_LB, MeasureText.UNIT_NONE})
public @interface UnitType {}
h/t Tonic Artos
You will also need to update your companion object to make your values longs and publicly accessible
companion object{
const val UNIT_NONE = -1L
const val UNIT_KG = 1L
const val UNIT_LB = 0L
}