all: misc cleanup

Miscellanious cleanup in preparation for 3.0.1.
This commit is contained in:
Alexander Capehart 2023-01-03 18:45:12 -07:00
parent d8e24c4c47
commit 360dab928c
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
9 changed files with 20 additions and 17 deletions

View file

@ -17,6 +17,10 @@
#### What's Fixed #### What's Fixed
- Fixed mangled multi-value ID3v2 tags when UTF-16 is used - Fixed mangled multi-value ID3v2 tags when UTF-16 is used
- Fixed crash when playing certain MP3 files - Fixed crash when playing certain MP3 files
- Detail UI will no longer crash if the music library is unavailable
#### Dev/Meta
- Add CI workflow
## 3.0.0 ## 3.0.0

View file

@ -21,5 +21,5 @@
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
# Obsfucation is what proprietary software does to keep the user unaware of it's abuses. # Obsfucation is what proprietary software does to keep the user unaware of it's abuses.
# Also it's easier to debug if the class names remain unmangled. # Also it's easier to fix issues if the stack trace symbols remain unmangled.
-dontobfuscate -dontobfuscate

View file

@ -173,8 +173,8 @@ class DetailViewModel(application: Application) :
} }
/** /**
* Set a new [currentSong] from it's [Music.UID]. If the [Music.UID] differs, a new loading * Set a new [currentSong] from it's [Music.UID]. If the [Music.UID] differs, [currentSong]
* process will begin and the newly-loaded [DetailSong] will be set to [currentSong]. * and [songProperties] will be updated to align with the new [Song].
* @param uid The UID of the [Song] to load. Must be valid. * @param uid The UID of the [Song] to load. Must be valid.
*/ */
fun setSongUid(uid: Music.UID) { fun setSongUid(uid: Music.UID) {
@ -231,7 +231,8 @@ class DetailViewModel(application: Application) :
private fun <T : Music> requireMusic(uid: Music.UID) = musicStore.library?.find<T>(uid) private fun <T : Music> requireMusic(uid: Music.UID) = musicStore.library?.find<T>(uid)
/** /**
* Start a new job to load a [DetailSong] based on the properties of the given [Song]'s file. * Start a new job to load a given [Song]'s [SongProperties]. Result is pushed to
* [songProperties].
* @param song The song to load. * @param song The song to load.
*/ */
private fun loadProperties(song: Song) { private fun loadProperties(song: Song) {

View file

@ -140,9 +140,12 @@ class Date private constructor(private val tokens: List<Int>) : Comparable<Date>
min.resolveDate(context) min.resolveDate(context)
} }
override fun compareTo(other: Range): Int { override fun equals(other: Any?) =
return min.compareTo(other.min) other is Range && min == other.min && max == other.max
}
override fun hashCode() = 31 * max.hashCode() + min.hashCode()
override fun compareTo(other: Range) = min.compareTo(other.min)
companion object { companion object {
/** /**

View file

@ -416,7 +416,6 @@ class Indexer private constructor() {
/** /**
* Music loading has completed. * Music loading has completed.
* @param result The outcome of the music loading process. * @param result The outcome of the music loading process.
* @see Response
*/ */
data class Complete(val result: Result<MusicStore.Library>) : State() data class Complete(val result: Result<MusicStore.Library>) : State()
} }

View file

@ -72,6 +72,7 @@ class PlaybackStateManager private constructor() {
val queue val queue
get() = _queue get() = _queue
/** The position of the currently playing item in the queue. */ /** The position of the currently playing item in the queue. */
@Volatile
var index = -1 var index = -1
private set private set
/** The current [InternalPlayer] state. */ /** The current [InternalPlayer] state. */
@ -525,10 +526,9 @@ class PlaybackStateManager private constructor() {
* @param database The [PlaybackStateDatabase] to clear te state from * @param database The [PlaybackStateDatabase] to clear te state from
* @return If the state was cleared, false otherwise. * @return If the state was cleared, false otherwise.
*/ */
suspend fun wipeState(database: PlaybackStateDatabase): Boolean { suspend fun wipeState(database: PlaybackStateDatabase) =
try {
logD("Wiping state") logD("Wiping state")
return try {
withContext(Dispatchers.IO) { database.write(null) } withContext(Dispatchers.IO) { database.write(null) }
true true
} catch (e: Exception) { } catch (e: Exception) {
@ -536,7 +536,6 @@ class PlaybackStateManager private constructor() {
logE(e.stackTraceToString()) logE(e.stackTraceToString())
false false
} }
}
/** /**
* Update the playback state to align with a new [MusicStore.Library]. * Update the playback state to align with a new [MusicStore.Library].

View file

@ -128,12 +128,10 @@
<string name="fmt_lib_song_count">Canciones cargadas: %d</string> <string name="fmt_lib_song_count">Canciones cargadas: %d</string>
<plurals name="fmt_song_count"> <plurals name="fmt_song_count">
<item quantity="one">%d canción</item> <item quantity="one">%d canción</item>
<item quantity="many">%d canciones</item>
<item quantity="other">%d canciones</item> <item quantity="other">%d canciones</item>
</plurals> </plurals>
<plurals name="fmt_album_count"> <plurals name="fmt_album_count">
<item quantity="one">%d álbum</item> <item quantity="one">%d álbum</item>
<item quantity="many">%d álbumes</item>
<item quantity="other">%d álbumes</item> <item quantity="other">%d álbumes</item>
</plurals> </plurals>
<string name="lbl_size">Tamaño</string> <string name="lbl_size">Tamaño</string>

View file

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources></resources> <resources />

View file

@ -245,7 +245,6 @@
<string name="lbl_mix">Mix</string> <string name="lbl_mix">Mix</string>
<plurals name="fmt_artist_count"> <plurals name="fmt_artist_count">
<item quantity="one">%d artista</item> <item quantity="one">%d artista</item>
<item quantity="many">%d artistas</item>
<item quantity="other">%d artistas</item> <item quantity="other">%d artistas</item>
</plurals> </plurals>
<string name="set_rescan">Re-escanear músicas</string> <string name="set_rescan">Re-escanear músicas</string>