ui: fix app theme

Make the app theme (Shows before activity startup) the blue theme
instead of the default material purple.
This commit is contained in:
OxygenCobalt
2022-07-15 12:13:47 -06:00
parent adc4055b2c
commit 4d283bc91d
15 changed files with 55 additions and 52 deletions
@@ -293,8 +293,8 @@ data class Genre(override val rawName: String?, override val songs: List<Song>)
* An ISO-8601/RFC 3339 Date.
*
* Unlike a typical Date within the standard library, this class just represents the ID3v2/Vorbis
* date format, which is largely assumed to be a subset of ISO-8601. No validation outside of
* format validation is done.
* date format, which is largely assumed to be a subset of ISO-8601. No validation outside of format
* validation is done.
*
* The reasoning behind Date is that Auxio cannot trust any kind of metadata date to actually make
* sense in a calendar, due to bad tagging, locale-specific issues, or simply from the limited
@@ -345,7 +345,6 @@ class Date private constructor(private val tokens: List<Int>) : Comparable<Date>
private val second: Int?
get() = tokens.getOrNull(5)
override fun hashCode() = tokens.hashCode()
override fun equals(other: Any?) = other is Date && tokens == other.tokens
@@ -318,9 +318,9 @@ abstract class MediaStoreBackend : Indexer.Backend {
}
/**
* Represents a song as it is represented by MediaStore. This is progressively mutated over
* several steps of the music loading process until it is complete enough to be transformed into
* an immutable song.
* Represents a song as it is represented by MediaStore. This is progressively mutated in the
* chain of Backend instances until it is complete enough to be transformed into an immutable
* song.
*/
data class Audio(
var id: Long? = null,
@@ -348,8 +348,7 @@ abstract class MediaStoreBackend : Indexer.Backend {
fun toSong() =
Song(
// Assert that the fields that should always exist are present. I can't confirm
// that
// every device provides these fields, but it seems likely that they do.
// that every device provides these fields, but it seems likely that they do.
rawName = requireNotNull(title) { "Malformed audio: No title" },
rawSortName = sortTitle,
path =
@@ -137,7 +137,9 @@ class SearchViewModel(application: Application) :
search(lastQuery)
}
/** Searches the song list by the normalized name, then the sort name, and then the file name. */
/**
* Searches the song list by the normalized name, then the sort name, and then the file name.
*/
private fun List<Song>.filterSongsBy(value: String) =
baseFilterBy(value) { it.path.name.contains(value) }.ifEmpty { null }
@@ -145,17 +147,17 @@ class SearchViewModel(application: Application) :
private fun <T : MusicParent> List<T>.filterParentsBy(value: String) =
baseFilterBy(value) { false }.ifEmpty { null }
private inline fun <T : Music> List<T>.baseFilterBy(
value: String,
additional: (T) -> Boolean
) = filter {
// The basic comparison is first by the *normalized* name, as that allows a non-unicode
// search to match with some unicode characters. If that fails, we if there is a sort name
// we can leverage, as those are often used to make non-unicode variants of unicode titles.
it.resolveNameNormalized(application).contains(value, ignoreCase = true) ||
it.rawSortName?.contains(value, ignoreCase = true) == true ||
additional(it)
}
private inline fun <T : Music> List<T>.baseFilterBy(value: String, additional: (T) -> Boolean) =
filter {
// The basic comparison is first by the *normalized* name, as that allows a non-unicode
// search to match with some unicode characters. If that fails, we if there is a sort
// name
// we can leverage, as those are often used to make non-unicode variants of unicode
// titles.
it.resolveNameNormalized(application).contains(value, ignoreCase = true) ||
it.rawSortName?.contains(value, ignoreCase = true) == true ||
additional(it)
}
private fun Music.resolveNameNormalized(context: Context): String {
// This method normalizes strings so that songs with accented characters will show