Search in sources :

Example 1 with ParseException

use of com.android.inputmethod.latin.utils.XmlParseUtils.ParseException in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class KeyboardBuilder method parseKey.

private void parseKey(final XmlPullParser parser, final KeyboardRow row, final boolean skip) throws XmlPullParserException, IOException {
    if (skip) {
        XmlParseUtils.checkEndTag(TAG_KEY, parser);
        if (DEBUG)
            startEndTag("<%s /> skipped", TAG_KEY);
        return;
    }
    final TypedArray keyAttr = mResources.obtainAttributes(Xml.asAttributeSet(parser), R.styleable.Keyboard_Key);
    final KeyStyle keyStyle = mParams.mKeyStyles.getKeyStyle(keyAttr, parser);
    final String keySpec = keyStyle.getString(keyAttr, R.styleable.Keyboard_Key_keySpec);
    if (TextUtils.isEmpty(keySpec)) {
        throw new ParseException("Empty keySpec", parser);
    }
    final Key key = new Key(keySpec, keyAttr, keyStyle, mParams, row);
    keyAttr.recycle();
    if (DEBUG) {
        startEndTag("<%s%s %s moreKeys=%s />", TAG_KEY, (key.isEnabled() ? "" : " disabled"), key, Arrays.toString(key.getMoreKeys()));
    }
    XmlParseUtils.checkEndTag(TAG_KEY, parser);
    endKey(key);
}
Also used : TypedArray(android.content.res.TypedArray) ParseException(com.android.inputmethod.latin.utils.XmlParseUtils.ParseException) Key(com.android.inputmethod.keyboard.Key)

Aggregations

TypedArray (android.content.res.TypedArray)1 Key (com.android.inputmethod.keyboard.Key)1 ParseException (com.android.inputmethod.latin.utils.XmlParseUtils.ParseException)1