| 305 | } |
| 306 | |
| 307 | Error GodotJavaWrapper::show_dialog(const String &p_title, const String &p_description, const Vector<String> &p_buttons) { |
| 308 | if (_show_input_dialog) { |
| 309 | JNIEnv *env = get_jni_env(); |
| 310 | ERR_FAIL_NULL_V(env, ERR_UNCONFIGURED); |
| 311 | jstring j_title = env->NewStringUTF(p_title.utf8().get_data()); |
| 312 | jstring j_description = env->NewStringUTF(p_description.utf8().get_data()); |
| 313 | jobjectArray j_buttons = env->NewObjectArray(p_buttons.size(), jni_find_class(env, "java/lang/String"), nullptr); |
| 314 | for (int i = 0; i < p_buttons.size(); ++i) { |
| 315 | jstring j_button = env->NewStringUTF(p_buttons[i].utf8().get_data()); |
| 316 | env->SetObjectArrayElement(j_buttons, i, j_button); |
| 317 | env->DeleteLocalRef(j_button); |
| 318 | } |
| 319 | env->CallVoidMethod(godot_instance, _show_dialog, j_title, j_description, j_buttons); |
| 320 | env->DeleteLocalRef(j_title); |
| 321 | env->DeleteLocalRef(j_description); |
| 322 | env->DeleteLocalRef(j_buttons); |
| 323 | return OK; |
| 324 | } else { |
| 325 | return ERR_UNCONFIGURED; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | Error GodotJavaWrapper::show_input_dialog(const String &p_title, const String &p_message, const String &p_existing_text) { |
| 330 | if (_show_input_dialog) { |
no test coverage detected