android.view.inputmethod.EditorInfo#IME_ACTION_SEND源码实例Demo

下面列出了android.view.inputmethod.EditorInfo#IME_ACTION_SEND 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: mollyim-android   文件: ComposeText.java
public void setTransport(TransportOption transport) {
  final boolean useSystemEmoji = TextSecurePreferences.isSystemEmojiPreferred(getContext());
  final boolean isIncognito    = TextSecurePreferences.isIncognitoKeyboardEnabled(getContext());

  int imeOptions = (getImeOptions() & ~EditorInfo.IME_MASK_ACTION) | EditorInfo.IME_ACTION_SEND;
  int inputType  = getInputType();

  if (isLandscape()) setImeActionLabel(transport.getComposeHint(), EditorInfo.IME_ACTION_SEND);
  else               setImeActionLabel(null, 0);

  if (useSystemEmoji) {
    inputType = (inputType & ~InputType.TYPE_MASK_VARIATION) | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
  }

  setInputType(inputType);
  setImeOptions(imeOptions);
  setHint(transport.getComposeHint(),
          transport.getSimName().isPresent()
              ? getContext().getString(R.string.conversation_activity__from_sim_name, transport.getSimName().get())
              : null);
}
 
源代码2 项目: android_9.0.0_r45   文件: InputMethodService.java
/**
 * Return a drawable resource id that can be used as a button icon for the given
 * {@link EditorInfo#imeOptions EditorInfo.imeOptions}.
 *
 * @param imeOptions The value from @link EditorInfo#imeOptions EditorInfo.imeOptions}.
 *
 * @return Returns a drawable resource id to use.
 */
@DrawableRes
private int getIconForImeAction(int imeOptions) {
    switch (imeOptions&EditorInfo.IME_MASK_ACTION) {
        case EditorInfo.IME_ACTION_GO:
            return com.android.internal.R.drawable.ic_input_extract_action_go;
        case EditorInfo.IME_ACTION_SEARCH:
            return com.android.internal.R.drawable.ic_input_extract_action_search;
        case EditorInfo.IME_ACTION_SEND:
            return com.android.internal.R.drawable.ic_input_extract_action_send;
        case EditorInfo.IME_ACTION_NEXT:
            return com.android.internal.R.drawable.ic_input_extract_action_next;
        case EditorInfo.IME_ACTION_DONE:
            return com.android.internal.R.drawable.ic_input_extract_action_done;
        case EditorInfo.IME_ACTION_PREVIOUS:
            return com.android.internal.R.drawable.ic_input_extract_action_previous;
        default:
            return com.android.internal.R.drawable.ic_input_extract_action_return;
    }
}
 
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 + ")";
    }
}
 
源代码4 项目: Xndroid   文件: BrowserActivity.java
@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;
}
 
源代码5 项目: browser   文件: BrowserActivity.java
@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());
		LightningView v=getCurrentWebView();
		if (v != null) {
			v.requestFocus();
		}
		return true;
	}
	return false;
}
 
源代码6 项目: simple-keyboard   文件: EditorInfoCompatUtils.java
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 + ")";
    }
}
 
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 + ")";
    }
}
 
源代码8 项目: Indic-Keyboard   文件: EditorInfoCompatUtils.java
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 + ")";
    }
}
 
源代码9 项目: mollyim-android   文件: ConversationActivity.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  if (actionId == EditorInfo.IME_ACTION_SEND) {
    sendButton.performClick();
    return true;
  }
  return false;
}
 
源代码10 项目: SoloPi   文件: AdbIME.java
@Subscriber(value = @Param(value = IME_SEARCH_MESSAGE, sticky = false), thread = RunningThread.MAIN_THREAD)
public boolean inputSearchText(String text) {
    if (text != null) {
        InputConnection ic = getCurrentInputConnection();
        if (ic != null) {
            ic.commitText(text, 1);

            // 需要额外点击发送
            EditorInfo editorInfo = getCurrentInputEditorInfo();
            if (editorInfo != null) {
                int options = editorInfo.imeOptions;
                final int actionId = options & EditorInfo.IME_MASK_ACTION;

                switch (actionId) {
                    case EditorInfo.IME_ACTION_SEARCH:
                        sendDefaultEditorAction(true);
                        break;
                    case EditorInfo.IME_ACTION_GO:
                        sendDefaultEditorAction(true);
                        break;
                    case EditorInfo.IME_ACTION_SEND:
                        sendDefaultEditorAction(true);
                        break;
                    default:
                        ic.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
                }
            }
            return true;
        }
    }
    return false;
}
 
源代码11 项目: VCL-Android   文件: SavePlaylistDialog.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEND) {
        savePlaylist();
    }
    return false;
}
 
源代码12 项目: java-n-IDE-for-Android   文件: LatinKeyboard.java
/**
 * 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;
    }
}
 
@OnEditorAction({ R.id.new_story_url, R.id.new_story_comment })
protected boolean onEditorAction(TextView textView, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEND) {
        postNewStory();
        return true;
    }
    return false;
}
 
源代码14 项目: react-native-GPay   文件: ReactEditText.java
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);
  }
}
 
源代码15 项目: ucar-weex-core   文件: AbstractEditComponent.java
@WXComponentProp(name = Constants.Name.RETURN_KEY_TYPE)
public void setReturnKeyType(String type) {
  if (getHostView() == null) {
    return;
  }
  mReturnKeyType = type;
  switch (type) {
    case ReturnTypes.DEFAULT:
      mEditorAction = EditorInfo.IME_ACTION_UNSPECIFIED;
      break;
    case ReturnTypes.GO:
      mEditorAction = EditorInfo.IME_ACTION_GO;
      break;
    case ReturnTypes.NEXT:
      mEditorAction = EditorInfo.IME_ACTION_NEXT;
      break;
    case ReturnTypes.SEARCH:
      mEditorAction = EditorInfo.IME_ACTION_SEARCH;
      break;
    case ReturnTypes.SEND:
      mEditorAction = EditorInfo.IME_ACTION_SEND;
      break;
    case ReturnTypes.DONE:
      mEditorAction = EditorInfo.IME_ACTION_DONE;
      break;
    default:
      break;
  }

  //remove focus and hide keyboard first, the ImeOptions will take effect when show keyboard next time
  blur();
  getHostView().setImeOptions(mEditorAction);
}
 
源代码16 项目: kboard   文件: KBoard.java
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;
    }
}
 
源代码17 项目: firebase-chat   文件: ChatFragment.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEND) {
        sendMessage();
        return true;
    }
    return false;
}
 
源代码18 项目: IdeaTrackerPlus   文件: RecyclerOnClickListener.java
@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;
}
 
源代码19 项目: deltachat-android   文件: ConversationActivity.java
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
  if (actionId == EditorInfo.IME_ACTION_SEND) {
    sendButton.performClick();
    return true;
  }
  return false;
}
 
源代码20 项目: kboard   文件: KCommands.java
public void s(int n) {
    if((inputEditor.imeOptions & EditorInfo.IME_MASK_ACTION) == EditorInfo.IME_ACTION_SEND) {
        inputConnection.performEditorAction(EditorInfo.IME_ACTION_SEND);
    }
}