diff android/DWindows.kt @ 2482:4888503c3e3e

Android: Implement dw_debug() using the Android Log class. Make eventHandler() second View and string parameters nullable.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 26 Apr 2021 18:34:51 +0000
parents 94f0d61d6953
children 9f7af6d8c6a4
line wrap: on
line diff
--- a/android/DWindows.kt	Mon Apr 26 11:01:58 2021 +0000
+++ b/android/DWindows.kt	Mon Apr 26 18:34:51 2021 +0000
@@ -4,6 +4,7 @@
 import android.os.Bundle
 import android.text.method.PasswordTransformationMethod
 import android.util.Half.toFloat
+import android.util.Log
 import android.view.Gravity
 import android.view.View
 import android.widget.*
@@ -129,7 +130,9 @@
     {
         val button = Button(this)
         button.text = text
-        button.setOnClickListener { eventHandler(button, button, 8, "", "", 0, 0, 0, 0) }
+        button.setOnClickListener {
+            eventHandler(button, null, 8, null, null, 0, 0, 0, 0)
+        }
         return button
     }
 
@@ -147,7 +150,9 @@
     {
         val radiobutton = RadioButton(this)
         radiobutton.text = text
-        radiobutton.setOnClickListener { eventHandler(radiobutton, radiobutton, 8, "", "", 0, 0, 0, 0) }
+        radiobutton.setOnClickListener {
+            eventHandler(radiobutton, null, 8, null, null, 0, 0, 0, 0)
+        }
         return radiobutton
     }
 
@@ -155,6 +160,9 @@
     {
         val checkbox = CheckBox(this)
         checkbox.text = text
+        checkbox.setOnClickListener {
+            eventHandler(checkbox, null, 8, null, null, 0, 0, 0, 0)
+        }
         return checkbox
     }
 
@@ -165,12 +173,17 @@
         return textview
     }
 
+    fun debugMessage(text: String)
+    {
+        Log.d(null, text)
+    }
+
     /*
      * Native methods that are implemented by the 'dwindows' native library,
      * which is packaged with this application.
      */
     external fun dwindowsInit(dataDir: String): String
-    external fun eventHandler(obj1: Any, obj2: Any, message: Int, str1: String, str2: String, int1: Int, int2: Int, int3: Int, int4: Int): Int
+    external fun eventHandler(obj1: View, obj2: View?, message: Int, str1: String?, str2: String?, int1: Int, int2: Int, int3: Int, int4: Int): Int
 
     companion object
     {