Search in sources :

Example 6 with ResourceName

use of org.robolectric.res.android.ResTable.ResourceName in project robolectric by robolectric.

the class ShadowArscAssetManager method getResourceName.

@Implementation
protected String getResourceName(int resid) {
    CppAssetManager am = assetManagerForJavaObject();
    ResourceName name = new ResourceName();
    if (!am.getResources().getResourceName(resid, true, name)) {
        return null;
    }
    StringBuilder str = new StringBuilder();
    if (name.packageName != null) {
        str.append(name.packageName.trim());
    }
    if (name.type != null) {
        if (str.length() > 0) {
            char div = ':';
            str.append(div);
        }
        str.append(name.type);
    }
    if (name.name != null) {
        if (str.length() > 0) {
            char div = '/';
            str.append(div);
        }
        str.append(name.name);
    }
    return str.toString();
}
Also used : CppAssetManager(org.robolectric.res.android.CppAssetManager) ResourceName(org.robolectric.res.android.ResTable.ResourceName) Implementation(org.robolectric.annotation.Implementation)

Aggregations

ResourceName (org.robolectric.res.android.ResTable.ResourceName)6 Implementation (org.robolectric.annotation.Implementation)4 CppAssetManager (org.robolectric.res.android.CppAssetManager)4 ResTable.bag_entry (org.robolectric.res.android.ResTable.bag_entry)2 Ref (org.robolectric.res.android.Ref)1 PackageGroup (org.robolectric.res.android.ResTable.PackageGroup)1 Type (org.robolectric.res.android.ResTable.Type)1 Res_value (org.robolectric.res.android.ResourceTypes.Res_value)1