本文整理了Java中android.text.TextWatcher.beforeTextChanged()
方法的一些代码示例,展示了TextWatcher.beforeTextChanged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextWatcher.beforeTextChanged()
方法的具体详情如下:
包路径:android.text.TextWatcher
类名称:TextWatcher
方法名:beforeTextChanged
暂无
代码示例来源:origin: facebook/litho
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
for (TextWatcher w : mTextWatchers) {
w.beforeTextChanged(s, start, count, after);
}
}
代码示例来源:origin: facebook/litho
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (mDelegates != null) {
for (int i = 0, stop = mDelegates.size(); i < stop; i++) {
mDelegates.get(i).beforeTextChanged(s, start, count, after);
}
}
// Only need the previous line count when state update policy is ON_LINE_COUNT_CHANGE
if (mStateUpdatePolicy == UPDATE_ON_LINE_COUNT_CHANGE) {
mPrevLineCount = getLineCount();
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void whenSettingText_ShouldFireBeforeTextChangedWithCorrectArguments() {
textView.setText(INITIAL_TEXT);
TextWatcher mockTextWatcher = mock(TextWatcher.class);
textView.addTextChangedListener(mockTextWatcher);
textView.setText(NEW_TEXT);
verify(mockTextWatcher).beforeTextChanged(INITIAL_TEXT, 0, INITIAL_TEXT.length(), NEW_TEXT.length());
}
代码示例来源:origin: robolectric/robolectric
@Test
public void whenAppendingText_ShouldFireBeforeTextChangedWithCorrectArguments() {
textView.setText(INITIAL_TEXT);
TextWatcher mockTextWatcher = mock(TextWatcher.class);
textView.addTextChangedListener(mockTextWatcher);
textView.append(NEW_TEXT);
verify(mockTextWatcher).beforeTextChanged(eq(INITIAL_TEXT), eq(0), eq(INITIAL_TEXT.length()), eq(INITIAL_TEXT.length()));
}
代码示例来源:origin: sharish/WhatsappFormatter
private static void sendBeforeTextChanged(TextWatcher[] mListeners, CharSequence s, int start, int count, int after) {
if (mListeners != null) {
for (int i = 0; i < mListeners.length; i++) {
mListeners[i].beforeTextChanged(s, start, count, after);
}
}
}
代码示例来源:origin: hylinux1024/Componentization
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (mTextWatcher != null) {
mTextWatcher.beforeTextChanged(s, start, count, after);
}
}
代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
if (mTextWatcher != null) {
mTextWatcher.beforeTextChanged(s, start, count, after);
}
}
代码示例来源:origin: sunhapper/SpEditTool
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
((TextWatcher) mObject).beforeTextChanged(s, start, count, after);
}
代码示例来源:origin: yydcdut/RxMarkdown
private void sendBeforeTextChanged(CharSequence s, int start, int before, int after) {
if (mListeners != null) {
final ArrayList<TextWatcher> list = mListeners;
final int count = list.size();
for (int i = 0; i < count; i++) {
list.get(i).beforeTextChanged(s, start, before, after);
}
}
}
代码示例来源:origin: linkedin/Spyglass
/**
* 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);
if (watcher != this) {
watcher.beforeTextChanged(text, start, before, after);
}
}
}
代码示例来源:origin: com.github.japgolly.android.test/robolectric
private void sendBeforeTextChanged(CharSequence newValue) {
for (TextWatcher watcher : watchers) {
watcher.beforeTextChanged(this.text, 0, this.text.length(), newValue.length());
}
}
代码示例来源:origin: sharish/WhatsappFormatter
/**
* Send an before text change event to child listeners
*
* @see {@link TextWatcher#beforeTextChanged(CharSequence, int, int, int)}
*/
private void sendBeforeTextChanged(CharSequence s, int start, int count, int after) {
if (mListeners != null) {
for (int i = 0; i < mListeners.size(); i++) {
mListeners.get(i).beforeTextChanged(s, start, count, after);
}
}
}
代码示例来源:origin: sharish/WhatsappFormatter
/**
* Send an before text change event to child listeners
* @see {@link TextWatcher#beforeTextChanged(CharSequence, int, int, int)}
*/
private void sendBeforeTextChanged(CharSequence s, int start, int count, int after) {
if (mListeners != null) {
for (int i = 0; i < mListeners.size(); i++) {
mListeners.get(i).beforeTextChanged(s, start, count, after);
}
}
}
代码示例来源:origin: dkzwm/FormatEditText
private void sendBeforeTextChanged(CharSequence s, int start, int count, int after) {
if (mWatchers != null) {
final List<TextWatcher> list = mWatchers;
final int size = list.size();
for (int i = 0; i < size; i++) {
list.get(i).beforeTextChanged(s, start, count, after);
}
}
}
代码示例来源:origin: stackoverflow.com
mTextWatcher.beforeTextChanged(s, start, count, after);
内容来源于网络,如有侵权,请联系作者删除!