diff options
author | Zae <zaevi@live.com> | 2023-09-26 11:00:04 +0800 |
---|---|---|
committer | Zae <zaevi@live.com> | 2023-09-26 11:00:04 +0800 |
commit | 428eb1309aaadf3cf2d01e4e6cbfda16ad85bf6a (patch) | |
tree | 339e7cfbe85b440f0618aa70bb15e4815a4ba747 /platform/android/java_godot_wrapper.cpp | |
parent | c12d63556b5c1da03a00dd4c45c40e60bd8d68c2 (diff) | |
download | redot-engine-428eb1309aaadf3cf2d01e4e6cbfda16ad85bf6a.tar.gz |
Support dark mode on Android and iOS.
Diffstat (limited to 'platform/android/java_godot_wrapper.cpp')
-rw-r--r-- | platform/android/java_godot_wrapper.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/platform/android/java_godot_wrapper.cpp b/platform/android/java_godot_wrapper.cpp index a01a74f1fd..1703179b8e 100644 --- a/platform/android/java_godot_wrapper.cpp +++ b/platform/android/java_godot_wrapper.cpp @@ -62,6 +62,8 @@ GodotJavaWrapper::GodotJavaWrapper(JNIEnv *p_env, jobject p_activity, jobject p_ _finish = p_env->GetMethodID(godot_class, "forceQuit", "(I)Z"); _set_keep_screen_on = p_env->GetMethodID(godot_class, "setKeepScreenOn", "(Z)V"); _alert = p_env->GetMethodID(godot_class, "alert", "(Ljava/lang/String;Ljava/lang/String;)V"); + _is_dark_mode_supported = p_env->GetMethodID(godot_class, "isDarkModeSupported", "()Z"); + _is_dark_mode = p_env->GetMethodID(godot_class, "isDarkMode", "()Z"); _get_clipboard = p_env->GetMethodID(godot_class, "getClipboard", "()Ljava/lang/String;"); _set_clipboard = p_env->GetMethodID(godot_class, "setClipboard", "(Ljava/lang/String;)V"); _has_clipboard = p_env->GetMethodID(godot_class, "hasClipboard", "()Z"); @@ -172,6 +174,26 @@ void GodotJavaWrapper::alert(const String &p_message, const String &p_title) { } } +bool GodotJavaWrapper::is_dark_mode_supported() { + if (_is_dark_mode_supported) { + JNIEnv *env = get_jni_env(); + ERR_FAIL_NULL_V(env, false); + return env->CallBooleanMethod(godot_instance, _is_dark_mode_supported); + } else { + return false; + } +} + +bool GodotJavaWrapper::is_dark_mode() { + if (_is_dark_mode) { + JNIEnv *env = get_jni_env(); + ERR_FAIL_NULL_V(env, false); + return env->CallBooleanMethod(godot_instance, _is_dark_mode); + } else { + return false; + } +} + bool GodotJavaWrapper::has_get_clipboard() { return _get_clipboard != nullptr; } |