Java Code Examples for android.view.inputmethod.EditorInfo#IME_ACTION_NEXT
The following examples show how to use
android.view.inputmethod.EditorInfo#IME_ACTION_NEXT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodenameOneInputConnection.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
@Override public boolean performEditorAction(int actionCode) { if (Display.isInitialized() && Display.getInstance().getCurrent() != null) { Component txtCmp = Display.getInstance().getCurrent().getFocused(); if (txtCmp != null && txtCmp instanceof TextField) { TextField t = (TextField) txtCmp; if (actionCode == EditorInfo.IME_ACTION_DONE) { Display.getInstance().setShowVirtualKeyboard(false); } else if (actionCode == EditorInfo.IME_ACTION_NEXT) { Display.getInstance().setShowVirtualKeyboard(false); txtCmp.getNextFocusDown().requestFocus(); } } } return super.performEditorAction(actionCode); }
Example 2
Source File: MainActivity.java From IdeaTrackerPlus with MIT License | 6 votes |
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_NULL) { switch ((int) v.getTag()) { case 1: mNoteField.requestFocus(); break; case 2: sendIdeaFromDialog(); break; default: break; } return true; } return false; }
Example 3
Source File: BrowserActivity.java From JumpGo with Mozilla Public License 2.0 | 6 votes |
@Override public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) { // hide the keyboard and search the web when the enter key // button is pressed if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_SEARCH || (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); searchTheWeb(mSearch.getText().toString()); final LightningView currentView = mTabsManager.getCurrentTab(); if (currentView != null) { currentView.requestFocus(); } return true; } return false; }
Example 4
Source File: EditorInfoCompatUtils.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 6 votes |
public static String imeActionName(final int imeOptions) { final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION; switch (actionId) { case EditorInfo.IME_ACTION_UNSPECIFIED: return "actionUnspecified"; case EditorInfo.IME_ACTION_NONE: return "actionNone"; case EditorInfo.IME_ACTION_GO: return "actionGo"; case EditorInfo.IME_ACTION_SEARCH: return "actionSearch"; case EditorInfo.IME_ACTION_SEND: return "actionSend"; case EditorInfo.IME_ACTION_NEXT: return "actionNext"; case EditorInfo.IME_ACTION_DONE: return "actionDone"; case EditorInfo.IME_ACTION_PREVIOUS: return "actionPrevious"; default: return "actionUnknown(" + actionId + ")"; } }
Example 5
Source File: AdapterInputConnection.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
/** * @see BaseInputConnection#performEditorAction(int) */ @Override public boolean performEditorAction(int actionCode) { if (DEBUG) Log.w(TAG, "performEditorAction [" + actionCode + "]"); if (actionCode == EditorInfo.IME_ACTION_NEXT) { restartInput(); // Send TAB key event long timeStampMs = System.currentTimeMillis(); mImeAdapter.sendSyntheticKeyEvent( ImeAdapter.sEventTypeRawKeyDown, timeStampMs, KeyEvent.KEYCODE_TAB, 0); } else { mImeAdapter.sendKeyEventWithKeyCode(KeyEvent.KEYCODE_ENTER, KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE | KeyEvent.FLAG_EDITOR_ACTION); } return true; }
Example 6
Source File: EditorInfoCompatUtils.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 6 votes |
public static String imeActionName(final int imeOptions) { final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION; switch (actionId) { case EditorInfo.IME_ACTION_UNSPECIFIED: return "actionUnspecified"; case EditorInfo.IME_ACTION_NONE: return "actionNone"; case EditorInfo.IME_ACTION_GO: return "actionGo"; case EditorInfo.IME_ACTION_SEARCH: return "actionSearch"; case EditorInfo.IME_ACTION_SEND: return "actionSend"; case EditorInfo.IME_ACTION_NEXT: return "actionNext"; case EditorInfo.IME_ACTION_DONE: return "actionDone"; case EditorInfo.IME_ACTION_PREVIOUS: return "actionPrevious"; default: return "actionUnknown(" + actionId + ")"; } }
Example 7
Source File: AuthenticatorActivity.java From Cirrus_depricated with GNU General Public License v2.0 | 6 votes |
/** * Called when the 'action' button in an IME is pressed ('enter' in software keyboard). * * Used to trigger the authentication check when the user presses 'enter' after writing the * password, or to throw the server test when the only field on screen is the URL input field. */ @Override public boolean onEditorAction(TextView inputField, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE && inputField != null && inputField.equals(mPasswordInput)) { if (mOkButton.isEnabled()) { mOkButton.performClick(); } } else if (actionId == EditorInfo.IME_ACTION_NEXT && inputField != null && inputField.equals(mHostUrlInput)) { if (AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()). equals(mAuthTokenType)) { checkOcServer(); } } return false; // always return false to grant that the software keyboard is hidden anyway }
Example 8
Source File: FieldAdapter.java From dhis2-android-datacapture with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { final TextView view = v; if(actionId == EditorInfo.IME_ACTION_NEXT) { int position= mListView.getPositionForView(v); mListView.smoothScrollToPosition(position+1); mListView.postDelayed(new Runnable() { public void run() { TextView nextField = (TextView)view.focusSearch(View.FOCUS_DOWN); if(nextField != null) { nextField.requestFocus(); } } }, 200); return true; } return false; }
Example 9
Source File: BrowserActivity.java From Xndroid with GNU General Public License v3.0 | 6 votes |
@Override public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) { // hide the keyboard and search the web when the enter key // button is pressed if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_SEARCH || (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0); searchTheWeb(mSearch.getText().toString()); final LightningView currentView = mTabsManager.getCurrentTab(); if (currentView != null) { currentView.requestFocus(); } return true; } return false; }
Example 10
Source File: EntryKeyboardView.java From bither-android with Apache License 2.0 | 5 votes |
private void configureDoneButton() { View currentFocusView = getRootView().findFocus(); if (currentFocusView == null) { return; } if (currentFocusView instanceof EditText) { EditText currentFocusEt = (EditText) currentFocusView; if (!Utils.isEmpty(currentFocusEt.getImeActionLabel() == null ? null : currentFocusEt.getImeActionLabel().toString())) { setEnterKeyText(currentFocusEt.getImeActionLabel()); } else if (currentFocusEt.getImeActionId() > 0) { switch (currentFocusEt.getImeActionId()) { case EditorInfo.IME_ACTION_DONE: case EditorInfo.IME_ACTION_GO: case EditorInfo.IME_ACTION_SEND: setEnterKeyText(getResources().getString(R.string.password_keyboard_done)); break; case EditorInfo.IME_ACTION_NEXT: setEnterKeyText(getResources().getString(R.string.password_keyboard_next)); break; default: break; } } else { View nextFocusView = currentFocusEt.focusSearch(View.FOCUS_DOWN); if (nextFocusView != null) { setEnterKeyText(getResources().getString(R.string.password_keyboard_next)); } else { setEnterKeyText(getResources().getString(R.string.password_keyboard_done)); } } EntryKeyboard keyboard = (EntryKeyboard) getKeyboard(); invalidateKey(keyboard.getEnterKeyIndex()); } }
Example 11
Source File: RecyclerOnClickListener.java From IdeaTrackerPlus with MIT License | 5 votes |
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_SEND || actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_NULL) { mNoteField.requestFocus(); } return true; }
Example 12
Source File: KBoard.java From kboard with GNU General Public License v3.0 | 5 votes |
public void setImeOptions(Resources res, int options) { if (mEnterKey == null) { return; } switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_go); break; case EditorInfo.IME_ACTION_NEXT: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_next); break; case EditorInfo.IME_ACTION_SEARCH: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search); mEnterKey.label = null; break; case EditorInfo.IME_ACTION_SEND: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_send); break; default: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return); mEnterKey.label = null; break; } }
Example 13
Source File: KBoard.java From kboard with GNU General Public License v3.0 | 5 votes |
public void setImeOptions(Resources res, int options) { if (mEnterKey == null) { return; } switch (options&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_go); break; case EditorInfo.IME_ACTION_NEXT: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_next); break; case EditorInfo.IME_ACTION_SEARCH: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search); mEnterKey.label = null; break; case EditorInfo.IME_ACTION_SEND: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.label = res.getText(R.string.label_keyboard_key_send); break; default: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return); mEnterKey.label = null; break; } }
Example 14
Source File: DatePickerSpinnerDelegate.java From DateTimePicker with Apache License 2.0 | 5 votes |
/** * Sets the IME options for a spinner based on its ordering. * * @param spinner The spinner. * @param spinnerCount The total spinner count. * @param spinnerIndex The index of the given spinner. */ private void setImeOptions(NumberPicker spinner, int spinnerCount, int spinnerIndex) { final int imeOptions; if (spinnerIndex < spinnerCount - 1) { imeOptions = EditorInfo.IME_ACTION_NEXT; } else { imeOptions = EditorInfo.IME_ACTION_DONE; } TextView input = (TextView) spinner.findViewById(R.id.numberpicker_input); input.setImeOptions(imeOptions); }
Example 15
Source File: LatinKeyboard.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
/** * This looks at the ime options given by the current editor, to set the * appropriate label on the keyboard's enter key (if it has one). */ void setImeOptions(Resources res, int options) { if (mEnterKey == null) { return; } int valnorm = KeyEvent.KEYCODE_ENTER; switch (options & (EditorInfo.IME_MASK_ACTION | EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { case EditorInfo.IME_ACTION_GO: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.codes = NORMAL_ENTER; mEnterKey.label = res.getText(R.string.label_go_key); break; case EditorInfo.IME_ACTION_NEXT: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.codes = NORMAL_ENTER; mEnterKey.label = res.getText(R.string.label_next_key); break; case EditorInfo.IME_ACTION_SEARCH: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search); mEnterKey.codes = NORMAL_ENTER; mEnterKey.label = null; break; case EditorInfo.IME_ACTION_SEND: mEnterKey.iconPreview = null; mEnterKey.icon = null; mEnterKey.codes = NORMAL_ENTER; mEnterKey.label = res.getText(R.string.label_send_key); break; default: mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return); mEnterKey.label = null; mEnterKey.codes = TERMINAL_ENTER; break; } }
Example 16
Source File: DatePicker.java From ticdesign with Apache License 2.0 | 5 votes |
/** * Sets the IME options for a spinner based on its ordering. * * @param spinner The spinner. * @param spinnerCount The total spinner count. * @param spinnerIndex The index of the given spinner. */ private void setImeOptions(NumberPicker spinner, int spinnerCount, int spinnerIndex) { final int imeOptions; if (spinnerIndex < spinnerCount - 1) { imeOptions = EditorInfo.IME_ACTION_NEXT; } else { imeOptions = EditorInfo.IME_ACTION_DONE; } TextView input = (TextView) spinner.findViewById(R.id.numberpicker_input); input.setImeOptions(imeOptions); }
Example 17
Source File: PayerInformationActivity.java From px-android with MIT License | 4 votes |
private boolean isNextKey(final int actionId, final KeyEvent event) { return actionId == EditorInfo.IME_ACTION_NEXT || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER); }
Example 18
Source File: KeyboardId.java From LokiBoard-Android-Keylogger with Apache License 2.0 | 4 votes |
public boolean navigateNext() { return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_NEXT) != 0 || imeAction() == EditorInfo.IME_ACTION_NEXT; }
Example 19
Source File: EditorView.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Builds the editor view. * * @param activity The activity on top of which the UI should be displayed. * @param observerForTest Optional event observer for testing. */ public EditorView(Activity activity, PaymentRequestObserverForTest observerForTest) { super(activity, R.style.FullscreenWhite); mContext = activity; mObserverForTest = observerForTest; mHandler = new Handler(); mEditorActionListener = new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { mDoneButton.performClick(); return true; } else if (actionId == EditorInfo.IME_ACTION_NEXT) { View next = v.focusSearch(View.FOCUS_FORWARD); if (next != null) { next.requestFocus(); return true; } } return false; } }; mHalfRowMargin = activity.getResources().getDimensionPixelSize( R.dimen.payments_section_large_spacing); mFieldViews = new ArrayList<>(); mEditableTextFields = new ArrayList<>(); mDropdownFields = new ArrayList<>(); final Pattern cardNumberPattern = Pattern.compile("^[\\d- ]*$"); mCardNumberInputFilter = new InputFilter() { @Override public CharSequence filter( CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { // Accept deletions. if (start == end) return null; // Accept digits, "-", and spaces. if (cardNumberPattern.matcher(source.subSequence(start, end)).matches()) { return null; } // Reject everything else. return ""; } }; mCardNumberFormatter = new CreditCardNumberFormattingTextWatcher(); new AsyncTask<Void, Void, PhoneNumberFormattingTextWatcher>() { @Override protected PhoneNumberFormattingTextWatcher doInBackground(Void... unused) { return new PhoneNumberFormattingTextWatcher(); } @Override protected void onPostExecute(PhoneNumberFormattingTextWatcher result) { mPhoneFormatter = result; if (mPhoneInput != null) { mPhoneInput.addTextChangedListener(mPhoneFormatter); } } }.execute(); }
Example 20
Source File: AdapterInputConnection.java From android-chromium with BSD 2-Clause "Simplified" License | 4 votes |
@VisibleForTesting AdapterInputConnection(View view, ImeAdapter imeAdapter, EditorInfo outAttrs) { super(view, true); mInternalView = view; mImeAdapter = imeAdapter; mImeAdapter.setInputConnection(this); mSingleLine = true; outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_FLAG_NO_EXTRACT_UI; outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT; if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeText) { // Normal text field outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTextArea || imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeContentEditable) { // TextArea or contenteditable. outAttrs.inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NONE; mSingleLine = false; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypePassword) { // Password outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_PASSWORD; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeSearch) { // Search outAttrs.imeOptions |= EditorInfo.IME_ACTION_SEARCH; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeUrl) { // Url // TYPE_TEXT_VARIATION_URI prevents Tab key from showing, so // exclude it for now. outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeEmail) { // Email outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS; outAttrs.imeOptions |= EditorInfo.IME_ACTION_GO; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeTel) { // Telephone // Number and telephone do not have both a Tab key and an // action in default OSK, so set the action to NEXT outAttrs.inputType = InputType.TYPE_CLASS_PHONE; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } else if (imeAdapter.getTextInputType() == ImeAdapter.sTextInputTypeNumber) { // Number outAttrs.inputType = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_NORMAL; outAttrs.imeOptions |= EditorInfo.IME_ACTION_NEXT; } outAttrs.initialSelStart = imeAdapter.getInitialSelectionStart(); outAttrs.initialSelEnd = imeAdapter.getInitialSelectionEnd(); mLastUpdateSelectionStart = imeAdapter.getInitialSelectionStart(); mLastUpdateSelectionEnd = imeAdapter.getInitialSelectionEnd(); }