Search in sources :

Example 11 with ResXMLParser

use of org.robolectric.res.android.ResXMLParser in project robolectric by robolectric.

the class ShadowXmlBlock method nativeCreateParseState.

@Implementation(minSdk = VERSION_CODES.LOLLIPOP, maxSdk = VERSION_CODES.P)
protected static long nativeCreateParseState(long obj) {
    ResXMLTree osb = Registries.NATIVE_RES_XML_TREES.getNativeObject(obj);
    // if (osb == NULL) {
    // jniThrowNullPointerException(env, NULL);
    // return 0;
    // }
    ResXMLParser st = new ResXMLParser(osb);
    // if (st == NULL) {
    // jniThrowException(env, "java/lang/OutOfMemoryError", NULL);
    // return 0;
    // }
    st.restart();
    return Registries.NATIVE_RES_XML_PARSERS.register(st);
}
Also used : ResXMLTree(org.robolectric.res.android.ResXMLTree) ResXMLParser(org.robolectric.res.android.ResXMLParser) Implementation(org.robolectric.annotation.Implementation)

Example 12 with ResXMLParser

use of org.robolectric.res.android.ResXMLParser in project robolectric by robolectric.

the class ShadowXmlBlock method nativeGetAttributeIndex.

@Implementation(minSdk = VERSION_CODES.LOLLIPOP)
protected static int nativeGetAttributeIndex(long token, String ns, String name) {
    ResXMLParser st = getResXMLParser(token);
    if (st == null || name == null) {
        throw new NullPointerException();
    }
    int nsLen = 0;
    if (ns != null) {
        nsLen = ns.length();
    }
    return st.indexOfAttribute(ns, nsLen, name, name.length());
}
Also used : ResXMLParser(org.robolectric.res.android.ResXMLParser) Implementation(org.robolectric.annotation.Implementation)

Aggregations

ResXMLParser (org.robolectric.res.android.ResXMLParser)12 Implementation (org.robolectric.annotation.Implementation)10 CppAssetManager2 (org.robolectric.res.android.CppAssetManager2)4 HiddenApi (org.robolectric.annotation.HiddenApi)2 Theme (org.robolectric.res.android.CppAssetManager2.Theme)2 ResXMLTree (org.robolectric.res.android.ResXMLTree)2 CppAssetManager (org.robolectric.res.android.CppAssetManager)1 Ref (org.robolectric.res.android.Ref)1 ResTable (org.robolectric.res.android.ResTable)1 ResTableTheme (org.robolectric.res.android.ResTableTheme)1 Res_value (org.robolectric.res.android.ResourceTypes.Res_value)1