List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_NONE
int IME_ACTION_NONE
To view the source code for android.view.inputmethod EditorInfo IME_ACTION_NONE.
Click Source Link
From source file:org.openintents.historify.ui.fragments.ContactsListFragment.java
/** Called to have the fragment instantiate its user interface view. */ @Override/*from w ww .j a v a2 s.c om*/ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup layout = (ViewGroup) inflater.inflate(R.layout.fragment_contacts_list, container, false); // init search panel mSearchBar = (ViewGroup) layout.findViewById(R.id.searchBar); mEditSearch = (EditText) mSearchBar.findViewById(R.id.searchBar_editSearch); mEditSearch.setHint(R.string.searchbar_contacts_hint); if (savedInstanceState != null) { mSearchBar.setVisibility(savedInstanceState.getInt(STATE_SEARCH_VISIBILITY)); mEditSearch.setText(savedInstanceState.getString(STATE_SEARCH_CONTENT)); } mEditSearch.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } public void afterTextChanged(Editable s) { notifySearchTextChanged(); } }); mEditSearch.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NONE) { if (v.getText().toString().trim().equals("")) //empty search field -- so we hide it onSearchSelected(); } return false; } }); // init listview mLstContacts = (ListView) layout.findViewById(R.id.contacts_lstContacts); mLstContacts.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Contact selected = (Contact) parent.getItemAtPosition(position); onContactSelected(selected); } }); // init list empty view View lstContactsEmptyView = inflater.inflate(R.layout.list_empty_view, null); ((TextView) lstContactsEmptyView).setText(R.string.contacts_no_contacts); ((ViewGroup) mLstContacts.getParent()).addView(lstContactsEmptyView); mLstContacts.setEmptyView(lstContactsEmptyView); return layout; }
From source file:org.cocos2dx.lib.Cocos2dxEditBoxDialog.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); getWindow().setBackgroundDrawable(new ColorDrawable(0x80000000)); LinearLayout layout = new LinearLayout(mParentActivity); layout.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); mTextViewTitle = new TextView(mParentActivity); LinearLayout.LayoutParams textviewParams = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); textviewParams.leftMargin = textviewParams.rightMargin = convertDipsToPixels(10); mTextViewTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20); layout.addView(mTextViewTitle, textviewParams); mInputEditText = new EditText(mParentActivity); LinearLayout.LayoutParams editTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); editTextParams.leftMargin = editTextParams.rightMargin = convertDipsToPixels(10); layout.addView(mInputEditText, editTextParams); setContentView(layout, layoutParams); getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); mInputMode = mMsg.inputMode;// ww w. j a va 2s.co m mInputFlag = mMsg.inputFlag; mReturnType = mMsg.returnType; mMaxLength = mMsg.maxLength; mTextViewTitle.setText(mMsg.title); mInputEditText.setText(mMsg.content); int oldImeOptions = mInputEditText.getImeOptions(); mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_FLAG_NO_EXTRACT_UI); oldImeOptions = mInputEditText.getImeOptions(); switch (mInputMode) { case kEditBoxInputModeAny: mInputModeContraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE; break; case kEditBoxInputModeEmailAddr: mInputModeContraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; break; case kEditBoxInputModeNumeric: mInputModeContraints = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED; break; case kEditBoxInputModePhoneNumber: mInputModeContraints = InputType.TYPE_CLASS_PHONE; break; case kEditBoxInputModeUrl: mInputModeContraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI; break; case kEditBoxInputModeDecimal: mInputModeContraints = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED; break; case kEditBoxInputModeSingleLine: mInputModeContraints = InputType.TYPE_CLASS_TEXT; break; default: break; } if (mIsMultiline) { mInputModeContraints |= InputType.TYPE_TEXT_FLAG_MULTI_LINE; } mInputEditText.setInputType(mInputModeContraints | mInputFlagConstraints); switch (mInputFlag) { case kEditBoxInputFlagPassword: mInputFlagConstraints = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD; break; case kEditBoxInputFlagSensitive: mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS; break; case kEditBoxInputFlagInitialCapsWord: mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_WORDS; break; case kEditBoxInputFlagInitialCapsSentence: mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; break; case kEditBoxInputFlagInitialCapsAllCharacters: mInputFlagConstraints = InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; break; default: break; } mInputEditText.setInputType(mInputFlagConstraints | mInputModeContraints); switch (mReturnType) { case kKeyboardReturnTypeDefault: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_NONE); break; case kKeyboardReturnTypeDone: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_DONE); break; case kKeyboardReturnTypeSend: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_SEND); break; case kKeyboardReturnTypeSearch: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_SEARCH); break; case kKeyboardReturnTypeGo: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_GO); break; default: mInputEditText.setImeOptions(oldImeOptions | EditorInfo.IME_ACTION_NONE); break; } if (mMaxLength > 0) { mInputEditText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(mMaxLength) }); } Handler initHandler = new Handler(); initHandler.postDelayed(new Runnable() { public void run() { mInputEditText.requestFocus(); mInputEditText.setSelection(mInputEditText.length()); openKeyboard(); } }, 200); mInputEditText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // if user didn't set keyboard type, // this callback will be invoked twice with 'KeyEvent.ACTION_DOWN' and 'KeyEvent.ACTION_UP' if (actionId != EditorInfo.IME_NULL || (actionId == EditorInfo.IME_NULL && event != null && event.getAction() == KeyEvent.ACTION_DOWN)) { //Log.d("EditBox", "actionId: "+actionId +",event: "+event); mParentActivity.setEditBoxResult(mInputEditText.getText().toString()); closeKeyboard(); dismiss(); return true; } return false; } }); }
From source file:org.connectbot.TerminalView.java
@Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_ENTER_ACTION | EditorInfo.IME_ACTION_NONE; outAttrs.inputType = EditorInfo.TYPE_NULL; return new BaseInputConnection(this, false) { @Override//from ww w . java 2 s .co m public boolean deleteSurroundingText(int leftLength, int rightLength) { if (rightLength == 0 && leftLength == 0) { return this.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); } for (int i = 0; i < leftLength; i++) { this.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL)); } // TODO: forward delete return true; } }; }
From source file:com.waz.zclient.ui.cursor.CursorLayout.java
public void showSendButtonAsEnterKey(boolean show) { if (show) {//from w w w. j a va 2 s. c o m newCursorEditText.setImeOptions(EditorInfo.IME_ACTION_SEND); } else { newCursorEditText.setImeOptions(EditorInfo.IME_ACTION_NONE); } }
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
/** * Sets whether the the button with the search icon * will appear in the soft-keyboard or not. * * <p>Notice that if this is set to false, * {@link OnSearchListener#onSearchAction()} onSearchAction}, will * not get called.</p>/*from w w w.j av a 2 s .co m*/ * * @param show to show the search button in * the soft-keyboard. */ public void setShowSearchKey(boolean show) { mShowSearchKey = show; if (show) mSearchInput.setImeOptions(EditorInfo.IME_ACTION_SEARCH); else mSearchInput.setImeOptions(EditorInfo.IME_ACTION_NONE); }
From source file:com.arlib.floatingsearchview.FloatingSearchView.java
/** * Sets whether the the button with the search icon * will appear in the soft-keyboard or not. * * @param show to show the search button in * the soft-keyboard./*w ww . jav a2 s . c om*/ */ public void setShowSearchKey(boolean show) { mShowSearchKey = show; if (show) { mSearchInput.setImeOptions(EditorInfo.IME_ACTION_SEARCH); } else { mSearchInput.setImeOptions(EditorInfo.IME_ACTION_NONE); } }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewBase.java
public void setKeyboardActionType(final int imeOptions) { if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) //IME_FLAG_NO_ENTER_ACTION: // Flag of imeOptions: used in conjunction with one of the actions masked by IME_MASK_ACTION. // If this flag is not set, IMEs will normally replace the "enter" key with the action supplied. // This flag indicates that the action should not be available in-line as a replacement for the "enter" key. // Typically this is because the action has such a significant impact or is not recoverable enough // that accidentally hitting it should be avoided, such as sending a message. // Note that TextView will automatically set this flag for you on multi-line text views. mKeyboardActionType = EditorInfo.IME_ACTION_NONE; else//from w ww . j a v a2 s. c o m mKeyboardActionType = (imeOptions & EditorInfo.IME_MASK_ACTION); // setting the icon/text setSpecialKeysIconsAndLabels(); }
From source file:org.de.jmg.learn._MainActivity.java
void EndEdit2() throws Exception { if (_txtedWord == null) return;//from w w w . ja v a2 s .c o m if (_txtedWord.getVisibility() == View.VISIBLE) { _txtWord.setVisibility(View.VISIBLE); _txtKom.setVisibility(View.VISIBLE); _txtedWord.setVisibility(View.GONE); _txtWord.setText(lib.getSpanableString(_txtedWord.getText().toString())); View LayWord = findViewById(R.id.LayWord); assert LayWord != null; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) LayWord.getLayoutParams(); assert params != null; params.width = LayoutParams.WRAP_CONTENT; LayWord.setLayoutParams(params); _txtedKom.setVisibility(View.GONE); _txtKom.setText(lib.getSpanableString(_txtedKom.getText().toString())); _txtedWord.setImeOptions(EditorInfo.IME_ACTION_NONE); _txtedKom.setImeOptions(EditorInfo.IME_ACTION_NONE); _txtMeaning1.setImeOptions(EditorInfo.IME_ACTION_DONE); _txtMeaning2.setImeOptions(EditorInfo.IME_ACTION_DONE); _txtMeaning3.setImeOptions(EditorInfo.IME_ACTION_DONE); lib.setBgEditText(_txtMeaning1, _MeaningBG); lib.setBgEditText(_txtMeaning2, _MeaningBG); lib.setBgEditText(_txtMeaning3, _MeaningBG); /*_txtMeaning1.setBackgroundResource(0); _txtMeaning2.setBackgroundResource(0); _txtMeaning3.setBackgroundResource(0);*/ if (!_vok.getCardMode()) { _txtMeaning1.setLines(1); _txtMeaning1.setSingleLine(); _txtMeaning2.setLines(1); _txtMeaning2.setSingleLine(); _txtMeaning2.setVisibility(View.VISIBLE); _txtMeaning3.setLines(1); _txtMeaning3.setSingleLine(); _txtMeaning3.setVisibility(View.VISIBLE); } else { _originalMovementmethod = _txtMeaning1.getMovementMethod(); //_txtMeaning1.setAutoLinkMask(Linkify.ALL); _txtMeaning1.setMovementMethod(LinkMovementMethod.getInstance()); //_txtMeaning1.setInputType(InputType.TYPE_NULL); //_txtMeaning1.requestFocus(); //InputMethodManager Imn = (InputMethodManager) _main.getSystemService(Context.INPUT_METHOD_SERVICE); //Imn.hideSoftInputFromInputMethod(_txtMeaning1.getWindowToken(), 0); } } getVokabel(false, false); }
From source file:com.yek.keyboard.anysoftkeyboard.AnySoftKeyboard.java
private void onNonFunctionKey(final int primaryCode, final Keyboard.Key key, final int multiTapIndex, final int[] nearByKeyCodes, final boolean fromUI) { if (BuildConfig.DEBUG) Logger.d(TAG, "onFunctionKey %d", primaryCode); final InputConnection ic = getCurrentInputConnection(); switch (primaryCode) { case KeyCodes.ENTER: if (mShiftKeyState.isPressed() && ic != null) { //power-users feature ahead: Shift+Enter //getting away from firing the default editor action, by forcing newline ic.commitText("\n", 1); break; }// w w w .j a v a 2 s .c om final EditorInfo editorInfo = getCurrentInputEditorInfo(); final int imeOptionsActionId = IMEUtil.getImeOptionsActionIdFromEditorInfo(editorInfo); if (ic != null && IMEUtil.IME_ACTION_CUSTOM_LABEL == imeOptionsActionId) { // Either we have an actionLabel and we should performEditorAction with // actionId regardless of its value. ic.performEditorAction(editorInfo.actionId); } else if (ic != null && EditorInfo.IME_ACTION_NONE != imeOptionsActionId) { // We didn't have an actionLabel, but we had another action to execute. // EditorInfo.IME_ACTION_NONE explicitly means no action. In contrast, // EditorInfo.IME_ACTION_UNSPECIFIED is the default value for an action, so it // means there should be an action and the app didn't bother to set a specific // code for it - presumably it only handles one. It does not have to be treated // in any specific way: anything that is not IME_ACTION_NONE should be sent to // performEditorAction. ic.performEditorAction(imeOptionsActionId); } else { handleSeparator(primaryCode); } break; case KeyCodes.SPACE: //shortcut. Nothing more. handleSeparator(primaryCode); //should we switch to alphabet keyboard? if (!isInAlphabetKeyboardMode()) { Logger.d(TAG, "SPACE/ENTER while in symbols mode"); if (mAskPrefs.getSwitchKeyboardOnSpace()) { Logger.d(TAG, "Switching to Alphabet is required by the user"); getKeyboardSwitcher().nextKeyboard(getCurrentInputEditorInfo(), KeyboardSwitcher.NextKeyboardType.Alphabet); } } break; case KeyCodes.TAB: sendTab(); break; case KeyCodes.ESCAPE: sendEscape(); break; default: if (isWordSeparator(primaryCode)) { handleSeparator(primaryCode); } else { if (mControlKeyState.isActive() && primaryCode >= 32 && primaryCode < 127) { // http://en.wikipedia.org/wiki/Control_character#How_control_characters_map_to_keyboards int controlCode = primaryCode & 31; Logger.d(TAG, "CONTROL state: Char was %d and now it is %d", primaryCode, controlCode); if (controlCode == 9) { sendTab(); } else { ic.commitText(Character.toString((char) controlCode), 1); } } else { handleCharacter(primaryCode, key, multiTapIndex, nearByKeyCodes); } mJustAddedAutoSpace = false; } break; } }
From source file:com.anysoftkeyboard.AnySoftKeyboard.java
private void onNonFunctionKey(final int primaryCode, final Key key, final int multiTapIndex, final int[] nearByKeyCodes, final boolean fromUI) { if (BuildConfig.DEBUG) Logger.d(TAG, "onFunctionKey %d", primaryCode); final InputConnection ic = getCurrentInputConnection(); switch (primaryCode) { case KeyCodes.ENTER: if (mShiftKeyState.isPressed() && ic != null) { //power-users feature ahead: Shift+Enter //getting away from firing the default editor action, by forcing newline ic.commitText("\n", 1); break; }/*from w ww . j a v a 2 s .c om*/ final EditorInfo editorInfo = getCurrentInputEditorInfo(); final int imeOptionsActionId = IMEUtil.getImeOptionsActionIdFromEditorInfo(editorInfo); if (ic != null && IMEUtil.IME_ACTION_CUSTOM_LABEL == imeOptionsActionId) { // Either we have an actionLabel and we should performEditorAction with // actionId regardless of its value. ic.performEditorAction(editorInfo.actionId); } else if (ic != null && EditorInfo.IME_ACTION_NONE != imeOptionsActionId) { // We didn't have an actionLabel, but we had another action to execute. // EditorInfo.IME_ACTION_NONE explicitly means no action. In contrast, // EditorInfo.IME_ACTION_UNSPECIFIED is the default value for an action, so it // means there should be an action and the app didn't bother to set a specific // code for it - presumably it only handles one. It does not have to be treated // in any specific way: anything that is not IME_ACTION_NONE should be sent to // performEditorAction. ic.performEditorAction(imeOptionsActionId); } else { handleSeparator(primaryCode); } break; case KeyCodes.SPACE: //shortcut. Nothing more. handleSeparator(primaryCode); //should we switch to alphabet keyboard? if (!isInAlphabetKeyboardMode()) { Logger.d(TAG, "SPACE/ENTER while in symbols mode"); if (mAskPrefs.getSwitchKeyboardOnSpace()) { Logger.d(TAG, "Switching to Alphabet is required by the user"); getKeyboardSwitcher().nextKeyboard(getCurrentInputEditorInfo(), NextKeyboardType.Alphabet); } } break; case KeyCodes.TAB: sendTab(); break; case KeyCodes.ESCAPE: sendEscape(); break; default: if (isWordSeparator(primaryCode)) { handleSeparator(primaryCode); } else { if (mControlKeyState.isActive() && primaryCode >= 32 && primaryCode < 127) { // http://en.wikipedia.org/wiki/Control_character#How_control_characters_map_to_keyboards int controlCode = primaryCode & 31; Logger.d(TAG, "CONTROL state: Char was %d and now it is %d", primaryCode, controlCode); if (controlCode == 9) { sendTab(); } else { ic.commitText(Character.toString((char) controlCode), 1); } } else { handleCharacter(primaryCode, key, multiTapIndex, nearByKeyCodes); } mJustAddedAutoSpace = false; } break; } }