本文整理匯總了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);
}
}