File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -263,21 +263,16 @@ Without convenience methods, we must create a `ViewRegister`:
263263```kotlin
264264class MyOnTextChangedRegister : ViewRegister <TextView , String >(), TextWatcher {
265265
266- override fun registerView (view : TextView ) {
267- view.addTextChangedListener(this )
268- }
266+ override fun registerView (view : TextView ) = view.addTextChangedListener(this )
269267
270- override fun deregisterFromView (view : TextView ) {
271- view.removeTextChangedListener(this )
272- }
268+ override fun deregisterFromView (view : TextView ) = view.removeTextChangedListener(this )
273269
274270 override fun afterTextChanged (s : Editable ? ) = Unit
275271
276272 override fun beforeTextChanged (s : CharSequence? , start : Int , count : Int , after : Int ) = Unit
277273
278274 override fun onTextChanged (s : CharSequence? , start : Int , before : Int , count : Int ) {
279- @Suppress(" UNCHECKED_CAST" )
280- callback?.invoke(s?.toString()) // callback is given in base. pass result of changes to it.
275+ notifyChange(s?.toString()) // pass changes to to listeners so data can update.
281276 }
282277
283278 override fun getValue (view : TextView ) = view.text.toString() // specifies how to convert view data out
You can’t perform that action at this time.
0 commit comments