Search in sources :

Example 16 with Theme

use of org.robolectric.res.android.CppAssetManager2.Theme in project robolectric by robolectric.

the class ShadowArscAssetManager10 method nativeApplyStyle_measured.

private static void nativeApplyStyle_measured(long ptr, long theme_ptr, @AttrRes int def_style_attr, @StyleRes int def_style_resid, long xml_parser_ptr, @NonNull int[] java_attrs, long out_values_ptr, long out_indices_ptr) {
    CppAssetManager2 assetmanager = AssetManagerFromLong(ptr);
    Theme theme = Registries.NATIVE_THEME9_REGISTRY.getNativeObject(theme_ptr);
    CHECK(theme.GetAssetManager() == assetmanager);
    // (void) assetmanager;
    ResXMLParser xml_parser = xml_parser_ptr == 0 ? null : NATIVE_RES_XML_PARSERS.getNativeObject(xml_parser_ptr);
    // int[] out_values = reinterpret_cast<int*>(out_values_ptr);
    // int[] out_indices = reinterpret_cast<int*>(out_indices_ptr);
    ShadowVMRuntime shadowVMRuntime = Shadow.extract(VMRuntime.getRuntime());
    int[] out_values = (int[]) shadowVMRuntime.getObjectForAddress(out_values_ptr);
    int[] out_indices = (int[]) shadowVMRuntime.getObjectForAddress(out_indices_ptr);
    int attrs_len = java_attrs.length;
    int[] attrs = // reinterpret_cast<int*>(env.GetPrimitiveArrayCritical(java_attrs, null));
    java_attrs;
    // if (attrs == null) {
    // return;
    // }
    ApplyStyle(theme, xml_parser, (int) (def_style_attr), (int) (def_style_resid), attrs, attrs_len, out_values, out_indices);
// env.ReleasePrimitiveArrayCritical(java_attrs, attrs, JNI_ABORT);
}
Also used : CppAssetManager2(org.robolectric.res.android.CppAssetManager2) Theme(org.robolectric.res.android.CppAssetManager2.Theme) ResXMLParser(org.robolectric.res.android.ResXMLParser)

Aggregations

Theme (org.robolectric.res.android.CppAssetManager2.Theme)12 CppAssetManager2 (org.robolectric.res.android.CppAssetManager2)11 Implementation (org.robolectric.annotation.Implementation)10 Res_value (org.robolectric.res.android.ResourceTypes.Res_value)6 ResolvedBag (org.robolectric.res.android.CppAssetManager2.ResolvedBag)4 Entry (org.robolectric.res.android.CppAssetManager2.ResolvedBag.Entry)4 ApkAssetsCookie (org.robolectric.res.android.ApkAssetsCookie)2 Ref (org.robolectric.res.android.Ref)2 ResTable_config (org.robolectric.res.android.ResTable_config)2 ResXMLParser (org.robolectric.res.android.ResXMLParser)2