diff --git a/app/src/main/java/com/stevesoltys/seedvault/extensions/Activity.kt b/app/src/main/java/com/stevesoltys/seedvault/extensions/Activity.kt new file mode 100644 index 00000000..f3ea7ea5 --- /dev/null +++ b/app/src/main/java/com/stevesoltys/seedvault/extensions/Activity.kt @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: 2024 The Calyx Institute + * SPDX-License-Identifier: Apache-2.0 + */ + +package com.stevesoltys.seedvault.extensions + +import android.app.Activity +import androidx.core.view.ViewCompat +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsCompat + +fun Activity.setupEdgeToEdge() { + val rootView = window.decorView.rootView + WindowCompat.setDecorFitsSystemWindows(window, false) + ViewCompat.setOnApplyWindowInsetsListener(rootView) { v, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.setPadding(insets.left, insets.top, insets.right, insets.bottom) + WindowInsetsCompat.CONSUMED + } +} diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt index 72114e87..29e48148 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/BackupActivity.kt @@ -5,14 +5,21 @@ package com.stevesoltys.seedvault.ui +import android.os.Bundle import android.view.MenuItem import androidx.annotation.CallSuper import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.Fragment import com.stevesoltys.seedvault.R +import com.stevesoltys.seedvault.extensions.setupEdgeToEdge abstract class BackupActivity : AppCompatActivity() { + override fun onCreate(savedInstanceState: Bundle?) { + setupEdgeToEdge() + super.onCreate(savedInstanceState) + } + @CallSuper override fun onOptionsItemSelected(item: MenuItem): Boolean = when (item.itemId) { android.R.id.home -> { diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/PermissionGrantActivity.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/PermissionGrantActivity.kt index e1a11d88..f19f7101 100644 --- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/PermissionGrantActivity.kt +++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/PermissionGrantActivity.kt @@ -8,10 +8,12 @@ package com.stevesoltys.seedvault.ui.storage import android.content.Intent.FLAG_GRANT_PREFIX_URI_PERMISSION import android.os.Bundle import androidx.appcompat.app.AppCompatActivity +import com.stevesoltys.seedvault.extensions.setupEdgeToEdge class PermissionGrantActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { + setupEdgeToEdge() super.onCreate(savedInstanceState) if (intent?.data != null) {