Revert "app: remove custom edge to edge setup"

This reverts commit f134d3e11b.
This commit is contained in:
Alexander Capehart
2025-01-15 11:44:18 -07:00
parent b0b55b5069
commit ad2ec5a655
8 changed files with 76 additions and 4 deletions
@@ -20,7 +20,7 @@ package org.oxycblt.auxio
import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import android.view.View
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
@@ -53,12 +53,12 @@ class MainActivity : AppCompatActivity() {
@Inject lateinit var uiSettings: UISettings
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setupTheme()
// Inflate the views after setting up the theme so that the theme attributes are applied.
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
setupEdgeToEdge(binding.root)
L.d("Activity created")
}
@@ -95,6 +95,17 @@ class MainActivity : AppCompatActivity() {
}
}
private fun setupEdgeToEdge(contentView: View) {
WindowCompat.setDecorFitsSystemWindows(window, false)
contentView.setOnApplyWindowInsetsListener { view, insets ->
// Automatically inset the view to the left/right, as component support for
// these insets are highly lacking.
val bars = insets.systemBarInsetsCompat
view.updatePadding(left = bars.left, right = bars.right)
insets
}
}
/**
* Transform an [Intent] given to [MainActivity] into a [DeferredPlayback] that can be used in
* the playback system.