diff --git a/app/src/main/java/emu/skyline/MainActivity.kt b/app/src/main/java/emu/skyline/MainActivity.kt index b45551c9..37472d47 100644 --- a/app/src/main/java/emu/skyline/MainActivity.kt +++ b/app/src/main/java/emu/skyline/MainActivity.kt @@ -18,8 +18,7 @@ import androidx.appcompat.app.AppCompatDelegate import androidx.core.content.ContextCompat import androidx.core.content.res.use import androidx.core.graphics.drawable.toBitmap -import androidx.core.view.isInvisible -import androidx.core.view.isVisible +import androidx.core.view.* import androidx.documentfile.provider.DocumentFile import androidx.preference.PreferenceManager import androidx.recyclerview.widget.GridLayoutManager @@ -100,6 +99,13 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(binding.root) + WindowCompat.setDecorFitsSystemWindows(window, false) + // Apply inset padding to the app list recycler view to avoid navigation bar overlap + ViewCompat.setOnApplyWindowInsetsListener(binding.appList) { view, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.updatePadding(bottom = insets.bottom) + WindowInsetsCompat.CONSUMED + } PreferenceManager.setDefaultValues(this, R.xml.preferences, false) diff --git a/app/src/main/java/emu/skyline/SettingsActivity.kt b/app/src/main/java/emu/skyline/SettingsActivity.kt index e074391f..525e615d 100644 --- a/app/src/main/java/emu/skyline/SettingsActivity.kt +++ b/app/src/main/java/emu/skyline/SettingsActivity.kt @@ -6,10 +6,10 @@ package emu.skyline import android.os.Bundle -import android.view.KeyEvent -import android.view.ViewTreeObserver +import android.view.* import androidx.appcompat.app.AppCompatActivity import androidx.coordinatorlayout.widget.CoordinatorLayout +import androidx.core.view.* import androidx.preference.CheckBoxPreference import androidx.preference.Preference import androidx.preference.PreferenceCategory @@ -32,6 +32,7 @@ class SettingsActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(binding.root) + WindowCompat.setDecorFitsSystemWindows(window, false) setSupportActionBar(binding.titlebar.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) @@ -79,6 +80,18 @@ class SettingsActivity : AppCompatActivity() { private const val DIALOG_FRAGMENT_TAG = "androidx.preference.PreferenceFragment.DIALOG" } + override fun onViewCreated(view : View, savedInstanceState : Bundle?) { + val recyclerView = view.findViewById(R.id.recycler_view) + // Apply inset padding to the settings recycler view to avoid navigation bar overlap + ViewCompat.setOnApplyWindowInsetsListener(recyclerView) { v, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + v.updatePadding(bottom = insets.bottom) + WindowInsetsCompat.CONSUMED + } + + super.onViewCreated(view, savedInstanceState) + } + /** * This constructs the preferences from [R.xml.preferences] */ diff --git a/app/src/main/java/emu/skyline/input/ControllerActivity.kt b/app/src/main/java/emu/skyline/input/ControllerActivity.kt index 70ab150f..ad24f9ff 100644 --- a/app/src/main/java/emu/skyline/input/ControllerActivity.kt +++ b/app/src/main/java/emu/skyline/input/ControllerActivity.kt @@ -11,9 +11,8 @@ import android.os.Bundle import android.view.KeyEvent import android.view.ViewTreeObserver import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.app.AppCompatDialogFragment import androidx.coordinatorlayout.widget.CoordinatorLayout -import androidx.core.view.marginTop +import androidx.core.view.* import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -173,6 +172,13 @@ class ControllerActivity : AppCompatActivity() { title = "${getString(R.string.config_controller)} #${id + 1}" setContentView(binding.root) + WindowCompat.setDecorFitsSystemWindows(window, false) + // Apply inset padding to the controller list recycler view to avoid navigation bar overlap + ViewCompat.setOnApplyWindowInsetsListener(binding.controllerList) { view, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.updatePadding(bottom = insets.bottom) + WindowInsetsCompat.CONSUMED + } setSupportActionBar(binding.titlebar.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true) diff --git a/app/src/main/java/emu/skyline/preference/GpuDriverActivity.kt b/app/src/main/java/emu/skyline/preference/GpuDriverActivity.kt index 41536bfa..48944b22 100644 --- a/app/src/main/java/emu/skyline/preference/GpuDriverActivity.kt +++ b/app/src/main/java/emu/skyline/preference/GpuDriverActivity.kt @@ -12,6 +12,10 @@ import android.view.ViewTreeObserver import androidx.activity.result.contract.ActivityResultContracts import androidx.appcompat.app.AppCompatActivity import androidx.coordinatorlayout.widget.CoordinatorLayout +import androidx.core.view.ViewCompat +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsCompat +import androidx.core.view.updatePadding import androidx.recyclerview.widget.LinearLayoutManager import androidx.viewbinding.ViewBinding import com.google.android.material.snackbar.Snackbar @@ -122,6 +126,13 @@ class GpuDriverActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(binding.root) + WindowCompat.setDecorFitsSystemWindows(window, false) + // Apply inset padding to the driver list recycler view to avoid navigation bar overlap + ViewCompat.setOnApplyWindowInsetsListener(binding.driverList) { view, windowInsets -> + val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()) + view.updatePadding(bottom = insets.bottom) + WindowInsetsCompat.CONSUMED + } setSupportActionBar(binding.titlebar.toolbar) supportActionBar?.setDisplayHomeAsUpEnabled(true)