Skip to content

Commit

Permalink
fix: prevent webview from getting cleaned up by system
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmo314 committed Sep 4, 2021
1 parent fef096b commit cebed8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions android/app/src/main/kotlin/com/rtirl/chat/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class MainActivity : FlutterActivity() {
view.settings.mediaPlaybackRequiresUserGesture = false
view.settings.domStorageEnabled = true
view.settings.databaseEnabled = true
view.settings.mixedContentMode = WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE
view.webChromeClient = object : WebChromeClient() {
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
Log.d("WebView", consoleMessage.message())
return true
}
}
view.visibility = View.INVISIBLE
view.setLayerType(View.LAYER_TYPE_HARDWARE, null)
view.loadUrl(it)
view.webViewClient = object : WebViewClient() {
Expand All @@ -71,8 +71,8 @@ class MainActivity : FlutterActivity() {

wm.addView(
view, WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
0,
0,
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY else WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE,
PixelFormat.OPAQUE
Expand Down

0 comments on commit cebed8c

Please sign in to comment.