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

The following examples show how to use android.text.TextWatcher#onTextChanged() . 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: AlertBuilder.java    From biermacht with Apache License 2.0 6 votes vote down vote up
public <T> AlertDialog.Builder searchableListAlert(final TextView text, final TextView title, final ArrayAdapter<T> adapter,
                                                   final ArrayList<T> list, final OnItemClickListener listener, TextWatcher textWatcher) {
  LayoutInflater factory = LayoutInflater.from(context);
  final LinearLayout alertView = (LinearLayout) factory.inflate(R.layout.alert_view_searchable_list, null);
  final EditText editText = (EditText) alertView.findViewById(R.id.edit_text);
  final ListView listView = (ListView) alertView.findViewById(R.id.list);
  listView.setOnItemClickListener(listener);
  listView.setAdapter(adapter);

  // Search text watcher.
  editText.addTextChangedListener(textWatcher);
  textWatcher.onTextChanged("", 0, 0, 0);

  return new AlertDialog.Builder(context)
          .setTitle(title.getText().toString())
          .setView(alertView)
          .setNegativeButton(R.string.cancel, null);
}
 
Example 2
Source File: ReactAztecText.java    From react-native-aztec with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
    if (!mIsSettingTextFromJS && mListeners != null) {
        for (TextWatcher listener : mListeners) {
            listener.onTextChanged(s, start, before, count);
        }
    }

    onContentSizeChange();
}
 
Example 3
Source File: ReactEditText.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
  if (!mIsSettingTextFromJS && mListeners != null) {
    for (TextWatcher listener : mListeners) {
      listener.onTextChanged(s, start, before, count);
    }
  }

  onContentSizeChange();
}
 
Example 4
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 changing.
 * See {@link TextWatcher#onTextChanged(CharSequence, int, int, int)}.
 */
private void sendOnTextChanged(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.onTextChanged(text, start, before, after);
        }
    }
}
 
Example 5
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 6
Source File: JieEditTextDel.java    From AndJie with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before,
		int count) {
	for (TextWatcher watch : mTextWatchers) {
		watch.onTextChanged(s, start, before, count);
	}

	if (s.length() > 0 && isDelEnable) {
		rightImg.setVisibility(View.VISIBLE);
	} else if (isDelEnable) {
		rightImg.setVisibility(View.INVISIBLE);
	} else {
		rightImg.setVisibility(View.GONE);
	}
}
 
Example 7
Source File: TextInputSpec.java    From litho with Apache License 2.0 4 votes vote down vote up
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
  for (TextWatcher w : mTextWatchers) {
    w.onTextChanged(s, start, before, count);
  }
}