storage: demo: Adjust for edge to edge support

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta 2024-10-13 16:31:05 +05:30
parent bfdb297ca4
commit d86ecd303d

View file

@ -8,6 +8,11 @@ package de.grobox.storagebackuptester
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat.setOnApplyWindowInsetsListener
import androidx.core.view.WindowCompat.setDecorFitsSystemWindows
import androidx.core.view.WindowInsetsCompat.CONSUMED
import androidx.core.view.WindowInsetsCompat.Type.displayCutout
import androidx.core.view.WindowInsetsCompat.Type.systemBars
import de.grobox.storagebackuptester.crypto.KeyManager import de.grobox.storagebackuptester.crypto.KeyManager
class MainActivity : AppCompatActivity() { class MainActivity : AppCompatActivity() {
@ -16,6 +21,13 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
setDecorFitsSystemWindows(window, false)
setOnApplyWindowInsetsListener(window.decorView.rootView) { v, windowInsets ->
val insets = windowInsets.getInsets(systemBars() or displayCutout())
v.setPadding(insets.left, insets.top, insets.right, insets.bottom)
CONSUMED
}
if (savedInstanceState == null) { if (savedInstanceState == null) {
supportFragmentManager.beginTransaction() supportFragmentManager.beginTransaction()
.replace(R.id.container, LogFragment.newInstance()) .replace(R.id.container, LogFragment.newInstance())