Example usage for android.view.inputmethod InputMethodSubtype containsExtraValueKey

List of usage examples for android.view.inputmethod InputMethodSubtype containsExtraValueKey

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodSubtype containsExtraValueKey.

Prototype

public boolean containsExtraValueKey(String key) 

Source Link

Document

The string of ExtraValue in subtype should be defined as follows: example: key0,key1=value1,key2,key3,key4=value4

Usage

From source file:com.mobiletin.inputmethod.indic.LatinIME.java

private boolean checkForTransliteration() {
    Locale locale = mSubtypeSwitcher.getCurrentSubtypeLocale();

    if (!locale.getLanguage().equals("en")) {
        mInputLogic.setIndic(true);//from ww  w.  ja  v a  2 s . c o m
    } else {
        mInputLogic.setIndic(false);
    }

    InputMethodSubtype currentSubtype = mSubtypeSwitcher.getCurrentSubtype();
    if (currentSubtype.containsExtraValueKey(Constants.Subtype.ExtraValue.TRANSLITERATION_METHOD)) {
        try {
            String transliterationName = currentSubtype
                    .getExtraValueOf(Constants.Subtype.ExtraValue.TRANSLITERATION_METHOD);
            mInputLogic.enableTransliteration(transliterationName, getApplicationContext());
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
    mInputLogic.disableTransliteration();
    return false;
}