From d86ecd303dfedac1b7c8c80ca37b316368274434 Mon Sep 17 00:00:00 2001 From: Aayush Gupta Date: Sun, 13 Oct 2024 16:31:05 +0530 Subject: [PATCH] storage: demo: Adjust for edge to edge support Signed-off-by: Aayush Gupta --- .../de/grobox/storagebackuptester/MainActivity.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/storage/demo/src/main/java/de/grobox/storagebackuptester/MainActivity.kt b/storage/demo/src/main/java/de/grobox/storagebackuptester/MainActivity.kt index 3b9347db..5046d2a1 100644 --- a/storage/demo/src/main/java/de/grobox/storagebackuptester/MainActivity.kt +++ b/storage/demo/src/main/java/de/grobox/storagebackuptester/MainActivity.kt @@ -8,6 +8,11 @@ package de.grobox.storagebackuptester import android.os.Bundle import android.util.Log 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 class MainActivity : AppCompatActivity() { @@ -16,6 +21,13 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) 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) { supportFragmentManager.beginTransaction() .replace(R.id.container, LogFragment.newInstance())