X-Git-Url: http://nitlanguage.org diff --git a/lib/android/vibration.nit b/lib/android/vibration.nit index abff40f..79941dc 100644 --- a/lib/android/vibration.nit +++ b/lib/android/vibration.nit @@ -26,7 +26,6 @@ import native_app_glue # Handle to an Android vibrator extern class Vibrator in "Java" `{ android.os.Vibrator `} super JavaObject - redef type SELF: Vibrator # Vibrate for `n` miliseconds fun vibrate(n: Int) in "Java" `{ recv.vibrate(n); `} @@ -38,11 +37,18 @@ extern class Vibrator in "Java" `{ android.os.Vibrator `} # Turn off the vibration fun cancel in "Java" `{ recv.cancel(); `} + + # HACK for bug #845 + redef fun new_global_ref import sys, Sys.jni_env `{ + Sys sys = Vibrator_sys(recv); + JNIEnv *env = Sys_jni_env(sys); + return (*env)->NewGlobalRef(env, recv); + `} end redef class App # Get the handle to this device vibrator as a global ref - fun vibrator: Vibrator is cached do + var vibrator: Vibrator is lazy do var v = vibrator_native(native_activity) return v.new_global_ref end