List of usage examples for android.text InputType TYPE_TEXT_FLAG_AUTO_COMPLETE
int TYPE_TEXT_FLAG_AUTO_COMPLETE
To view the source code for android.text InputType TYPE_TEXT_FLAG_AUTO_COMPLETE.
Click Source Link
From source file:com.ntsync.android.sync.activities.KeyPasswordActivity.java
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); SystemHelper.initSystem(this); Log.i(TAG, "loading data from Intent"); final Intent intent = getIntent(); mUsername = intent.getStringExtra(PARAM_USERNAME); pwdSalt = intent.getByteArrayExtra(PARAM_SALT); pwdCheck = intent.getByteArrayExtra(PARAM_CHECK); requestWindowFeature(Window.FEATURE_LEFT_ICON); setContentView(R.layout.keypassword_activity); getWindow().setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, R.drawable.key); mMessage = (TextView) findViewById(R.id.message_bottom); mPasswordEdit = new AutoCompleteTextView[5]; mPasswordEdit[0] = (AutoCompleteTextView) findViewById(R.id.pwd1_edit); mPasswordEdit[1] = (AutoCompleteTextView) findViewById(R.id.pwd2_edit); mPasswordEdit[2] = (AutoCompleteTextView) findViewById(R.id.pwd3_edit); mPasswordEdit[3] = (AutoCompleteTextView) findViewById(R.id.pwd4_edit); mPasswordEdit[4] = (AutoCompleteTextView) findViewById(R.id.pwd5_edit); for (AutoCompleteTextView textView : mPasswordEdit) { textView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_PASSWORD); }/*from w w w . j av a 2 s . c o m*/ if (pwdSalt == null || pwdSalt.length != ClientKeyHelper.SALT_LENGHT || pwdCheck == null) { // disable password input for (AutoCompleteTextView textView : mPasswordEdit) { if (textView != null) { textView.setEnabled(false); } } } msgNewKey = (TextView) findViewById(R.id.message_newkey); SpannableString newKeyText = SpannableString.valueOf(getText(R.string.keypwd_activity_newkey_label)); newKeyText.setSpan(new InternalURLSpan(this), 0, newKeyText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); msgNewKey.setText(newKeyText, BufferType.SPANNABLE); msgNewKey.setMovementMethod(LinkMovementMethod.getInstance()); }
From source file:de.petermoesenthin.alarming.fragments.SetAlarmFragment.java
private void showAlarmMessageDialog(final AlarmCardRecyclerAdapter.AlarmCardViewHolder viewHolder, final int position) { Log.d(DEBUG_TAG, "Showing alarm message dialog"); LDialogView dialogView = new LDialogView(mContext, R.layout.dialog_content_edit_text, R.string.dialog_title_set_alarm_message); LDialog alarmMessageDialog = new LDialog(mContext, dialogView); final EditText editText = (EditText) dialogView.getView().findViewById(R.id.editText); editText.setInputType(InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); String prefText = mAlarmPrefs.get(position).getMessage(); editText.setText(prefText);/*ww w . ja va 2s . co m*/ alarmMessageDialog.setPositiveButtonListener(new LClickListener() { @Override public void onClick(AlertDialog dialog1) { String text = editText.getText().toString(); mAlarmPrefs.get(position).setMessage(text); viewHolder.alarmText.setText(text); PrefUtil.setAlarms(mContext, mAlarmPrefs); dialog1.dismiss(); } }); alarmMessageDialog.setNegativeButtonListener(new LClickListener() { @Override public void onClick(AlertDialog dialog) { dialog.dismiss(); } }); alarmMessageDialog.show(); }
From source file:research.sg.edu.edapp.kb.KbSoftKeyboard.java
/** * This is the main point where we do our initialization of the input method * to begin operating on an application. At this point we have been * bound to the client, and are now receiving all of the detailed information * about the target of our edits./*from ww w. ja v a 2 s . c om*/ */ @Override public void onStartInput(EditorInfo attribute, boolean restarting) { super.onStartInput(attribute, restarting); // Reset our state. We want to do this even if restarting, because // the underlying state of the text editor could have changed in any way. mComposing.setLength(0); updateCandidates(); if (!restarting) { // Clear shift states. mMetaState = 0; } mPredictionOn = false; mCompletionOn = false; mCompletions = null; // We are now going to initialize our state based on the type of // text being edited. switch (attribute.inputType & InputType.TYPE_MASK_CLASS) { case InputType.TYPE_CLASS_NUMBER: case InputType.TYPE_CLASS_DATETIME: // Numbers and dates default to the symbols keyboard, with // no extra features. mCurKeyboard = mSymbolsKeyboard; break; case InputType.TYPE_CLASS_PHONE: // Phones will also default to the symbols keyboard, though // often you will want to have a dedicated phone keyboard. mCurKeyboard = mSymbolsKeyboard; break; case InputType.TYPE_CLASS_TEXT: // This is general text editing. We will default to the // normal alphabetic keyboard, and assume that we should // be doing predictive text (showing candidates as the // user types). mCurKeyboard = mQwertyKeyboard; mPredictionOn = true; //mPredictionOn = false; // We now look for a few special variations of text that will // modify our behavior. int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION; if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD || variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) { // Do not display predictions / what the user is typing // when they are entering a password. mPredictionOn = false; } if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS || variation == InputType.TYPE_TEXT_VARIATION_URI || variation == InputType.TYPE_TEXT_VARIATION_FILTER) { // Our predictions are not useful for e-mail addresses // or URIs. mPredictionOn = false; } if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) { // If this is an auto-complete text view, then our predictions // will not be shown and instead we will allow the editor // to supply their own. We only show the editor's // candidates when in fullscreen mode, otherwise relying // own it displaying its own UI. mPredictionOn = false; mCompletionOn = isFullscreenMode(); } // We also want to look at the current state of the editor // to decide whether our alphabetic keyboard should start out // shifted. updateShiftKeyState(attribute); break; default: // For all unknown input types, default to the alphabetic // keyboard with no special features. mCurKeyboard = mQwertyKeyboard; updateShiftKeyState(attribute); } // Update the label on the enter key, depending on what the application // says it will do. mCurKeyboard.setImeOptions(getResources(), attribute.imeOptions); }
From source file:io.github.vomitcuddle.SearchViewAllowEmpty.SearchView.java
/** * Updates the auto-complete text view.//from ww w . j a v a2 s.c o m */ private void updateSearchAutoComplete() { 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); } }
From source file:android.support.v7.widget.SearchView.java
/** * Updates the auto-complete text view.//from ww w .j a v a 2 s.c o m */ @TargetApi(Build.VERSION_CODES.FROYO) private void updateSearchAutoComplete() { mSearchSrcTextView.setThreshold(mSearchable.getSuggestThreshold()); mSearchSrcTextView.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; } } mSearchSrcTextView.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); mSearchSrcTextView.setAdapter(mSuggestionsAdapter); ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement( mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY); } }
From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java
/** * Updates the auto-complete text view./*from w w w.j a v a 2s . c om*/ */ 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); } }
From source file:com.example.navigationsearchview.NavigationSearchView.java
/** * Updates the auto-complete text view./*from www . java 2 s. com*/ */ @TargetApi(Build.VERSION_CODES.FROYO) private void updateSearchAutoComplete() { mSearchSrcTextView.setThreshold(mSearchable.getSuggestThreshold()); mSearchSrcTextView.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; } } mSearchSrcTextView.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); mSearchSrcTextView.setAdapter(mSuggestionsAdapter); ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement( mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY); } }
From source file:com.tandong.sa.sherlock.widget.SearchView.java
/** * Updates the auto-complete text view.//from www . j a v a2 s.c o m */ 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); } }