android: update activity lib, optimize app exit

This commit is contained in:
ardocrat
2023-08-01 01:03:51 +03:00
parent a95038fc9d
commit 80a04596df
9 changed files with 51 additions and 74 deletions
-11
View File
@@ -74,15 +74,4 @@ impl PlatformCallbacks for Android {
};
paste_data
}
fn exit(&self) {
use jni::objects::{JObject};
let vm = unsafe { jni::JavaVM::from_raw(self.android_app.vm_as_ptr() as _) }.unwrap();
let mut env = vm.attach_current_thread().unwrap();
let activity = unsafe {
JObject::from_raw(self.android_app.activity_as_ptr() as jni::sys::jobject)
};
env.call_method(activity, "onExit", "()V", &[]).unwrap();
}
}
-2
View File
@@ -27,6 +27,4 @@ impl PlatformCallbacks for Desktop {
fn get_string_from_buffer(&self) -> String {
"".to_string()
}
fn exit(&self) {}
}
-1
View File
@@ -26,5 +26,4 @@ pub trait PlatformCallbacks {
fn hide_keyboard(&self);
fn copy_string_to_buffer(&self, data: String);
fn get_string_from_buffer(&self) -> String;
fn exit(&self);
}