Skip to content

feat: add function onCloseWindow #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025
Merged
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
11 changes: 9 additions & 2 deletions app/src/main/java/com/openwebgal/demo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class MainActivity : AppCompatActivity() {
request: WebResourceRequest
): WebResourceResponse? {
val interceptedRequest = assetLoader.shouldInterceptRequest(
Uri.decode(request.url.toString()).toUri())
Uri.decode(request.url.toString()).toUri()
)
interceptedRequest?.let {
if (request.url.toString().endsWith("js", true)) {
it.mimeType = "text/javascript"
Expand Down Expand Up @@ -99,9 +100,15 @@ class MainActivity : AppCompatActivity() {
}

//移除默认播放海报
override fun getDefaultVideoPoster(): Bitmap? {
override fun getDefaultVideoPoster(): Bitmap {
return createBitmap(10, 10)
}

//退出游戏
override fun onCloseWindow(window: WebView?) {
super.onCloseWindow(window)
[email protected]()
}
}
}

Expand Down