本文整理汇总了Java中android.text.TextWatcher.afterTextChanged方法的典型用法代码示例。如果您正苦于以下问题:Java TextWatcher.afterTextChanged方法的具体用法?Java TextWatcher.afterTextChanged怎么用?Java TextWatcher.afterTextChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.TextWatcher
的用法示例。
在下文中一共展示了TextWatcher.afterTextChanged方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInputEmail
import android.text.TextWatcher; //导入方法依赖的package包/类
@Test
public void testInputEmail() {
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append("abcdef");
TextWatcher textWatcher = new CustomTextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
super.afterTextChanged(editable);
loginRequest.setEmail(editable.toString());
}
};
assertEquals("abcdef", builder.toString());
textWatcher.afterTextChanged(builder);
assertFalse(loginRequest.isEmailEmpty());
assertFalse(loginRequest.isValidEmail());
builder.clear();
builder.append("[email protected]");
textWatcher.afterTextChanged(builder);
assertTrue(loginRequest.isValidEmail());
}
示例2: testInputPassword
import android.text.TextWatcher; //导入方法依赖的package包/类
@Test
public void testInputPassword() {
SpannableStringBuilder builder = new SpannableStringBuilder();
builder.append("abcd");
TextWatcher textWatcher = new CustomTextWatcher() {
@Override
public void afterTextChanged(Editable editable) {
super.afterTextChanged(editable);
loginRequest.setPassword(editable.toString());
}
};
textWatcher.afterTextChanged(builder);
assertFalse(loginRequest.isPasswordEmpty());
assertFalse(loginRequest.isValidPassword());
builder.clear();
builder.append("abcd123");
textWatcher.afterTextChanged(builder);
assertTrue(loginRequest.isValidPassword());
}
示例3: notifyListener
import android.text.TextWatcher; //导入方法依赖的package包/类
@Test
public void notifyListener() throws Exception {
// Given
TextWatcher watcher = TextWatcherAdapter.whenTextChanged(listener);
given(editable.toString())
.willReturn("value");
// When
watcher.afterTextChanged(editable);
// Then
verify(listener).onTextChanged("value");
}
示例4: afterTextChanged
import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
if (!mIsSettingTextFromJS && mListeners != null) {
for (TextWatcher listener : mListeners) {
listener.afterTextChanged(s);
}
}
}
示例5: whenViewChanged
import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
protected void whenViewChanged() {
verify(((TextView) mView), atMost(2)).addTextChangedListener(mTextWatcherArgumentCaptor.capture());
if (mTextWatcherArgumentCaptor.getAllValues().size() > 0) {
TextWatcher listener = mTextWatcherArgumentCaptor.getValue();
if (listener != null) {
Editable editable = mock(Editable.class);
when(editable.toString()).thenReturn(NEW_VALUE);
listener.afterTextChanged(editable);
}
}
}
示例6: refreshDropDownContents
import android.text.TextWatcher; //导入方法依赖的package包/类
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);
}
}
}
示例7: simulateTextInput
import android.text.TextWatcher; //导入方法依赖的package包/类
private static String simulateTextInput(TextWatcher tw, String original, String input) {
// TODO review all the int parameters
tw.beforeTextChanged(original, 0, original.length(), input.length());
String newText = original + input;
tw.onTextChanged(newText, 1, newText.length() - 1, 1);
Editable editable = new SpannableStringBuilder(newText);
tw.afterTextChanged(editable);
return editable.toString();
}
示例8: afterTextChanged
import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
for (TextWatcher watch : mTextWatchers) {
watch.afterTextChanged(s);
}
}