From b78b961621e9cde355c8de2cb9fc168efcae4313 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Fri, 14 Apr 2023 06:12:47 +0200 Subject: [PATCH] feat!: allow specifying android activity in binding macro (#723) * feat!: allow specifying android activity in binding macro * Update .changes/android-activity.md --- .changes/android-activity.md | 5 +++++ src/platform_impl/android/ndk_glue.rs | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .changes/android-activity.md diff --git a/.changes/android-activity.md b/.changes/android-activity.md new file mode 100644 index 000000000..15a07498b --- /dev/null +++ b/.changes/android-activity.md @@ -0,0 +1,5 @@ +--- +"tao": "minor" +--- + +**Breaking change**: All ow specifying the android activity in `android_binding` macro, instead of hard-coded `TauriActivity`. diff --git a/src/platform_impl/android/ndk_glue.rs b/src/platform_impl/android/ndk_glue.rs index ea20c9f3f..09fffde21 100644 --- a/src/platform_impl/android/ndk_glue.rs +++ b/src/platform_impl/android/ndk_glue.rs @@ -29,7 +29,7 @@ pub static PACKAGE: OnceCell<&str> = OnceCell::new(); #[macro_export] macro_rules! android_binding { - ($domain:ident, $package:ident, $setup: ident, $main: ident) => { + ($domain:ident, $package:ident, $activity:ident, $setup:ident, $main:ident) => { fn __store_package_name__() { PACKAGE.get_or_init(move || generate_package_name!($domain, $package)); } @@ -37,21 +37,21 @@ macro_rules! android_binding { android_fn!( $domain, $package, - TauriActivity, + $activity, create, [JObject], __VOID__, [$setup, $main], __store_package_name__, ); - android_fn!($domain, $package, TauriActivity, start, [JObject]); - android_fn!($domain, $package, TauriActivity, stop, [JObject]); - android_fn!($domain, $package, TauriActivity, resume, [JObject]); - android_fn!($domain, $package, TauriActivity, pause, [JObject]); - android_fn!($domain, $package, TauriActivity, save, [JObject]); - android_fn!($domain, $package, TauriActivity, destroy, [JObject]); - android_fn!($domain, $package, TauriActivity, memory, [JObject]); - android_fn!($domain, $package, TauriActivity, focus, [i32]); + android_fn!($domain, $package, $activity, start, [JObject]); + android_fn!($domain, $package, $activity, stop, [JObject]); + android_fn!($domain, $package, $activity, resume, [JObject]); + android_fn!($domain, $package, $activity, pause, [JObject]); + android_fn!($domain, $package, $activity, save, [JObject]); + android_fn!($domain, $package, $activity, destroy, [JObject]); + android_fn!($domain, $package, $activity, memory, [JObject]); + android_fn!($domain, $package, $activity, focus, [i32]); }; }