I ran into an issue with kotlin delegation where I want to delegate the interface implementation to a variable. The problem is that the superclass has some other constructors that I would not want to lose really
interface Delegate
class CustomView(myRequiredDelegate: Delegate,context:Context): ViewGroup(context), Delegate by myRequiredDelegate
Now as you can see I will have problems with the android studio preview as there is no constructor(context: Context) And also other problems with initializing from xml as I will have to create
class View(myRequiredDelegate: Delegate,context: Context): ViewGroup(context), Delegate by myRequiredDelegate{
// as you can see here I can no longer have access to call super(context, attrs...)
// which provide more attrs for the custom view
// and not sure if kotlin provides any other way to access the other super constructors
constructor(context: Context):this(dummyForDelegate,context)
}
I just want to know if there is a way to provide the delegation as so without breaking the super call chain not specifically for android but for any other case that might have the same delegation constraints...