X-Git-Url: http://nitlanguage.org?ds=sidebyside diff --git a/examples/mnit_simple/src/simple_android.nit b/examples/mnit_simple/src/simple_android.nit index 157bc7e..b108f8b 100644 --- a/examples/mnit_simple/src/simple_android.nit +++ b/examples/mnit_simple/src/simple_android.nit @@ -15,12 +15,14 @@ # limitations under the License. module simple_android is - java_package("org.nitlanguage.simple") android_manifest("""""") end -import simple import mnit_android +import android::portrait +import serialization + +import simple in "Java" `{ import android.content.Context; @@ -30,12 +32,13 @@ in "Java" `{ redef class App redef fun input( ie ) do - if ie isa PointerEvent and ie.depressed then do_java_stuff - + if ie isa PointerEvent and ie.depressed then + test_java_ffi + end return super end - fun do_java_stuff import native_activity in "Java" `{ + fun test_java_ffi import native_activity in "Java" `{ // + Log (no context needed) android.util.Log.d("mnit_simple", "Java within NIT!!!"); @@ -61,3 +64,18 @@ redef class App }); `} end + +class Point + auto_serializable + + var x: Int + var y: Int + + init(x, y: Int) + do + self.x = x + self.y = y + end + + redef fun to_s do return "({x}, {y})" +end