Guest User

Untitled

a guest
Jul 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. @BindingAdapter("app:rxText")
  2. public static void rxText(TextInputEditText editText, final BehaviorSubject<String> subject) {
  3.  
  4. // Initial value
  5. editText.setText(subject.getValue());
  6.  
  7. // Text changes
  8. editText.addTextChangedListener(new TextWatcher() {
  9. @Override
  10. public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) {
  11. }
  12.  
  13. @Override
  14. public void onTextChanged(CharSequence charSequence, int start, int before, int count) {
  15. }
  16.  
  17. @Override
  18. public void afterTextChanged(Editable editable) {
  19. subject.onNext(editable.toString());
  20. }
  21. });
  22. }
Add Comment
Please, Sign In to add comment