mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 13:41:03 +00:00 
			
		
		
		
	Cleanup Android C++ code
This commit is contained in:
		
							parent
							
								
									340283f5be
								
							
						
					
					
						commit
						7a782edeaa
					
				
					 29 changed files with 405 additions and 459 deletions
				
			
		|  | @ -80,7 +80,7 @@ jobject GodotIOJavaWrapper::get_instance() { | |||
| Error GodotIOJavaWrapper::open_uri(const String &p_uri) { | ||||
| 	if (_open_URI) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, ERR_UNAVAILABLE); | ||||
| 		ERR_FAIL_NULL_V(env, ERR_UNAVAILABLE); | ||||
| 		jstring jStr = env->NewStringUTF(p_uri.utf8().get_data()); | ||||
| 		return env->CallIntMethod(godot_io_instance, _open_URI, jStr) ? ERR_CANT_OPEN : OK; | ||||
| 	} else { | ||||
|  | @ -91,7 +91,7 @@ Error GodotIOJavaWrapper::open_uri(const String &p_uri) { | |||
| String GodotIOJavaWrapper::get_cache_dir() { | ||||
| 	if (_get_cache_dir) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String()); | ||||
| 		ERR_FAIL_NULL_V(env, String()); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_cache_dir); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  | @ -102,7 +102,7 @@ String GodotIOJavaWrapper::get_cache_dir() { | |||
| String GodotIOJavaWrapper::get_user_data_dir() { | ||||
| 	if (_get_data_dir) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String()); | ||||
| 		ERR_FAIL_NULL_V(env, String()); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_data_dir); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  | @ -113,7 +113,7 @@ String GodotIOJavaWrapper::get_user_data_dir() { | |||
| String GodotIOJavaWrapper::get_locale() { | ||||
| 	if (_get_locale) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String()); | ||||
| 		ERR_FAIL_NULL_V(env, String()); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_locale); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  | @ -124,7 +124,7 @@ String GodotIOJavaWrapper::get_locale() { | |||
| String GodotIOJavaWrapper::get_model() { | ||||
| 	if (_get_model) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String()); | ||||
| 		ERR_FAIL_NULL_V(env, String()); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_model); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  | @ -135,7 +135,7 @@ String GodotIOJavaWrapper::get_model() { | |||
| int GodotIOJavaWrapper::get_screen_dpi() { | ||||
| 	if (_get_screen_DPI) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, 160); | ||||
| 		ERR_FAIL_NULL_V(env, 160); | ||||
| 		return env->CallIntMethod(godot_io_instance, _get_screen_DPI); | ||||
| 	} else { | ||||
| 		return 160; | ||||
|  | @ -145,7 +145,7 @@ int GodotIOJavaWrapper::get_screen_dpi() { | |||
| float GodotIOJavaWrapper::get_scaled_density() { | ||||
| 	if (_get_scaled_density) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, 1.0f); | ||||
| 		ERR_FAIL_NULL_V(env, 1.0f); | ||||
| 		return env->CallFloatMethod(godot_io_instance, _get_scaled_density); | ||||
| 	} else { | ||||
| 		return 1.0f; | ||||
|  | @ -168,7 +168,7 @@ float GodotIOJavaWrapper::get_screen_refresh_rate(float p_fallback) { | |||
| void GodotIOJavaWrapper::get_window_safe_area(int (&p_rect_xywh)[4]) { | ||||
| 	if (_get_window_safe_area) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND(env == nullptr); | ||||
| 		ERR_FAIL_NULL(env); | ||||
| 		jintArray returnArray = (jintArray)env->CallObjectMethod(godot_io_instance, _get_window_safe_area); | ||||
| 		ERR_FAIL_COND(env->GetArrayLength(returnArray) != 4); | ||||
| 		jint *arrayBody = env->GetIntArrayElements(returnArray, JNI_FALSE); | ||||
|  | @ -203,7 +203,7 @@ Array GodotIOJavaWrapper::get_display_cutouts() { | |||
| String GodotIOJavaWrapper::get_unique_id() { | ||||
| 	if (_get_unique_id) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String()); | ||||
| 		ERR_FAIL_NULL_V(env, String()); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_unique_id); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  | @ -212,13 +212,13 @@ String GodotIOJavaWrapper::get_unique_id() { | |||
| } | ||||
| 
 | ||||
| bool GodotIOJavaWrapper::has_vk() { | ||||
| 	return (_show_keyboard != 0) && (_hide_keyboard != 0); | ||||
| 	return (_show_keyboard != nullptr) && (_hide_keyboard != nullptr); | ||||
| } | ||||
| 
 | ||||
| void GodotIOJavaWrapper::show_vk(const String &p_existing, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) { | ||||
| 	if (_show_keyboard) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND(env == nullptr); | ||||
| 		ERR_FAIL_NULL(env); | ||||
| 		jstring jStr = env->NewStringUTF(p_existing.utf8().get_data()); | ||||
| 		env->CallVoidMethod(godot_io_instance, _show_keyboard, jStr, p_multiline, p_max_input_length, p_cursor_start, p_cursor_end); | ||||
| 	} | ||||
|  | @ -227,7 +227,7 @@ void GodotIOJavaWrapper::show_vk(const String &p_existing, bool p_multiline, int | |||
| void GodotIOJavaWrapper::hide_vk() { | ||||
| 	if (_hide_keyboard) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND(env == nullptr); | ||||
| 		ERR_FAIL_NULL(env); | ||||
| 		env->CallVoidMethod(godot_io_instance, _hide_keyboard); | ||||
| 	} | ||||
| } | ||||
|  | @ -235,7 +235,7 @@ void GodotIOJavaWrapper::hide_vk() { | |||
| void GodotIOJavaWrapper::set_screen_orientation(int p_orient) { | ||||
| 	if (_set_screen_orientation) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND(env == nullptr); | ||||
| 		ERR_FAIL_NULL(env); | ||||
| 		env->CallVoidMethod(godot_io_instance, _set_screen_orientation, p_orient); | ||||
| 	} | ||||
| } | ||||
|  | @ -243,7 +243,7 @@ void GodotIOJavaWrapper::set_screen_orientation(int p_orient) { | |||
| int GodotIOJavaWrapper::get_screen_orientation() const { | ||||
| 	if (_get_screen_orientation) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, 0); | ||||
| 		ERR_FAIL_NULL_V(env, 0); | ||||
| 		return env->CallIntMethod(godot_io_instance, _get_screen_orientation); | ||||
| 	} else { | ||||
| 		return 0; | ||||
|  | @ -253,7 +253,7 @@ int GodotIOJavaWrapper::get_screen_orientation() const { | |||
| String GodotIOJavaWrapper::get_system_dir(int p_dir, bool p_shared_storage) { | ||||
| 	if (_get_system_dir) { | ||||
| 		JNIEnv *env = get_jni_env(); | ||||
| 		ERR_FAIL_COND_V(env == nullptr, String(".")); | ||||
| 		ERR_FAIL_NULL_V(env, String(".")); | ||||
| 		jstring s = (jstring)env->CallObjectMethod(godot_io_instance, _get_system_dir, p_dir, p_shared_storage); | ||||
| 		return jstring_to_string(s, env); | ||||
| 	} else { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Marcel Admiraal
						Marcel Admiraal