Merge: Improve internal mechanisms of the nitvm
[nit.git] / lib / android / intent / intent_api10.nit
index 8fbc589..5312c15 100644 (file)
 # `android.content.Intent` for the android platform
 module intent_api10
 
-import native_app_glue
+import dalvik
 import android::bundle
 import serialization
-private import json_serialization
+private import json::serialization
 
 in "Java" `{
        import android.content.Intent;
@@ -34,6 +34,8 @@ in "Java" `{
 extern class NativeIntent in "Java" `{ android.content.Intent `}
        super JavaObject
 
+       new in "Java" `{ return new Intent(); `}
+
        fun add_category(category: JavaString) in "Java" `{ recv.addCategory(category); `}
        fun add_flags(flags: Int) in "Java" `{ recv.addFlags((int)flags); `}
        fun filter_equals(other: NativeIntent): Bool in "Java" `{
@@ -626,23 +628,7 @@ end
 
 # Services allowing to launch an activity and start/stop services
 class Intent
-       protected var intent: NativeIntent
-       protected var context: NativeActivity
-
-       init (app: App)
-       do
-               self.context = app.native_activity
-               setup
-       end
-
-       private fun set_vars(intent: NativeIntent) do
-               self.intent = intent.new_global_ref
-       end
-
-       private fun setup import context, intent, set_vars in "Java" `{
-               Intent intent = new Intent();
-               Intent_set_vars(recv, intent);
-       `}
+       protected var intent: NativeIntent = (new NativeIntent).new_global_ref is lazy
 
        # The general action to be performed
        #