1 package com.airbnb.lottie.samples 2 3 import android.os.Bundle 4 import androidx.appcompat.app.AppCompatActivity 5 import android.text.Editable 6 import android.text.TextWatcher 7 import com.airbnb.lottie.TextDelegate 8 import kotlinx.android.synthetic.main.activity_dynamic_text.* 9 10 class DynamicTextActivity : AppCompatActivity() { 11 onCreatenull12 override fun onCreate(savedInstanceState: Bundle?) { 13 super.onCreate(savedInstanceState) 14 setContentView(R.layout.activity_dynamic_text) 15 16 val textDelegate = TextDelegate(dynamicTextView) 17 nameEditText.addTextChangedListener(object: TextWatcher { 18 override fun afterTextChanged(s: Editable?) { 19 textDelegate.setText("NAME", s.toString()) 20 } 21 22 override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {} 23 24 override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {} 25 }) 26 dynamicTextView.setTextDelegate(textDelegate) 27 } 28 } 29