The scenario I'd like to reproduce is :
Having a textView with a drawable left with a green text color (also the tint of the drawable) when tap on that TextView
then change the color of the text and change the start drawable (also the tint of the drawable) that is shown for 5 seconds, once these 5 seconds have passed with a fade in/fade out animation change back to the initial state.
I've started creating a custom view
class MyCustomTextView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
val coroutineScope: CoroutineScope,
) : ConstraintLayout(
context,
attrs,
defStyleAttr
) {
fun onClickToCopy(){
//Add the animation to the new state
coroutineScope.launch {
delay(5_000L)
}
//With an animation come back to the initial state
}
}
But now I'm stuck I don't know how to proceed with this, do I have to create an init{}
with the initial state ?