diff --git a/app/src/main/java/org/oxycblt/auxio/MainActivity.kt b/app/src/main/java/org/oxycblt/auxio/MainActivity.kt index 93aa8fa73..85f53e261 100644 --- a/app/src/main/java/org/oxycblt/auxio/MainActivity.kt +++ b/app/src/main/java/org/oxycblt/auxio/MainActivity.kt @@ -36,7 +36,7 @@ class MainActivity : AppCompatActivity() { setTheme(newAccent.theme) if (isEdgeOn()) { - doEdgeToEdgeSetup(binding) + setupEdgeToEdge(binding) } } @@ -70,7 +70,7 @@ class MainActivity : AppCompatActivity() { } } - private fun doEdgeToEdgeSetup(binding: ActivityMainBinding) { + private fun setupEdgeToEdge(binding: ActivityMainBinding) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // Do modern edge to edge, which happens to be around twice the size of the // old way of doing things. Thanks android, very cool! diff --git a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt index 9c35a026d..8f5ff0101 100644 --- a/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt +++ b/app/src/main/java/org/oxycblt/auxio/music/MusicUtils.kt @@ -53,7 +53,8 @@ private val ID3_GENRES = arrayOf( /** * Convert legacy int-based ID3 genres to their human-readable genre - * @return The named genre for this legacy genre, null if there is no need to parse it or if the genre is invalid. + * @return The named genre for this legacy genre, null if there is no need to parse it + * or if the genre is invalid. */ fun String.getGenreNameCompat(): String? { if (isDigitsOnly()) { diff --git a/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueFragment.kt b/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueFragment.kt index 39957f50c..981ca021f 100644 --- a/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/playback/queue/QueueFragment.kt @@ -43,28 +43,8 @@ class QueueFragment : Fragment() { // --- UI SETUP --- - binding.queueToolbar.apply { - setNavigationOnClickListener { - findNavController().navigateUp() - } - - if (!requireActivity().isIrregularLandscape() && isEdgeOn()) { - setOnApplyWindowInsetsListener { _, insets -> - val top = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - insets.getInsets(WindowInsets.Type.systemBars()).top - } else { - @Suppress("DEPRECATION") - insets.systemWindowInsetTop - } - - (parent as View).updatePadding(top = top) - - insets - } - } else { - // Dont even bother w/edge-to-edge if the navigation bar is on the side - binding.root.fitsSystemWindows = true - } + binding.queueToolbar.setNavigationOnClickListener { + findNavController().navigateUp() } binding.queueRecycler.apply { @@ -73,6 +53,8 @@ class QueueFragment : Fragment() { helper.attachToRecyclerView(this) } + setupEdgeForQueue(binding) + // --- VIEWMODEL SETUP ---- playbackModel.userQueue.observe(viewLifecycleOwner) { userQueue -> @@ -104,6 +86,46 @@ class QueueFragment : Fragment() { return binding.root } + private fun setupEdgeForQueue(binding: FragmentQueueBinding) { + if (isEdgeOn() && !requireActivity().isIrregularLandscape()) { + binding.queueToolbar.setOnApplyWindowInsetsListener { v, insets -> + val top = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + insets.getInsets(WindowInsets.Type.systemBars()).top + } else { + @Suppress("DEPRECATION") + insets.systemWindowInsetTop + } + + (v.parent as View).updatePadding(top = top) + + insets + } + + binding.queueRecycler.setOnApplyWindowInsetsListener { v, insets -> + val bottom = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + insets.getInsets(WindowInsets.Type.systemBars()).bottom + } else { + @Suppress("DEPRECATION") + insets.systemWindowInsetBottom + } + + // Apply bottom padding to make sure that the last queue item isnt incorrectly lost, + // but also make sure that the added padding wont clip the child views entirely. + (v as ViewGroup).apply { + clipToPadding = false + updatePadding(bottom = bottom) + } + + insets + } + } else { + // Don't even bother if we are in phone landscape or if edge-to-edge is off. + binding.root.fitsSystemWindows = true + } + } + + // --- QUEUE DATA --- + /** * Create the queue data that should be displayed * @return The list of headers/songs that should be displayed. diff --git a/app/src/main/java/org/oxycblt/auxio/settings/SettingsListFragment.kt b/app/src/main/java/org/oxycblt/auxio/settings/SettingsListFragment.kt index 9ced9bd8c..118f7b0ef 100644 --- a/app/src/main/java/org/oxycblt/auxio/settings/SettingsListFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/settings/SettingsListFragment.kt @@ -48,14 +48,14 @@ class SettingsListFragment : PreferenceFragmentCompat() { /** * Recursively call [handlePreference] on a preference. */ - private fun recursivelyHandleChildren(pref: Preference) { - if (pref is PreferenceCategory) { + private fun recursivelyHandleChildren(preference: Preference) { + if (preference is PreferenceCategory) { // If this preference is a category of its own, handle its own children - pref.children.forEach { pref -> + preference.children.forEach { pref -> recursivelyHandleChildren(pref) } } else { - handlePreference(pref) + handlePreference(preference) } } diff --git a/info/ARCHITECTURE.md b/info/ARCHITECTURE.md index b052ae362..4b7a1f6ac 100644 --- a/info/ARCHITECTURE.md +++ b/info/ARCHITECTURE.md @@ -42,7 +42,6 @@ org.oxycblt.auxio # Main UI's and logging utilities ├──.library # Library UI ├──.loading # Loading UI ├──.music # Music storage and loading -│ └──.processing # Systems for music loading and organization ├──.playback # Playback UI and systems │ ├──.queue # Queue user interface │ ├──.state # Backend/Modes for the playback state