Example usage for android.view.inputmethod InputMethodManager getCurrentInputMethodSubtype

List of usage examples for android.view.inputmethod InputMethodManager getCurrentInputMethodSubtype

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodManager getCurrentInputMethodSubtype.

Prototype

public InputMethodSubtype getCurrentInputMethodSubtype() 

Source Link

Document

Returns the current input method subtype.

Usage

From source file:Main.java

public static String getLocale(final Context context) {
    InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
    InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();
    return ims == null ? "" : ims.getLocale();
}

From source file:com.android.screenspeak.eventprocessor.ProcessorPhoneticLetters.java

/**
 * Handle an event that indicates a key is held on the soft keyboard.
 *///w  w  w .  j  a  v  a  2  s .c om
private void processKeyboardKeyEvent(AccessibilityEvent event) {
    final CharSequence text = AccessibilityEventUtils.getEventTextOrDescription(event);
    if (TextUtils.isEmpty(text)) {
        return;
    }

    String localeString = FALLBACK_LOCALE;
    InputMethodManager inputMethodManager = (InputMethodManager) mService
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    InputMethodSubtype inputMethod = inputMethodManager.getCurrentInputMethodSubtype();
    if (inputMethod != null) {
        localeString = inputMethod.getLocale();
    }

    String phoneticLetter = getPhoneticLetter(localeString, text.toString());
    if (phoneticLetter != null) {
        postPhoneticLetterRunnable(phoneticLetter);
    }
}