diff android/dw.cpp @ 2702:4f12dc8e8f18

Android: Implement dw_mle_set_auto_complete() in the same way as iOS. DW_MLE_COMPLETE_TEXT will enable auto correction on an MLE. Disable dictionary suggestions on most edit/entry fields.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 17 Nov 2021 11:19:06 +0000
parents 9df2c11f020f
children 4e9eba7f7226
line wrap: on
line diff
--- a/android/dw.cpp	Tue Nov 16 20:15:18 2021 +0000
+++ b/android/dw.cpp	Wed Nov 17 11:19:06 2021 +0000
@@ -2733,6 +2733,19 @@
  */
 void API dw_mle_set_auto_complete(HWND handle, int state)
 {
+    JNIEnv *env;
+
+    if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
+    {
+        // First get the class that contains the method you need to call
+        jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
+        // Get the method that you want to call
+        jmethodID mleSetAutoComplete = env->GetMethodID(clazz, "mleSetAutoComplete",
+                                                  "(Landroid/widget/EditText;I)V");
+        // Call the method on the object
+        env->CallVoidMethod(_dw_obj, mleSetAutoComplete, handle, state);
+        _dw_jni_check_exception(env);
+    }
 }
 
 /*