Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ pub fn destroy_webview(activity_id: ActivityId, webview_id: &WebviewId) {
///
/// This function must be run on the thread where the [`JNIEnv`] is registered and the looper is local,
/// hence the requirement for a [`ThreadLooper`].
pub unsafe fn android_setup(
pub(crate) unsafe fn android_setup(
package: &str,
mut env: JNIEnv,
_looper: &ThreadLooper,
Expand Down
17 changes: 15 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,6 @@ mod web_context;
#[cfg(target_os = "android")]
pub(crate) mod android;
#[cfg(target_os = "android")]
pub use crate::android::android_setup;
#[cfg(target_os = "android")]
pub mod prelude {
pub use crate::android::{binding::*, dispatch, find_class, Context};
pub use tao_macros::{android_fn, generate_package_name};
Expand Down Expand Up @@ -1459,6 +1457,21 @@ impl<'a> WebViewBuilder<'a> {
InnerWebView::new(window, self.attrs, self.platform_specific).map(|webview| WebView { webview })
}

#[cfg(target_os = "android")]
/// This function must be run on the thread where the [`JNIEnv`] is registered and the looper is local,
/// hence the requirement for a [`ThreadLooper`].
pub unsafe fn build_android<W: HasWindowHandle>(
self,
window: &'a W,
package: &str,
env: jni::JNIEnv,
_looper: &ndk::looper::ThreadLooper,
activity: jni::objects::GlobalRef,
) -> Result<WebView> {
unsafe { android_setup(package, env, _looper, activity) };
self.build(window)
}

/// Consume the builder and create the [`WebView`] as a child window inside the provided [`HasWindowHandle`].
///
/// ## Platform-specific
Expand Down
Loading