當前位置: 首頁>>代碼示例>>Java>>正文


Java Editable.clear方法代碼示例

本文整理匯總了Java中android.text.Editable.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java Editable.clear方法的具體用法?Java Editable.clear怎麽用?Java Editable.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.text.Editable的用法示例。


在下文中一共展示了Editable.clear方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromUser

import android.text.Editable; //導入方法依賴的package包/類
/**
 * Creates a SafeHelperFactory from an Editable, such as what you get by
 * calling getText() on an EditText.
 *
 * The Editable will be cleared as part of this call.
 *
 * @param editor the user's supplied passphrase
 * @return a SafeHelperFactory
 */
public static SafeHelperFactory fromUser(Editable editor) {
  char[] passphrase=new char[editor.length()];
  SafeHelperFactory result;

  editor.getChars(0, editor.length(), passphrase, 0);

  try {
    result=new SafeHelperFactory(passphrase);
  }
  finally {
    editor.clear();
  }

  return(result);
}
 
開發者ID:commonsguy,項目名稱:cwac-saferoom,代碼行數:25,代碼來源:SafeHelperFactory.java

示例2: setupUserAutocomplete

import android.text.Editable; //導入方法依賴的package包/類
private void setupUserAutocomplete() {
    EditText edit = (EditText) findViewById(R.id.single);
    float elevation = 6f;
    Drawable backgroundDrawable = new ColorDrawable(Color.WHITE);
    AutocompletePresenter<User> presenter = new UserPresenter(this);
    AutocompleteCallback<User> callback = new AutocompleteCallback<User>() {
        @Override
        public boolean onPopupItemClicked(Editable editable, User item) {
            editable.clear();
            editable.append(item.getFullname());
            return true;
        }

        public void onPopupVisibilityChanged(boolean shown) {}
    };

    userAutocomplete = Autocomplete.<User>on(edit)
            .with(elevation)
            .with(backgroundDrawable)
            .with(presenter)
            .with(callback)
            .build();
}
 
開發者ID:natario1,項目名稱:Autocomplete,代碼行數:24,代碼來源:MainActivity.java

示例3: applyMask

import android.text.Editable; //導入方法依賴的package包/類
private void applyMask(Editable text) {
    if (TextUtils.isEmpty(text) || !hasMask()) {
        return;
    }

    //remove input filters to ignore input type
    InputFilter[] filters = text.getFilters();
    text.setFilters(new InputFilter[0]);

    int maskLen = mask.length();
    int textLen = text.length();

    int i = 0;
    int notSymbolIndex = 0;
    StringBuilder sb = new StringBuilder();
    while (i < maskLen && notSymbolIndex < textLen) {
        if (mask.charAt(i) == text.charAt(notSymbolIndex) || mask.charAt(i) == REPLACE_CHAR) {
            sb.append(text.charAt(notSymbolIndex));
            notSymbolIndex++;
        } else {
            sb.append(mask.charAt(i));
        }
        i++;
    }

    text.clear();
    text.append(sb.toString());

    //reset filters
    text.setFilters(filters);
}
 
開發者ID:santalu,項目名稱:mask-edittext,代碼行數:32,代碼來源:MaskEditText.java

示例4: rekey

import android.text.Editable; //導入方法依賴的package包/類
/**
 * Changes the passphrase associated with this database. The supplied
 * Editable is cleared as part of this operation.
 *
 * @param editor source of passphrase, presumably from a user
 */
public void rekey(Editable editor) {
  char[] passphrase=new char[editor.length()];

  editor.getChars(0, editor.length(), passphrase, 0);

  try {
    rekey(passphrase);
  }
  finally {
    editor.clear();
  }
}
 
開發者ID:commonsguy,項目名稱:cwac-saferoom,代碼行數:19,代碼來源:Database.java

示例5: setupMaleFemaleAutocomplete

import android.text.Editable; //導入方法依賴的package包/類
private void setupMaleFemaleAutocomplete() {
    EditText edit = (EditText) findViewById(R.id.topbar);
    float elevation = 6f;
    Drawable backgroundDrawable = new ColorDrawable(Color.WHITE);
    AutocompletePresenter<User> presenter = new MaleFemalePresenter(this);
    AutocompleteCallback<User> callback = new AutocompleteCallback<User>() {
        @Override
        public boolean onPopupItemClicked(Editable editable, User item) {
            editable.clear();
            editable.append(item.getFullname())
                    .append(" ")
                    .append(item.isFemale() ? "(Female)" : "(Male)");
            editable.setSpan(new StyleSpan(Typeface.BOLD), 0, item.getFullname().length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            return true;
        }

        public void onPopupVisibilityChanged(boolean shown) {}
    };

    maleFemaleAutocomplete = Autocomplete.<User>on(edit)
            .with(elevation)
            .with(backgroundDrawable)
            .with(presenter)
            .with(callback)
            .build();
}
 
開發者ID:natario1,項目名稱:Autocomplete,代碼行數:28,代碼來源:MainActivity.java

示例6: getCharArray

import android.text.Editable; //導入方法依賴的package包/類
final char[] getCharArray(boolean clear) {
    Editable editable = super.getText();
    char[] chars = new char[editable.length()];
    editable.getChars(0, chars.length, chars, 0);
    if (clear) editable.clear();
    return chars;
}
 
開發者ID:tresorit,項目名稱:ZeroKit-Android-SDK,代碼行數:8,代碼來源:PasswordEditText.java

示例7: afterTextChanged

import android.text.Editable; //導入方法依賴的package包/類
@Override
public void afterTextChanged(final Editable s) {
    // workaround for German keyboards
    final String original = s.toString();
    final String replaced = original.replace(',', '.');
    if (!replaced.equals(original)) {
        s.clear();
        s.append(replaced);
    }

    MonetarySpannable.applyMarkup(s, null, MonetarySpannable.STANDARD_SIGNIFICANT_SPANS,
            MonetarySpannable.STANDARD_INSIGNIFICANT_SPANS);
}
 
開發者ID:guodroid,項目名稱:okwallet,代碼行數:14,代碼來源:CurrencyAmountView.java


注:本文中的android.text.Editable.clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。