本文整理汇总了Java中android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS属性的典型用法代码示例。如果您正苦于以下问题:Java InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS属性的具体用法?Java InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS怎么用?Java InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.text.InputType
的用法示例。
在下文中一共展示了InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toFlagsString
private static String toFlagsString(final int flags) {
final ArrayList<String> flagsArray = new ArrayList<>();
if (0 != (flags & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS))
flagsArray.add("TYPE_TEXT_FLAG_NO_SUGGESTIONS");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_MULTI_LINE))
flagsArray.add("TYPE_TEXT_FLAG_MULTI_LINE");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE))
flagsArray.add("TYPE_TEXT_FLAG_IME_MULTI_LINE");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_WORDS))
flagsArray.add("TYPE_TEXT_FLAG_CAP_WORDS");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES))
flagsArray.add("TYPE_TEXT_FLAG_CAP_SENTENCES");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS))
flagsArray.add("TYPE_TEXT_FLAG_CAP_CHARACTERS");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT))
flagsArray.add("TYPE_TEXT_FLAG_AUTO_CORRECT");
if (0 != (flags & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE))
flagsArray.add("TYPE_TEXT_FLAG_AUTO_COMPLETE");
return flagsArray.isEmpty() ? "" : Arrays.toString(flagsArray.toArray());
}
示例2: setInputType
@Override
public void setInputType(int type) {
if (type == -1) {
type = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD;
}
if (type == InputType.TYPE_CLASS_NUMBER ||
type == InputType.TYPE_NUMBER_FLAG_SIGNED ||
type == InputType.TYPE_NUMBER_FLAG_DECIMAL ||
type == InputType.TYPE_CLASS_PHONE) {
final String symbolExceptions = getSymbolExceptions();
this.setKeyListener(DigitsKeyListener.getInstance("0123456789." + symbolExceptions));
} else {
super.setInputType(type);
}
}
示例3: updateSearchAutoComplete
/**
* Updates the auto-complete text view.
*/
private void updateSearchAutoComplete() {
// TODO mQueryTextView.setDropDownAnimationStyle(0); // no animation
mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
mQueryTextView.setImeOptions(mSearchable.getImeOptions());
int inputType = mSearchable.getInputType();
// We only touch this if the input type is set up for text (which it almost certainly
// should be, in the case of search!)
if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
// The existence of a suggestions authority is the proxy for "suggestions
// are available here"
inputType &= ~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
if (mSearchable.getSuggestAuthority() != null) {
inputType |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
// TYPE_TEXT_FLAG_AUTO_COMPLETE means that the text editor is performing
// auto-completion based on its own semantics, which it will present to the user
// as they type. This generally means that the input method should not show its
// own candidates, and the spell checker should not be in action. The text editor
// supplies its candidates by calling InputMethodManager.displayCompletions(),
// which in turn will call InputMethodSession.displayCompletions().
inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
}
mQueryTextView.setInputType(inputType);
if (mSuggestionsAdapter != null) {
mSuggestionsAdapter.changeCursor(null);
}
// attach the suggestions adapter, if suggestions are available
// The existence of a suggestions authority is the proxy for "suggestions available here"
if (mSearchable.getSuggestAuthority() != null) {
mSuggestionsAdapter = new SuggestionsAdapter(getContext(),
this, mSearchable, mOutsideDrawablesCache);
mQueryTextView.setAdapter(mSuggestionsAdapter);
((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement(
mQueryRefinement ? SuggestionsAdapter.REFINE_ALL
: SuggestionsAdapter.REFINE_BY_ENTRY);
}
}
示例4: InputAttributes
public InputAttributes(final EditorInfo editorInfo, final boolean isFullscreenMode) {
mTargetApplicationPackageName = null != editorInfo ? editorInfo.packageName : null;
final int inputType = null != editorInfo ? editorInfo.inputType : 0;
final int inputClass = inputType & InputType.TYPE_MASK_CLASS;
mInputType = inputType;
mIsPasswordField = InputTypeUtils.isPasswordInputType(inputType)
|| InputTypeUtils.isVisiblePasswordInputType(inputType);
if (inputClass != InputType.TYPE_CLASS_TEXT) {
// If we are not looking at a TYPE_CLASS_TEXT field, the following strange
// cases may arise, so we do a couple sanity checks for them. If it's a
// TYPE_CLASS_TEXT field, these special cases cannot happen, by construction
// of the flags.
if (null == editorInfo) {
Log.w(TAG, "No editor info for this field. Bug?");
} else if (InputType.TYPE_NULL == inputType) {
// TODO: We should honor TYPE_NULL specification.
Log.i(TAG, "InputType.TYPE_NULL is specified");
} else if (inputClass == 0) {
// TODO: is this check still necessary?
Log.w(TAG, String.format("Unexpected input class: inputType=0x%08x"
+ " imeOptions=0x%08x", inputType, editorInfo.imeOptions));
}
mShouldShowSuggestions = false;
mInputTypeNoAutoCorrect = false;
mApplicationSpecifiedCompletionOn = false;
mShouldInsertSpacesAutomatically = false;
return;
}
// inputClass == InputType.TYPE_CLASS_TEXT
final int variation = inputType & InputType.TYPE_MASK_VARIATION;
final boolean flagNoSuggestions =
0 != (inputType & InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
final boolean flagMultiLine =
0 != (inputType & InputType.TYPE_TEXT_FLAG_MULTI_LINE);
final boolean flagAutoCorrect =
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
final boolean flagAutoComplete =
0 != (inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
// TODO: Have a helper method in InputTypeUtils
// Make sure that passwords are not displayed in {@link SuggestionStripView}.
final boolean shouldSuppressSuggestions = mIsPasswordField
|| InputTypeUtils.isEmailVariation(variation)
|| InputType.TYPE_TEXT_VARIATION_URI == variation
|| InputType.TYPE_TEXT_VARIATION_FILTER == variation
|| flagNoSuggestions
|| flagAutoComplete;
mShouldShowSuggestions = !shouldSuppressSuggestions;
mShouldInsertSpacesAutomatically = InputTypeUtils.isAutoSpaceFriendlyType(inputType);
// If it's a browser edit field and auto correct is not ON explicitly, then
// disable auto correction, but keep suggestions on.
// If NO_SUGGESTIONS is set, don't do prediction.
// If it's not multiline and the autoCorrect flag is not set, then don't correct
mInputTypeNoAutoCorrect =
(variation == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT && !flagAutoCorrect)
|| flagNoSuggestions
|| (!flagAutoCorrect && !flagMultiLine);
mApplicationSpecifiedCompletionOn = flagAutoComplete && isFullscreenMode;
}
示例5: getInputType
@Override
public int getInputType() {
return EditorInfo.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
示例6: getInputType
@Override
public int getInputType() {
return EditorInfo.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
}
示例7: setAuthType
/**
* 设置验证类型
*
* @param authType {@link AuthType}
*/
public void setAuthType(AuthType authType)
{
if(this.authType == authType)
{
return;
}
/**
* 在 {@link #authType} 值被改变之前,判断是不是需要清空文本.
*/
boolean needClearText = needClearText(authType);
this.authType = authType;
int inputType = InputType.TYPE_CLASS_NUMBER;
switch(this.authType)
{
case NUMBER:
inputType = InputType.TYPE_CLASS_NUMBER;
break;
case PASSWORD:
inputType = InputType.TYPE_TEXT_VARIATION_PASSWORD;
break;
case VISIBLE_PASSWORD:
inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
break;
case NUMBER_PASSWORD:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
{
inputType = InputType.TYPE_NUMBER_VARIATION_PASSWORD;
}
break;
case DEFAULT:
/**
* 这里的 InputType 不设置为 {@link InputType.TYPE_NULL},是因为设置这个后,
* {@link AuthEditText} 的点击事件失效
*/
inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
break;
}
etInput.setInputType(inputType);
if(needClearText)
{
clearText();
}
/**
* 输入类型变化时,需要手动更改文本。直接调用 {@link TextView#setInputType(int)} 没有作用.
*/
for(int i = 0; i < list.size(); i++)
{
if(string.length() > i)
{
fillTextByIndex(i);
}
}
}