MCPcopy Create free account
hub / github.com/SatDump/SatDump / HideSoftKeyboardInput

Function HideSoftKeyboardInput

android/main.cpp:340–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340static int HideSoftKeyboardInput()
341{
342 JavaVM *java_vm = g_App->activity->vm;
343 JNIEnv *java_env = NULL;
344
345 jint jni_return = java_vm->GetEnv((void **)&java_env, JNI_VERSION_1_6);
346 if (jni_return == JNI_ERR)
347 return -1;
348
349 jni_return = java_vm->AttachCurrentThread(&java_env, NULL);
350 if (jni_return != JNI_OK)
351 return -2;
352
353 jclass native_activity_clazz = java_env->GetObjectClass(g_App->activity->clazz);
354 if (native_activity_clazz == NULL)
355 return -3;
356
357 jmethodID method_id = java_env->GetMethodID(native_activity_clazz, "hideSoftInput", "()V");
358 if (method_id == NULL)
359 return -4;
360
361 java_env->CallVoidMethod(g_App->activity->clazz, method_id);
362
363 jni_return = java_vm->DetachCurrentThread();
364 if (jni_return != JNI_OK)
365 return -5;
366
367 return 0;
368}
369
370// Unfortunately, the native KeyEvent implementation has no getUnicodeChar() function.
371// Therefore, we implement the processing of KeyEvents in MainActivity.kt and poll

Callers 2

initFunction · 0.85
tickFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected