Java Code Examples for android.view.inputmethod.EditorInfo#IME_ACTION_PREVIOUS

The following examples show how to use android.view.inputmethod.EditorInfo#IME_ACTION_PREVIOUS . 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: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * Return text that can be used as a button label for the given
 * {@link EditorInfo#imeOptions EditorInfo.imeOptions}.  Returns null
 * if there is no action requested.  Note that there is no guarantee that
 * the returned text will be relatively short, so you probably do not
 * want to use it as text on a soft keyboard key label.
 *
 * @param imeOptions The value from {@link EditorInfo#imeOptions EditorInfo.imeOptions}.
 *
 * @return Returns a label to use, or null if there is no action.
 */
public CharSequence getTextForImeAction(int imeOptions) {
    switch (imeOptions&EditorInfo.IME_MASK_ACTION) {
        case EditorInfo.IME_ACTION_NONE:
            return null;
        case EditorInfo.IME_ACTION_GO:
            return getText(com.android.internal.R.string.ime_action_go);
        case EditorInfo.IME_ACTION_SEARCH:
            return getText(com.android.internal.R.string.ime_action_search);
        case EditorInfo.IME_ACTION_SEND:
            return getText(com.android.internal.R.string.ime_action_send);
        case EditorInfo.IME_ACTION_NEXT:
            return getText(com.android.internal.R.string.ime_action_next);
        case EditorInfo.IME_ACTION_DONE:
            return getText(com.android.internal.R.string.ime_action_done);
        case EditorInfo.IME_ACTION_PREVIOUS:
            return getText(com.android.internal.R.string.ime_action_previous);
        default:
            return getText(com.android.internal.R.string.ime_action_default);
    }
}
 
Example 2
Source File: InputMethodService.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 3
Source File: EditorInfoCompatUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 6 votes vote down vote up
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 4
Source File: EditorInfoCompatUtils.java    From simple-keyboard with Apache License 2.0 6 votes vote down vote up
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: EditorInfoCompatUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 6 votes vote down vote up
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 6
Source File: EditorInfoCompatUtils.java    From Indic-Keyboard with Apache License 2.0 6 votes vote down vote up
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: ReactEditText.java    From react-native-GPay with MIT License 5 votes vote down vote up
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);
  }
}
 
Example 8
Source File: KeyCodeDescriptionMapper.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a context-sensitive description of the "Enter" action key.
 *
 * @param context The package's context.
 * @param keyboard The keyboard on which the key resides.
 * @param key The key to describe.
 * @return Returns a context-sensitive description of the "Enter" action key.
 */
private static String getDescriptionForActionKey(final Context context, final Keyboard keyboard,
        final Key key) {
    final KeyboardId keyboardId = keyboard.mId;
    final int actionId = keyboardId.imeAction();
    final int resId;

    // Always use the label, if available.
    if (!TextUtils.isEmpty(key.getLabel())) {
        return key.getLabel().trim();
    }

    // Otherwise, use the action ID.
    switch (actionId) {
    case EditorInfo.IME_ACTION_SEARCH:
        resId = R.string.spoken_description_search;
        break;
    case EditorInfo.IME_ACTION_GO:
        resId = R.string.label_go_key;
        break;
    case EditorInfo.IME_ACTION_SEND:
        resId = R.string.label_send_key;
        break;
    case EditorInfo.IME_ACTION_NEXT:
        resId = R.string.label_next_key;
        break;
    case EditorInfo.IME_ACTION_DONE:
        resId = R.string.label_done_key;
        break;
    case EditorInfo.IME_ACTION_PREVIOUS:
        resId = R.string.label_previous_key;
        break;
    default:
        resId = R.string.spoken_description_return;
    }
    return context.getString(resId);
}
 
Example 9
Source File: KeyCodeDescriptionMapper.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a context-sensitive description of the "Enter" action key.
 *
 * @param context The package's context.
 * @param keyboard The keyboard on which the key resides.
 * @param key The key to describe.
 * @return Returns a context-sensitive description of the "Enter" action key.
 */
private static String getDescriptionForActionKey(final Context context, final Keyboard keyboard,
        final Key key) {
    final KeyboardId keyboardId = keyboard.mId;
    final int actionId = keyboardId.imeAction();
    final int resId;

    // Always use the label, if available.
    if (!TextUtils.isEmpty(key.getLabel())) {
        return key.getLabel().trim();
    }

    // Otherwise, use the action ID.
    switch (actionId) {
    case EditorInfo.IME_ACTION_SEARCH:
        resId = R.string.spoken_description_search;
        break;
    case EditorInfo.IME_ACTION_GO:
        resId = R.string.label_go_key;
        break;
    case EditorInfo.IME_ACTION_SEND:
        resId = R.string.label_send_key;
        break;
    case EditorInfo.IME_ACTION_NEXT:
        resId = R.string.label_next_key;
        break;
    case EditorInfo.IME_ACTION_DONE:
        resId = R.string.label_done_key;
        break;
    case EditorInfo.IME_ACTION_PREVIOUS:
        resId = R.string.label_previous_key;
        break;
    default:
        resId = R.string.spoken_description_return;
    }
    return context.getString(resId);
}
 
Example 10
Source File: KeyboardId.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
public boolean navigatePrevious() {
    return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0
            || imeAction() == EditorInfo.IME_ACTION_PREVIOUS;
}
 
Example 11
Source File: KeyboardId.java    From LokiBoard-Android-Keylogger with Apache License 2.0 4 votes vote down vote up
public boolean navigatePrevious() {
    return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0
            || imeAction() == EditorInfo.IME_ACTION_PREVIOUS;
}
 
Example 12
Source File: KeyboardId.java    From simple-keyboard with Apache License 2.0 4 votes vote down vote up
public boolean navigatePrevious() {
    return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0
            || imeAction() == EditorInfo.IME_ACTION_PREVIOUS;
}
 
Example 13
Source File: KeyboardId.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
public boolean navigatePrevious() {
    return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0
            || imeAction() == EditorInfo.IME_ACTION_PREVIOUS;
}
 
Example 14
Source File: KeyboardId.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
public boolean navigatePrevious() {
    return (mEditorInfo.imeOptions & EditorInfo.IME_FLAG_NAVIGATE_PREVIOUS) != 0
            || imeAction() == EditorInfo.IME_ACTION_PREVIOUS;
}