Example usage for android.view.inputmethod EditorInfo IME_ACTION_NONE

List of usage examples for android.view.inputmethod EditorInfo IME_ACTION_NONE

Introduction

In this page you can find the example usage for android.view.inputmethod EditorInfo IME_ACTION_NONE.

Prototype

int IME_ACTION_NONE

To view the source code for android.view.inputmethod EditorInfo IME_ACTION_NONE.

Click Source Link

Document

Bits of #IME_MASK_ACTION : there is no available action.

Usage

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;
            }//www  .j ava  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.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java

private Drawable getIconForKeyCode(int keyCode) {
    Drawable icon = mKeysIcons.get(keyCode);

    if (icon == null) {
        // building needed icon
        Log.d(TAG, "Building icon for key-code %d", keyCode);
        DrawableBuilder builder = mKeysIconBuilders.get(keyCode);
        if (builder == null)
            return null;
        icon = builder.buildDrawable();//from  w  ww .  j a  v  a  2s  .  co m
        mKeysIcons.put(keyCode, icon);
        Log.d(TAG, "Current drawable cache size is %d", mKeysIcons.size());
    }
    // maybe a drawable state is required
    if (icon != null) {
        switch (keyCode) {
        case KeyCodes.ENTER:
            Log.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;
            }
            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;
}