diff android/DWindows.kt @ 2708:3a7dcc0ae08b

Android: Implement dw_mle_search(). Also revert lowercase() change. Another system is telling me lowercase() is experimental.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 19 Nov 2021 18:48:41 +0000
parents a3f6ca621453
children 3cb5aa73dace
line wrap: on
line diff
--- a/android/DWindows.kt	Fri Nov 19 02:49:53 2021 +0000
+++ b/android/DWindows.kt	Fri Nov 19 18:48:41 2021 +0000
@@ -330,7 +330,7 @@
     // filter on file extension
     private var extension: String? = null
     fun setExtension(extension: String?) {
-        this.extension = extension?.lowercase(Locale.ROOT)
+        this.extension = extension?.toLowerCase(Locale.ROOT)
     }
 
     // file selection event handling
@@ -363,7 +363,7 @@
                         } else if (extension == null) {
                             true
                         } else {
-                            file.name.lowercase(Locale.ROOT).endsWith(extension!!)
+                            file.name.toLowerCase(Locale.ROOT).endsWith(extension!!)
                         }
                     } else {
                         false
@@ -2236,6 +2236,26 @@
         }
     }
 
+    fun mleSearch(mle: EditText, text: String, point: Int, flags: Int): Int
+    {
+        var retval: Int = -1
+        var ignorecase: Boolean = true
+
+        // DW_MLE_CASESENSITIVE 1
+        if(flags == 1) {
+            ignorecase = false
+        }
+
+        waitOnUiThread {
+            retval = mle.text.indexOf(text, point, ignorecase)
+
+            if(retval > -1) {
+                mle.setSelection(retval, retval + text.length)
+            }
+        }
+        return retval
+    }
+
     fun mleClear(mle: EditText)
     {
         waitOnUiThread {