Пример #1
0
        public void onTextChanged(CharSequence s, int start, int before, int after) {
          LcSearchView.this.onTextChanged(s);

          if (mTextChangerListener != null) {
            mTextChangerListener.onTextChanged(s, start, before, after);
          }
        }
 @Override
 public void setText(CharSequence text, BufferType type) {
   if (mTextWatchersEnabled) {
     for (TextWatcher textWatcher : mTextWatchers) {
       textWatcher.beforeTextChanged(getCleanText(), 0, 0, 0);
     }
   }
   super.setText(text, type);
   if (text != null && !mIsInserting) {
     setSelection(getText().length());
   }
   invalidateTextSize();
   if (mTextWatchersEnabled) {
     for (TextWatcher textWatcher : mTextWatchers) {
       textWatcher.afterTextChanged(getEditableFactory().newEditable(getCleanText()));
       textWatcher.onTextChanged(getCleanText(), 0, 0, 0);
     }
   }
 }
 @Override
 public void addTextChangedListener(TextWatcher watcher) {
   // Some flavors of Android call addTextChangedListener in the constructor, so add a
   // null check to mTextWatchers
   if (watcher.equals(mTextWatcher) || mTextWatchers == null) {
     super.addTextChangedListener(watcher);
   } else {
     mTextWatchers.add(watcher);
   }
 }
Пример #4
0
 public void afterTextChanged(Editable s) {
   if (mTextChangerListener != null) {
     mTextChangerListener.afterTextChanged(s);
   }
 }
Пример #5
0
 public void beforeTextChanged(CharSequence s, int start, int before, int after) {
   if (mTextChangerListener != null) {
     mTextChangerListener.beforeTextChanged(s, start, before, after);
   }
 }
Пример #6
0
 private void sendBeforeTextChanged(CharSequence newValue) {
   for (TextWatcher watcher : watchers) {
     watcher.beforeTextChanged(this.text, 0, this.text.length(), newValue.length());
   }
 }
Пример #7
0
 private void sendOnTextChanged(CharSequence oldValue) {
   for (TextWatcher watcher : watchers) {
     watcher.onTextChanged(text, 0, oldValue.length(), text.length());
   }
 }
Пример #8
0
 private void sendAfterTextChanged() {
   for (TextWatcher watcher : watchers) {
     watcher.afterTextChanged(new SpannableStringBuilder(getText()));
   }
 }