fix: schwarze Systemleisten (Edge-to-Edge), Discord-Statuszeile mit Titel (v1.1.1)

This commit is contained in:
2026-09-27 02:48:39 +02:00
parent 7697bcfaee
commit e3650a6776
7 changed files with 40 additions and 22 deletions
@@ -23,6 +23,9 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.webkit.WebSettingsCompat
import androidx.webkit.WebViewCompat
import androidx.webkit.WebViewFeature
@@ -48,6 +51,7 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)
webView = findViewById(R.id.webView)
progress = findViewById(R.id.progress)
keepContentBetweenSystemBars()
configureWebView()
onBackPressedDispatcher.addCallback(
@@ -84,6 +88,21 @@ class MainActivity : AppCompatActivity() {
super.onPause()
}
/**
* Ab Android 15 zeichnet jede App unter Status- und Navigationsleiste. Die Seite bekommt deshalb
* Abstand oben/unten (und fuer die Tastatur); dahinter bleiben schwarze Balken stehen.
*/
private fun keepContentBetweenSystemBars() {
val insetsController = WindowCompat.getInsetsController(window, window.decorView)
insetsController.isAppearanceLightStatusBars = false
insetsController.isAppearanceLightNavigationBars = false
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.root)) { view, insets ->
val space = insets.getInsets(WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.ime())
view.setPadding(space.left, space.top, space.right, space.bottom)
WindowInsetsCompat.CONSUMED
}
}
override fun onDestroy() {
handler.removeCallbacksAndMessages(null)
PlaybackHub.commandHandler = null