diff android/DWindows.kt @ 2477:3fbf8783122d

Android: First functional version. Notebook-less first page of dwtest works. FindClass failed on any created threads.. using a modified version of this: https://stackoverflow.com/questions/13263340/findclass-from-any-thread-in-android-jni Implemented dw_box_unpack(). Had to do this to fix an exception when repacking a widget in dwtest's archive_add().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 22 Apr 2021 17:49:20 +0000
parents 20c9e83cba2a
children b0230e378667
line wrap: on
line diff
--- a/android/DWindows.kt	Thu Apr 22 00:04:01 2021 +0000
+++ b/android/DWindows.kt	Thu Apr 22 17:49:20 2021 +0000
@@ -9,12 +9,9 @@
 
 class DWindows : AppCompatActivity()
 {
-    public var windowLayout: LinearLayout = LinearLayout(this)
-
     override fun onCreate(savedInstanceState: Bundle?)
     {
         super.onCreate(savedInstanceState)
-        setContentView(windowLayout)
 
         val m = packageManager
         var s = packageName
@@ -31,6 +28,8 @@
      */
     fun windowNew(title: String, style: Int): LinearLayout
     {
+        var windowLayout: LinearLayout = LinearLayout(this)
+        setContentView(windowLayout)
         // For now we just return our DWindows' main activity layout...
         // in the future, later calls should create new activities
         return windowLayout
@@ -68,6 +67,12 @@
         box.addView(item)
     }
 
+    fun boxUnpack(item: View)
+    {
+        var box: LinearLayout = item.parent as LinearLayout
+        box.removeView(item)
+    }
+
     fun buttonNew(text: String, cid: Int): Button
     {
         val button = Button(this)