I have this code sample:
class MeasureTextView: TextView {
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: Attr
My preferred way to use IntDef with Kotlin is to use top-level declarations:
package com.example.tips
const val TIP_A = 1
const val TIP_B = 2
const val TIP_C = 3
@IntDef(TIP_A, TIP_B, TIP_C)
@Retention(AnnotationRetention.SOURCE)
annotation class TipId
class TipsDataProvider {
fun markTip(@TipId tipId: Int) {
...
}
}
No extra class or object required! More info about top-level declarations here.