List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_DONE
int IME_ACTION_DONE
To view the source code for android.view.inputmethod EditorInfo IME_ACTION_DONE.
Click Source Link
From source file:org.de.jmg.learn._MainActivity.java
void StartEdit() throws Exception { _txtWord.setText(lib.getSpanableString(_vok.getWort()), TextView.BufferType.SPANNABLE); _txtWord.setVisibility(View.GONE); _txtKom.setVisibility(View.GONE); _txtedWord.setVisibility(View.VISIBLE); _txtedWord.setText(_txtWord.getText()); /*/*ww w . j a va 2 s . c o m*/ if (_vok.getSprache() == EnumSprachen.Hebrew) { try { lib.setLocale(context, "he"); } catch (Exception ex) { try { lib.setLocale(context, "iw"); } catch (Exception eex) { lib.ShowException(_main,eex); } } } */ _txtedWord.setTextSize(TypedValue.COMPLEX_UNIT_PX, _txtWord.getTextSize()); View LayWord = findViewById(R.id.LayWord); assert LayWord != null; RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) LayWord.getLayoutParams(); params.width = LayoutParams.MATCH_PARENT; LayWord.setLayoutParams(params); _txtedKom.setVisibility(View.VISIBLE); _txtedKom.setText(_vok.getKommentar()); _txtedKom.setTextSize(TypedValue.COMPLEX_UNIT_PX, _txtKom.getTextSize()); _txtedWord.setImeOptions(EditorInfo.IME_ACTION_NEXT); _txtedKom.setImeOptions(EditorInfo.IME_ACTION_NEXT); _txtedWord.setSingleLine(false); _txtedWord.setMaxLines(3); _txtedKom.setSingleLine(false); _txtedKom.setMaxLines(3); if (!_vok.getCardMode()) { _txtMeaning1.setImeOptions(EditorInfo.IME_ACTION_NEXT); _txtMeaning2.setVisibility(View.VISIBLE); _txtMeaning2.setImeOptions(EditorInfo.IME_ACTION_NEXT); _txtMeaning3.setVisibility(View.VISIBLE); _txtMeaning3.setImeOptions(EditorInfo.IME_ACTION_DONE); _txtMeaning2.setText(_vok.getBedeutung2()); _txtMeaning3.setText(_vok.getBedeutung3()); lib.setBgEditText(_txtMeaning1, _MeaningBG); lib.setBgEditText(_txtMeaning2, _MeaningBG); lib.setBgEditText(_txtMeaning3, _MeaningBG); _txtMeaning1.setLines(1); _txtMeaning1.setSingleLine(); _txtMeaning2.setLines(1); _txtMeaning2.setSingleLine(); _txtMeaning3.setLines(1); _txtMeaning3.setSingleLine(); } else { lib.setBgEditText(_txtMeaning1, _MeaningBG); _txtMeaning1.setImeOptions(EditorInfo.IME_ACTION_DONE); //_originalMovementmethod = _txtMeaning1.getMovementMethod(); //_txtMeaning1.setAutoLinkMask(0); if (_originalMovementmethod != null && _txtMeaning1.getMovementMethod() == LinkMovementMethod.getInstance()) { _txtMeaning1.setMovementMethod(_originalMovementmethod); } //_txtMeaning1.requestFocus(); //InputMethodManager Imn = (InputMethodManager) _main.getSystemService(Context.INPUT_METHOD_SERVICE); //Imn.showSoftInputFromInputMethod(_txtMeaning1.getWindowToken(), 0); } //_txtMeaning1.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE); _txtMeaning1.setText(_vok.getBedeutung1()); setBtnsEnabled(false); _btnEdit.setEnabled(true); _txtMeaning1.clearFocus(); _txtedWord.clearFocus(); //_txtedWord.requestFocusFromTouch(); _txtedWord.requestFocus(); mainView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { lib.removeLayoutListener(mainView.getViewTreeObserver(), this); _txtedWord.requestFocus(); } }); }
From source file:com.skytree.epubtest.BookViewActivity.java
public void makeSearchBox() { int boxColor = Color.rgb(241, 238, 229); int innerBoxColor = Color.rgb(246, 244, 239); int inlineColor = Color.rgb(133, 105, 75); RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); // width,height searchBox = new SkyBox(this); searchBox.setBoxColor(boxColor);/*w ww . j ava2s. c o m*/ searchBox.setArrowHeight(ps(25)); searchBox.setArrowDirection(false); param.leftMargin = ps(50); param.topMargin = ps(400); param.width = ps(400); param.height = ps(300); searchBox.setLayoutParams(param); searchBox.setArrowDirection(false); searchEditor = new EditText(this); this.setFrame(searchEditor, ps(20), ps(20), ps(400 - 140), ps(50)); searchEditor.setTextSize(15f); searchEditor.setEllipsize(TruncateAt.END); searchEditor.setBackgroundColor(innerBoxColor); Drawable icon = getResources().getDrawable(R.drawable.search2x); Bitmap bitmap = ((BitmapDrawable) icon).getBitmap(); Drawable fd = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, ps(28), ps(28), true)); searchEditor.setCompoundDrawablesWithIntrinsicBounds(fd, null, null, null); RoundRectShape rrs = new RoundRectShape( new float[] { ps(15), ps(15), ps(15), ps(15), ps(15), ps(15), ps(15), ps(15) }, null, null); SkyDrawable sd = new SkyDrawable(rrs, innerBoxColor, inlineColor, 2); searchEditor.setBackgroundDrawable(sd); searchEditor.setHint(getString(R.string.searchhint)); searchEditor.setPadding(ps(20), ps(5), ps(10), ps(5)); searchEditor.setLines(1); searchEditor.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchEditor.setSingleLine(); searchEditor.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_NEXT) { String key = searchEditor.getText().toString(); if (key != null && key.length() > 1) { showIndicator(); clearSearchBox(1); makeFullScreen(); rv.searchKey(key); } } return false; } }); searchBox.contentView.addView(searchEditor); Button cancelButton = new Button(this); this.setFrame(cancelButton, ps(290), ps(20), ps(90), ps(50)); cancelButton.setText(getString(R.string.cancel)); cancelButton.setId(3001); RoundRectShape crs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable cd = new SkyDrawable(crs, innerBoxColor, inlineColor, 2); cancelButton.setBackgroundDrawable(cd); cancelButton.setTextSize(12); cancelButton.setOnClickListener(listener); cancelButton.setOnTouchListener(new ButtonHighlighterOnTouchListener(cancelButton)); searchBox.contentView.addView(cancelButton); searchScrollView = new ScrollView(this); RoundRectShape rvs = new RoundRectShape( new float[] { ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5), ps(5) }, null, null); SkyDrawable rd = new SkyDrawable(rvs, innerBoxColor, inlineColor, 2); searchScrollView.setBackgroundDrawable(rd); this.setFrame(searchScrollView, ps(20), ps(100), ps(360), ps(200)); this.searchBox.contentView.addView(searchScrollView); searchResultView = new LinearLayout(this); searchResultView.setOrientation(LinearLayout.VERTICAL); searchScrollView.addView(searchResultView, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); this.ePubView.addView(searchBox); this.hideSearchBox(); }
From source file:com.android.mail.compose.ComposeActivity.java
@Override public boolean onEditorAction(TextView view, int action, KeyEvent keyEvent) { if (action == EditorInfo.IME_ACTION_DONE) { focusBody();/*from w w w . jav a2s . c o m*/ return true; } return false; }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewBase.java
@NonNull private CharSequence guessLabelForKey(int keyCode) { switch (keyCode) { case KeyCodes.ENTER: switch (mKeyboardActionType) { case EditorInfo.IME_ACTION_DONE: return getContext().getText(R.string.label_done_key); case EditorInfo.IME_ACTION_GO: return getContext().getText(R.string.label_go_key); case EditorInfo.IME_ACTION_NEXT: return getContext().getText(R.string.label_next_key); case 0x00000007:// API 11: EditorInfo.IME_ACTION_PREVIOUS: return getContext().getText(R.string.label_previous_key); case EditorInfo.IME_ACTION_SEARCH: return getContext().getText(R.string.label_search_key); case EditorInfo.IME_ACTION_SEND: return getContext().getText(R.string.label_send_key); default://from ww w . ja v a 2 s. c o m return ""; } case KeyCodes.KEYBOARD_MODE_CHANGE: if (mKeyboard instanceof GenericKeyboard) return guessLabelForKey(KeyCodes.MODE_ALPHABET); else return guessLabelForKey(KeyCodes.MODE_SYMOBLS); case KeyCodes.MODE_ALPHABET: return mNextAlphabetKeyboardName; case KeyCodes.MODE_SYMOBLS: return mNextSymbolsKeyboardName; case KeyCodes.TAB: return getContext().getText(R.string.label_tab_key); case KeyCodes.MOVE_HOME: return getContext().getText(R.string.label_home_key); case KeyCodes.MOVE_END: return getContext().getText(R.string.label_end_key); case KeyCodes.ARROW_DOWN: return ""; case KeyCodes.ARROW_LEFT: return ""; case KeyCodes.ARROW_RIGHT: return ""; case KeyCodes.ARROW_UP: return ""; default: return ""; } }
From source file:org.de.jmg.learn._MainActivity.java
void EndEdit2() throws Exception { if (_txtedWord == null) return;//from ww w . ja v a2s. c om 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.ichi2.anki.AbstractFlashcardViewer.java
protected void initControls() { mCardFrame.setVisibility(View.VISIBLE); if (mShowRemainingCardCount) { mTextBarNew.setVisibility(View.VISIBLE); mTextBarLearn.setVisibility(View.VISIBLE); mTextBarReview.setVisibility(View.VISIBLE); }//from w ww . j av a 2 s .c o m mChosenAnswer.setVisibility(View.VISIBLE); mFlipCardLayout.setVisibility(View.VISIBLE); mAnswerField.setVisibility(typeAnswer() ? View.VISIBLE : View.GONE); mAnswerField.setOnEditorActionListener(new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { displayCardAnswer(); return true; } return false; } }); mAnswerField.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && (keyCode == KeyEvent.KEYCODE_ENTER || keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER)) { displayCardAnswer(); return true; } return false; } }); }
From source file:com.cerema.cloud2.authentication.AuthenticatorActivity.java
/** * Called when the 'action' button in an IME is pressed ('enter' in software keyboard). * /*from ww w . j a v a 2 s . co m*/ * 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 }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewBase.java
private Drawable getIconForKeyCode(int keyCode) { Drawable icon = getDrawableForKeyCode(keyCode); // maybe a drawable state is required if (icon != null) { switch (keyCode) { case KeyCodes.ENTER: Logger.d(TAG, "Action key action ID is %d", mKeyboardActionType); switch (mKeyboardActionType) { case EditorInfo.IME_ACTION_DONE: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_DONE); break; case EditorInfo.IME_ACTION_GO: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_GO); break; case EditorInfo.IME_ACTION_SEARCH: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_SEARCH); break; case EditorInfo.IME_ACTION_NONE: case EditorInfo.IME_ACTION_UNSPECIFIED: icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_ACTION_NORMAL); break; }/*from ww w . j av a 2s . co m*/ break; case KeyCodes.SHIFT: if (mKeyboard.isShiftLocked()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_LOCKED); else if (mKeyboard.isShifted()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_PRESSED); else icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_NORMAL); break; case KeyCodes.CTRL: if (mKeyboard.isControl()) icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_PRESSED); else icon.setState(mDrawableStatesProvider.DRAWABLE_STATE_MODIFIER_NORMAL); break; } } return icon; }
From source file:com.owncloud.android.authentication.AuthenticatorActivity.java
/** * Called when the 'action' button in an IME is pressed ('enter' in software * keyboard)./*from w w w. jav a2s.co m*/ * * 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 (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { checkOcServer(); } } return false; // always return false to grant that the software keyboard // is hidden anyway }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java
private CharSequence guessLabelForKey(int keyCode) { switch (keyCode) { case KeyCodes.ENTER: switch (mKeyboardActionType) { case EditorInfo.IME_ACTION_DONE: return getContext().getText(R.string.label_done_key); case EditorInfo.IME_ACTION_GO: return getContext().getText(R.string.label_go_key); case EditorInfo.IME_ACTION_NEXT: return getContext().getText(R.string.label_next_key); case 0x00000007:// API 11: EditorInfo.IME_ACTION_PREVIOUS: return getContext().getText(R.string.label_previous_key); case EditorInfo.IME_ACTION_SEARCH: return getContext().getText(R.string.label_search_key); case EditorInfo.IME_ACTION_SEND: return getContext().getText(R.string.label_send_key); default://from ww w .j ava 2 s.c o m return ""; } case KeyCodes.KEYBOARD_MODE_CHANGE: if (mSwitcher.isAlphabetMode()) return guessLabelForKey(KeyCodes.MODE_SYMOBLS); else return guessLabelForKey(KeyCodes.MODE_ALPHABET); case KeyCodes.MODE_ALPHABET: String langKeyText = null; if (mSwitcher != null)//should show the next keyboard label, not a generic one. langKeyText = mSwitcher.peekNextAlphabetKeyboard(); if (langKeyText == null) return getResources().getString(R.string.change_lang_regular); else return langKeyText; case KeyCodes.MODE_SYMOBLS: String symKeyText = null; if (mSwitcher != null)//should show the next keyboard label, not a generic one. symKeyText = mSwitcher.peekNextSymbolsKeyboard(); if (symKeyText == null) return getResources().getString(R.string.change_symbols_regular); else return symKeyText; case KeyCodes.TAB: return getContext().getText(R.string.label_tab_key); case KeyCodes.MOVE_HOME: return getContext().getText(R.string.label_home_key); case KeyCodes.MOVE_END: return getContext().getText(R.string.label_end_key); case KeyCodes.ARROW_DOWN: return "\u2193"; case KeyCodes.ARROW_LEFT: return "\u2190"; case KeyCodes.ARROW_RIGHT: return "\u2192"; case KeyCodes.ARROW_UP: return "\u2191"; default: return null; } }