summaryrefslogtreecommitdiff
path: root/platform/android/java_godot_view_wrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/java_godot_view_wrapper.cpp')
-rw-r--r--platform/android/java_godot_view_wrapper.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/platform/android/java_godot_view_wrapper.cpp b/platform/android/java_godot_view_wrapper.cpp
index 0153ba96fc..762840a4b1 100644
--- a/platform/android/java_godot_view_wrapper.cpp
+++ b/platform/android/java_godot_view_wrapper.cpp
@@ -40,13 +40,24 @@ GodotJavaViewWrapper::GodotJavaViewWrapper(jobject godot_view) {
_cls = (jclass)env->NewGlobalRef(env->GetObjectClass(godot_view));
- if (android_get_device_api_level() >= __ANDROID_API_O__) {
+ int android_device_api_level = android_get_device_api_level();
+ if (android_device_api_level >= __ANDROID_API_N__) {
+ _set_pointer_icon = env->GetMethodID(_cls, "setPointerIcon", "(I)V");
+ }
+ if (android_device_api_level >= __ANDROID_API_O__) {
_request_pointer_capture = env->GetMethodID(_cls, "requestPointerCapture", "()V");
_release_pointer_capture = env->GetMethodID(_cls, "releasePointerCapture", "()V");
- _set_pointer_icon = env->GetMethodID(_cls, "setPointerIcon", "(I)V");
}
}
+bool GodotJavaViewWrapper::can_update_pointer_icon() const {
+ return _set_pointer_icon != nullptr;
+}
+
+bool GodotJavaViewWrapper::can_capture_pointer() const {
+ return _request_pointer_capture != nullptr && _release_pointer_capture != nullptr;
+}
+
void GodotJavaViewWrapper::request_pointer_capture() {
if (_request_pointer_capture != nullptr) {
JNIEnv *env = get_jni_env();