module assets_and_resources
import native_app_glue
-import java_io
import java
+import java::io
in "Java" `{
import android.content.res.AssetManager;
# This is a low-level class, use `AssetManager` instead
extern class NativeAssetManager in "Java" `{ android.content.res.AssetManager `}
super JavaObject
- redef type SELF: NativeAssetManager
fun close in "Java" `{ recv.close(); `}
# This is a low-level class, use `ResourcesManager` instead
extern class NativeResources in "Java" `{ android.content.res.Resources `}
super JavaObject
- redef type SELF: NativeResources
fun get_assets:NativeAssetManager in "Java" `{ return recv.getAssets(); `}
fun get_color(id: Int): Int in "Java" `{ return recv.getColor((int)id); `}
fun get_resource_name(resid: Int): JavaString in "Java" `{ return recv.getResourceName((int)resid); `}
fun get_resource_pakage_name(resid: Int): JavaString in "Java" `{ return recv.getResourcePackageName((int)resid); `}
fun get_resource_type_name(resid: Int): JavaString in "Java" `{ return recv.getResourceTypeName((int)resid); `}
+
+ # HACK for bug #845
+ redef fun new_global_ref import sys, Sys.jni_env `{
+ Sys sys = NativeResources_sys(recv);
+ JNIEnv *env = Sys_jni_env(sys);
+ return (*env)->NewGlobalRef(env, recv);
+ `}
end
# Resource manager for android resources placed in the `res` folder of your app
# An android Bitmap, get an instance using the AssetManager or the ResourceManager
extern class NativeBitmap in "Java" `{ android.graphics.Bitmap `}
super JavaObject
- redef type SELF: NativeBitmap
# Create a NativeBitmap from a NativeInputStream retrieved with `open` function of the AssetManager
# Called by the AssetManager
# Android AssetFileDescriptor, can be retrieve by AssetManager and used to load a sound in a SoundPool
extern class NativeAssetFileDescriptor in "Java" `{ android.content.res.AssetFileDescriptor `}
super JavaObject
- redef type SELF: NativeAssetFileDescriptor
fun close in "Java" `{
try {