当前位置: 首页>>代码示例>>Java>>正文


Java TextWatcher.afterTextChanged方法代码示例

本文整理汇总了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());
}
 
开发者ID:chungtruong,项目名称:AndroidDataBinding,代码行数:21,代码来源:LoginViewModelTest.java

示例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());
}
 
开发者ID:chungtruong,项目名称:AndroidDataBinding,代码行数:20,代码来源:LoginViewModelTest.java

示例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");
}
 
开发者ID:dmitry-zaitsev,项目名称:BlueTape,代码行数:15,代码来源:TextWatcherAdapterTest.java

示例4: afterTextChanged

import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
  if (!mIsSettingTextFromJS && mListeners != null) {
    for (TextWatcher listener : mListeners) {
      listener.afterTextChanged(s);
    }
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:9,代码来源:ReactEditText.java

示例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);
        }
    }
}
 
开发者ID:raycoarana,项目名称:baindo,代码行数:13,代码来源:TextBindTest.java

示例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);
		}
	}
}
 
开发者ID:Mishiranu,项目名称:Dashchan,代码行数:12,代码来源:DownloadManager.java

示例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();
}
 
开发者ID:vdurmont,项目名称:creditcard4j,代码行数:13,代码来源:CreditCardEditTextWatcherTest.java

示例8: afterTextChanged

import android.text.TextWatcher; //导入方法依赖的package包/类
@Override
public void afterTextChanged(Editable s) {
	for (TextWatcher watch : mTextWatchers) {
		watch.afterTextChanged(s);
	}
}
 
开发者ID:jwzhangjie,项目名称:AndJie,代码行数:7,代码来源:JieEditTextDel.java


注:本文中的android.text.TextWatcher.afterTextChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。