Java Code Examples for android.text.TextWatcher#beforeTextChanged()

The following examples show how to use android.text.TextWatcher#beforeTextChanged() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactAztecText.java    From react-native-aztec with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    if (!mIsSettingTextFromJS && mListeners != null) {
        for (TextWatcher listener : mListeners) {
            listener.beforeTextChanged(s, start, count, after);
        }
    }
}
 
Example 2
Source File: ReactEditText.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  if (!mIsSettingTextFromJS && mListeners != null) {
    for (TextWatcher listener : mListeners) {
      listener.beforeTextChanged(s, start, count, after);
    }
  }
}
 
Example 3
Source File: MentionsEditText.java    From Spyglass with Apache License 2.0 5 votes vote down vote up
/**
 * Notify external text watchers that the text is about to change.
 * See {@link TextWatcher#beforeTextChanged(CharSequence, int, int, int)}.
 */
private void sendBeforeTextChanged(CharSequence text, int start, int before, int after) {
    final List<TextWatcher> list = mExternalTextWatchers;
    final int count = list.size();
    for (int i = 0; i < count; i++) {
        TextWatcher watcher = list.get(i);
        // Self check to avoid infinite loop
        if (watcher != this) {
            watcher.beforeTextChanged(text, start, before, after);
        }
    }
}
 
Example 4
Source File: DownloadManager.java    From Dashchan with Apache License 2.0 5 votes vote down vote up
private void refreshDropDownContents() {
	Editable editable = editText.getEditableText();
	TextWatcher[] watchers = editable.getSpans(0, editable.length(), TextWatcher.class);
	if (watchers != null) {
		for (TextWatcher watcher : watchers) {
			watcher.beforeTextChanged(editable, 0, 0, 0);
			watcher.onTextChanged(editable, 0, 0, 0);
			watcher.afterTextChanged(editable);
		}
	}
}
 
Example 5
Source File: JieEditTextDel.java    From AndJie with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
		int after) {
	for (TextWatcher watch : mTextWatchers) {
		watch.beforeTextChanged(s, start, count, after);
	}
}
 
Example 6
Source File: TextInputSpec.java    From litho with Apache License 2.0 4 votes vote down vote up
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  for (TextWatcher w : mTextWatchers) {
    w.beforeTextChanged(s, start, count, after);
  }
}