本文整理汇总了Java中android.view.inputmethod.EditorInfo.IME_ACTION_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java EditorInfo.IME_ACTION_NONE属性的具体用法?Java EditorInfo.IME_ACTION_NONE怎么用?Java EditorInfo.IME_ACTION_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.view.inputmethod.EditorInfo
的用法示例。
在下文中一共展示了EditorInfo.IME_ACTION_NONE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: imeActionName
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 + ")";
}
}
示例2: onCreateInputConnection
@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;
}
};
}
示例3: handleNonFunctionalEvent
/**
* Handle an event that is not a functional event.
*
* These events are generally events that cause input, but in some cases they may do other
* things like trigger an editor action.
*
* @param event The event to handle.
* @param inputTransaction The transaction in progress.
*/
private void handleNonFunctionalEvent(final Event event,
final InputTransaction inputTransaction) {
switch (event.mCodePoint) {
case Constants.CODE_ENTER:
final EditorInfo editorInfo = getCurrentInputEditorInfo();
final int imeOptionsActionId =
InputTypeUtils.getImeOptionsActionIdFromEditorInfo(editorInfo);
if (InputTypeUtils.IME_ACTION_CUSTOM_LABEL == imeOptionsActionId) {
// Either we have an actionLabel and we should performEditorAction with
// actionId regardless of its value.
performEditorAction(editorInfo.actionId);
} else if (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.
performEditorAction(imeOptionsActionId);
} else {
// No action label, and the action from imeOptions is NONE: this is a regular
// enter key that should input a carriage return.
handleNonSpecialCharacterEvent(event, inputTransaction);
}
break;
default:
handleNonSpecialCharacterEvent(event, inputTransaction);
break;
}
}
示例4: getImeOptionsActionIdFromEditorInfo
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;
}
}
示例5: updateImeOptions
private void updateImeOptions() {
// Default to IME_ACTION_DONE
int returnKeyFlag = EditorInfo.IME_ACTION_DONE;
if (mReturnKeyType != null) {
switch (mReturnKeyType) {
case "go":
returnKeyFlag = EditorInfo.IME_ACTION_GO;
break;
case "next":
returnKeyFlag = EditorInfo.IME_ACTION_NEXT;
break;
case "none":
returnKeyFlag = EditorInfo.IME_ACTION_NONE;
break;
case "previous":
returnKeyFlag = EditorInfo.IME_ACTION_PREVIOUS;
break;
case "search":
returnKeyFlag = EditorInfo.IME_ACTION_SEARCH;
break;
case "send":
returnKeyFlag = EditorInfo.IME_ACTION_SEND;
break;
case "done":
returnKeyFlag = EditorInfo.IME_ACTION_DONE;
break;
}
}
if (mDisableFullscreen) {
setImeOptions(returnKeyFlag | EditorInfo.IME_FLAG_NO_FULLSCREEN);
} else {
setImeOptions(returnKeyFlag);
}
}
示例6: handleNonFunctionalEvent
/**
* Handle an event that is not a functional event.
*
* These events are generally events that cause input, but in some cases they may do other
* things like trigger an editor action.
*
* @param event The event to handle.
* @param inputTransaction The transaction in progress.
*/
private void handleNonFunctionalEvent(final Event event,
final InputTransaction inputTransaction,
final LatinIME.UIHandler handler) {
inputTransaction.setDidAffectContents();
switch (event.mCodePoint) {
case Constants.CODE_ENTER:
final EditorInfo editorInfo = getCurrentInputEditorInfo();
final int imeOptionsActionId =
InputTypeUtils.getImeOptionsActionIdFromEditorInfo(editorInfo);
if (InputTypeUtils.IME_ACTION_CUSTOM_LABEL == imeOptionsActionId) {
// Either we have an actionLabel and we should performEditorAction with
// actionId regardless of its value.
performEditorAction(editorInfo.actionId);
} else if (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.
performEditorAction(imeOptionsActionId);
} else {
// No action label, and the action from imeOptions is NONE: this is a regular
// enter key that should input a carriage return.
handleNonSpecialCharacterEvent(event, inputTransaction, handler);
}
break;
default:
handleNonSpecialCharacterEvent(event, inputTransaction, handler);
break;
}
}