當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。