Java Code Examples for android.view.inputmethod.EditorInfo.IME_FLAG_NO_ENTER_ACTION

The following are Jave code examples for showing how to use IME_FLAG_NO_ENTER_ACTION of the android.view.inputmethod.EditorInfo class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: GitHub   File: TerminalView.java   View Source Code Vote up 6 votes
@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
		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;
		}
	};
}
 
Example 2
Project: AOSP-Kayboard-7.1.2   File: EditorInfoCompatUtils.java   View Source Code Vote up 6 votes
public static String imeOptionsName(final int imeOptions) {
    final String action = imeActionName(imeOptions);
    final StringBuilder flags = new StringBuilder();
    if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
        flags.append("flagNoEnterAction|");
    }
    if ((imeOptions & EditorInfo.IME_FLAG_NAVIGATE_NEXT) != 0) {
        flags.append("flagNavigateNext|");
    }
    if ((imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0) {
        flags.append("flagNavigatePrevious|");
    }
    if (hasFlagForceAscii(imeOptions)) {
        flags.append("flagForceAscii|");
    }
    return (action != null) ? flags + action : flags.toString();
}
 
Example 3
Project: keepass2android   File: KP2AKeyboard.java   View Source Code Vote up 5 votes
private void commitKp2aString(String value, EditorInfo editorInfo) {
	//getCurrentInputConnection().commitText(value, 0);
	onText(value);

	if ((editorInfo.imeOptions&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) == EditorInfo.IME_ACTION_NEXT)
	{
		Log.d("KP2AK", "action is NEXT ");
		getCurrentInputConnection().performEditorAction(EditorInfo.IME_ACTION_NEXT);
	}
}
 
Example 4
Project: PeSanKita-android   File: ComposeText.java   View Source Code Vote up 5 votes
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
  InputConnection inputConnection = super.onCreateInputConnection(editorInfo);

  if(TextSecurePreferences.isEnterSendsEnabled(getContext())) {
    editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
  }

  if (Build.VERSION.SDK_INT < 21) return inputConnection;
  if (mediaListener == null)      return inputConnection;
  if (inputConnection == null)    return null;

  EditorInfoCompat.setContentMimeTypes(editorInfo, new String[] {"image/jpeg", "image/png", "image/gif"});
  return InputConnectionCompat.createWrapper(inputConnection, editorInfo, new CommitContentListener(mediaListener));
}
 
Example 5
Project: simple-keyboard   File: InputTypeUtils.java   View Source Code Vote up 5 votes
public static int getImeOptionsActionIdFromEditorInfo(final EditorInfo editorInfo) {
    if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
        return EditorInfo.IME_ACTION_NONE;
    } else if (editorInfo.actionLabel != null) {
        return IME_ACTION_CUSTOM_LABEL;
    } else {
        // Note: this is different from editorInfo.actionId, hence "ImeOptionsActionId"
        return editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
    }
}
 
Example 6
Project: behe-keyboard   File: LatinKeyboard.java   View Source Code Vote up 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;
    }

    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 = "ENT";
            break;
        case EditorInfo.IME_ACTION_NEXT:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            mEnterKey.label = "N";
            break;
        case EditorInfo.IME_ACTION_SEARCH:
          //  mEnterKey.icon = "K";
            mEnterKey.label = null;
            break;
        case EditorInfo.IME_ACTION_SEND:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            mEnterKey.label = "HH";
            break;
        default:
         //   mEnterKey.icon = "U";
            mEnterKey.label = null;
            break;
    }
}
 
Example 7
Project: javaide   File: LatinKeyboard.java   View Source Code Vote up 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 8
Project: Cable-Android   File: ComposeText.java   View Source Code Vote up 5 votes
@Override
public InputConnection onCreateInputConnection(EditorInfo editorInfo) {
  InputConnection inputConnection = super.onCreateInputConnection(editorInfo);

  if(TextSecurePreferences.isEnterSendsEnabled(getContext())) {
    editorInfo.imeOptions &= ~EditorInfo.IME_FLAG_NO_ENTER_ACTION;
  }

  if (Build.VERSION.SDK_INT < 21) return inputConnection;
  if (mediaListener == null)      return inputConnection;
  if (inputConnection == null)    return null;

  EditorInfoCompat.setContentMimeTypes(editorInfo, new String[] {"image/jpeg", "image/png", "image/gif"});
  return InputConnectionCompat.createWrapper(inputConnection, editorInfo, new CommitContentListener(mediaListener));
}
 
Example 9
Project: QuranKeyboard   File: ArabicKeyboard.java   View Source Code Vote up 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(Context context, 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 = context.getResources().getText(R.string.label_go_key);
            break;
        case EditorInfo.IME_ACTION_NEXT:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            mEnterKey.label = context.getResources().getText(R.string.label_next_key);
            break;
        case EditorInfo.IME_ACTION_SEARCH:
            mEnterKey.icon = ContextCompat.getDrawable(context, R.drawable.sym_keyboard_search);
            mEnterKey.label = null;
            break;
        case EditorInfo.IME_ACTION_SEND:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            mEnterKey.label = context.getResources().getText(R.string.label_send_key);
            break;
        default:
            mEnterKey.icon = ContextCompat.getDrawable(context, R.drawable.sym_keyboard_return);
            mEnterKey.label = null;
            break;
    }
}
 
Example 10
Project: myan   File: smKeyboard.java   View Source Code Vote up 5 votes
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_go_key);
            break;
        case EditorInfo.IME_ACTION_NEXT:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            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.label = null;
            break;
        case EditorInfo.IME_ACTION_SEND:
            mEnterKey.iconPreview = null;
            mEnterKey.icon = null;
            mEnterKey.label = res.getText(R.string.label_send_key);
            break;
        default:
            mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
            mEnterKey.label = null;
            break;
    }
}
 
Example 11
Project: AOSP-Kayboard-7.1.2   File: InputTypeUtils.java   View Source Code Vote up 5 votes
public static int getImeOptionsActionIdFromEditorInfo(final EditorInfo editorInfo) {
    if ((editorInfo.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
        return EditorInfo.IME_ACTION_NONE;
    } else if (editorInfo.actionLabel != null) {
        return IME_ACTION_CUSTOM_LABEL;
    } else {
        // Note: this is different from editorInfo.actionId, hence "ImeOptionsActionId"
        return editorInfo.imeOptions & EditorInfo.IME_MASK_ACTION;
    }
}
 
Example 12
Project: keepass2android   File: KP2AKeyboard.java   View Source Code Vote up 4 votes
@Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
    LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
    // In landscape mode, this method gets called without the input view being created.
    if (inputView == null) {
        return;
    }
    
    loadSettings();

    if (mRefreshKeyboardRequired) {
        mRefreshKeyboardRequired = false;
        toggleLanguage(true, true);
    }

    mKeyboardSwitcher.makeKeyboards(false);

    TextEntryState.newSession(this);
    
    updateKeyboardMode(attribute);
    inputView.closing();
    mComposing.setLength(0);
    mPredicting = false;
    mDeleteCount = 0;
    mJustAddedAutoSpace = false;
    mIsSendGoDone = ((attribute.imeOptions&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) == EditorInfo.IME_ACTION_GO)
    		|| ((attribute.imeOptions&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) == EditorInfo.IME_ACTION_DONE)
    		|| ((attribute.imeOptions&(EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) == EditorInfo.IME_ACTION_SEND);

    updateShiftKeyState(attribute);

    setCandidatesViewShownInternal(isCandidateStripVisible() || mCompletionOn,
            false /* needsInputViewShown */ );
    updateSuggestions();

    // If the dictionary is not big enough, don't auto correct
    mHasDictionary = mSuggest.hasMainDictionary();
    Log.d("KP2AK", "has main dict: " + mHasDictionary);

    updateCorrectionMode();

    inputView.setPreviewEnabled(mPopupOn);
    inputView.setProximityCorrectionEnabled(true);
    mPredictionOn = mPredictionOn && (mCorrectionMode > 0 || mShowSuggestions);
    // If we just entered a text field, maybe it has some old text that requires correction
    checkReCorrectionOnStart();
    
    tryKp2aAutoFill(attribute);
    
    if (TRACE) Debug.startMethodTracing("/data/trace/latinime");
}
 
Example 13
Project: keepass2android   File: LatinKeyboard.java   View Source Code Vote up 4 votes
void setImeOptions(Resources res, int mode, int options) {
    mMode = mode;
    // TODO should clean up this method
    if (mEnterKey != null) {
        // Reset some of the rarely used attributes.
        mEnterKey.popupCharacters = null;
        mEnterKey.popupResId = 0;
        mEnterKey.text = null;
        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_go_key);
                break;
            case EditorInfo.IME_ACTION_NEXT:
                mEnterKey.iconPreview = null;
                mEnterKey.icon = null;
                mEnterKey.label = res.getText(R.string.label_next_key);
                break;
            case EditorInfo.IME_ACTION_DONE:
                mEnterKey.iconPreview = null;
                mEnterKey.icon = null;
                mEnterKey.label = res.getText(R.string.label_done_key);
                break;
            case EditorInfo.IME_ACTION_SEARCH:
                mEnterKey.iconPreview = res.getDrawable(
                        R.drawable.sym_keyboard_feedback_search);
                mEnterKey.icon = res.getDrawable(mIsBlackSym ?
                        R.drawable.sym_bkeyboard_search : 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_send_key);
                break;
            default:
                if (mode == KeyboardSwitcher.MODE_IM) {
                    mEnterKey.icon = mHintIcon;
                    mEnterKey.iconPreview = null;
                    mEnterKey.label = ":-)";
                    mEnterKey.text = ":-) ";
                    mEnterKey.popupResId = R.xml.popup_smileys;
                } else {
                    mEnterKey.iconPreview = res.getDrawable(
                            R.drawable.sym_keyboard_feedback_return);
                    mEnterKey.icon = res.getDrawable(mIsBlackSym ?
                            R.drawable.sym_bkeyboard_return : R.drawable.sym_keyboard_return);
                    mEnterKey.label = null;
                }
                break;
        }
        // Set the initial size of the preview icon
        if (mEnterKey.iconPreview != null) {
            setDefaultBounds(mEnterKey.iconPreview);
        }
    }
}