You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
It's possible with a TextView to get notified when some changes are made within it by implementing a TextWatcher and pass it to the instance of the TextView. This is largely used with EditText (extends TextView) to interact with user events on this view.
I will start the implementation by providing two annotations :
@BeforeTextChange
Annotated method must have at least a CharSequence parameter, the start, count and after parameters can be all declared or none of them, (developers cannot annotate a method that declare one or two parameters among the three).
@TextChange
Same as above but the annotated method can take an Editable paremeter instead of the CharSequence parameter.
Those annotations can take multiple id as value parameters (like @click, @touch, etc...)
I think have one annotations for two methods is a bit complex for users. So the first implementation should offer three annotations :
@BeforeTextChange
@TextChange
@AfterTextChange
All the parameter will be optionals. the integers parameters are identified by their names (before, after, start, count). The CharSequence or Editable parameter (following context) are identified by their types. The targeted widget can be added as parameter of the annotated method.
Activity
JoanZapata commentedon Feb 29, 2012
That would be nice ! What is the difference between
@TextChangedand@AfterTextChanged?mathieuboniface commentedon Feb 29, 2012
@shuya-inc Good question !
I found some explanation on this thread on StackOverflow : http://stackoverflow.com/questions/476848/android-textwatcher-aftertextchanged-vs-textwatcher-ontextchanged
I think we should check that annotated methods take the proper arguments while annotation processing.
mathieuboniface commentedon May 1, 2012
I will start the implementation by providing two annotations :
@BeforeTextChangeAnnotated method must have at least a
CharSequenceparameter, thestart,countandafterparameters can be all declared or none of them, (developers cannot annotate a method that declare one or two parameters among the three).@TextChangeSame as above but the annotated method can take an
Editableparemeter instead of theCharSequenceparameter.Those annotations can take multiple id as value parameters (like @click, @touch, etc...)
Comments are welcome.
mathieuboniface commentedon May 8, 2012
I changed my mind since I write the last comment.
I think have one annotations for two methods is a bit complex for users. So the first implementation should offer three annotations :
@BeforeTextChange@TextChange@AfterTextChangeAll the parameter will be optionals. the integers parameters are identified by their names (before, after, start, count). The CharSequence or Editable parameter (following context) are identified by their types. The targeted widget can be added as parameter of the annotated method.
Some examples of valid declaration :
First implementation of @textchange, @BeforeTextChange and @AfterText…
pyricau commentedon May 10, 2012
The documentation is here : https://github.com/excilys/androidannotations/wiki/TextChangeEvents