manager: Add jsapi: toast
This commit is contained in:
@@ -9,6 +9,7 @@ import android.text.TextUtils
|
|||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.webkit.JavascriptInterface
|
import android.webkit.JavascriptInterface
|
||||||
import android.webkit.WebView
|
import android.webkit.WebView
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material3.Scaffold
|
import androidx.compose.material3.Scaffold
|
||||||
@@ -132,6 +133,13 @@ class WebViewInterface(val context: Context, val webView: WebView) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
fun toast(msg: String) {
|
||||||
|
webView.post {
|
||||||
|
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun fullScreen(enable: Boolean) {
|
fun fullScreen(enable: Boolean) {
|
||||||
if (context is Activity) {
|
if (context is Activity) {
|
||||||
|
|||||||
Reference in New Issue
Block a user