all: fix misc issues
Fix miscellanious issues that I've encountered.
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
package org.oxycblt.auxio
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
@@ -108,11 +107,7 @@ class MainActivity : AppCompatActivity() {
|
||||
private fun setupTheme() {
|
||||
val settings = Settings(this)
|
||||
|
||||
// Disable theme customization above Android 12, as it's far enough in as a version to
|
||||
// the point where most phones should have an option for light/dark theming.
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
|
||||
AppCompatDelegate.setDefaultNightMode(settings.theme)
|
||||
}
|
||||
AppCompatDelegate.setDefaultNightMode(settings.theme)
|
||||
|
||||
// The black theme has a completely separate set of styles since style attributes cannot
|
||||
// be modified at runtime.
|
||||
|
||||
@@ -34,9 +34,9 @@ import com.google.android.material.transition.MaterialFadeThrough
|
||||
import org.oxycblt.auxio.databinding.FragmentMainBinding
|
||||
import org.oxycblt.auxio.music.Music
|
||||
import org.oxycblt.auxio.music.Song
|
||||
import org.oxycblt.auxio.playback.PlaybackSheetBehavior
|
||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||
import org.oxycblt.auxio.playback.queue.QueueSheetBehavior
|
||||
import org.oxycblt.auxio.playback.PlaybackSheetBehavior
|
||||
import org.oxycblt.auxio.ui.MainNavigationAction
|
||||
import org.oxycblt.auxio.ui.NavigationViewModel
|
||||
import org.oxycblt.auxio.ui.fragment.ViewBindingFragment
|
||||
|
||||
@@ -121,15 +121,16 @@ private class ArtistDetailViewHolder private constructor(private val binding: It
|
||||
binding.context.getPlural(R.plurals.fmt_song_count, item.songs.size)
|
||||
)
|
||||
|
||||
binding.detailPlayButton.isEnabled = true
|
||||
binding.detailShuffleButton.isEnabled = true
|
||||
binding.detailPlayButton.isVisible = true
|
||||
binding.detailShuffleButton.isVisible = true
|
||||
} else {
|
||||
// The artist is a
|
||||
// The artist does not have any songs, so playback, genre info, and song counts
|
||||
// make no sense.
|
||||
binding.detailSubhead.isVisible = false
|
||||
binding.detailInfo.text =
|
||||
binding.context.getPlural(R.plurals.fmt_album_count, item.albums.size)
|
||||
binding.detailPlayButton.isEnabled = false
|
||||
binding.detailShuffleButton.isEnabled = false
|
||||
binding.detailPlayButton.isVisible = false
|
||||
binding.detailShuffleButton.isVisible = false
|
||||
}
|
||||
|
||||
binding.detailPlayButton.setOnClickListener { listener.onPlayParent() }
|
||||
|
||||
@@ -41,9 +41,9 @@ import java.io.File
|
||||
|
||||
/*
|
||||
* This file acts as the base for most the black magic required to get a remotely sensible music
|
||||
* indexing system while still optimizing for time. I would recommend you leave this file now
|
||||
* before you lose your sanity trying to understand the hoops I had to jump through for this system,
|
||||
* but if you really want to stay, here's a debrief on why this code is so awful.
|
||||
* indexing system from MediaStore while still optimizing for time. I would recommend you leave
|
||||
* this file now before you lose your sanity trying to understand the hoops I had to jump through
|
||||
* for this system, but if you really want to stay, here's a debrief on why this code is so awful.
|
||||
*
|
||||
* MediaStore is not a good API. It is not even a bad API. Calling it a bad API is an insult to
|
||||
* other bad android APIs, like CoordinatorLayout or InputMethodManager. No. MediaStore is a crime
|
||||
@@ -51,7 +51,7 @@ import java.io.File
|
||||
*
|
||||
* You think that if you wanted to query a song's genre from a media database, you could just put
|
||||
* "genre" in the query and it would return it, right? But not with MediaStore! No, that's too
|
||||
* straightforward for this contract that was dropped on it's head as a baby. So instead, you have
|
||||
* straightforward for this database that was dropped on it's head as a baby. So instead, you have
|
||||
* to query for each genre, query all the songs in each genre, and then iterate through those songs
|
||||
* to link every song with their genre. This is not documented anywhere, and the O(mom im scared)
|
||||
* algorithm you have to run to get it working single-handedly DOUBLES Auxio's query times. At no
|
||||
@@ -281,13 +281,13 @@ abstract class MediaStoreExtractor(private val context: Context, private val cac
|
||||
arrayOf(
|
||||
// These columns are guaranteed to work on all versions of android
|
||||
MediaStore.Audio.AudioColumns._ID,
|
||||
MediaStore.Audio.AudioColumns.TITLE,
|
||||
MediaStore.Audio.AudioColumns.DISPLAY_NAME,
|
||||
MediaStore.Audio.AudioColumns.MIME_TYPE,
|
||||
MediaStore.Audio.AudioColumns.SIZE,
|
||||
MediaStore.Audio.AudioColumns.DATE_ADDED,
|
||||
MediaStore.Audio.AudioColumns.DATE_MODIFIED,
|
||||
MediaStore.Audio.AudioColumns.DISPLAY_NAME,
|
||||
MediaStore.Audio.AudioColumns.SIZE,
|
||||
MediaStore.Audio.AudioColumns.DURATION,
|
||||
MediaStore.Audio.AudioColumns.MIME_TYPE,
|
||||
MediaStore.Audio.AudioColumns.TITLE,
|
||||
MediaStore.Audio.AudioColumns.YEAR,
|
||||
MediaStore.Audio.AudioColumns.ALBUM,
|
||||
MediaStore.Audio.AudioColumns.ALBUM_ID,
|
||||
|
||||
@@ -83,7 +83,7 @@ class Settings(private val context: Context, private val callback: Callback? = n
|
||||
fun Int.migratePlaybackMode() =
|
||||
when (this) {
|
||||
// Genre playback mode was retried in 3.0.0
|
||||
IntegerTable.PLAYBACK_MODE_ALL_SONGS, IntegerTable.PLAYBACK_MODE_IN_GENRE -> MusicMode.SONGS
|
||||
IntegerTable.PLAYBACK_MODE_ALL_SONGS -> MusicMode.SONGS
|
||||
IntegerTable.PLAYBACK_MODE_IN_ARTIST -> MusicMode.ARTISTS
|
||||
IntegerTable.PLAYBACK_MODE_IN_ALBUM -> MusicMode.ALBUMS
|
||||
else -> null
|
||||
@@ -147,7 +147,7 @@ class Settings(private val context: Context, private val callback: Callback? = n
|
||||
|
||||
/** The current accent. */
|
||||
var accent: Accent
|
||||
get() = Accent.from(inner.getInt(context.getString(R.string.set_accent), Accent.DEFAULT))
|
||||
get() = Accent.from(inner.getInt(context.getString(R.string.set_key_accent), Accent.DEFAULT))
|
||||
set(value) {
|
||||
inner.edit {
|
||||
putInt(context.getString(R.string.set_key_accent), value.index)
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.oxycblt.auxio.R
|
||||
import org.oxycblt.auxio.music.MusicViewModel
|
||||
import org.oxycblt.auxio.playback.PlaybackViewModel
|
||||
import org.oxycblt.auxio.settings.Settings
|
||||
import org.oxycblt.auxio.settings.SettingsFragmentDirections
|
||||
import org.oxycblt.auxio.ui.NavigationViewModel
|
||||
import org.oxycblt.auxio.util.androidActivityViewModels
|
||||
import org.oxycblt.auxio.util.isNight
|
||||
|
||||
Reference in New Issue
Block a user