Fix music load failure [Resolves #4]
Remove the `check` statements from `applyAlbum` and `applyGenre` that could cause the music loading to fail on some devices. Now only the first album/genre applied will stick. This resolves issue #4.
This commit is contained in:
parent
e3e0015237
commit
0a7fbeca6d
2 changed files with 7 additions and 11 deletions
|
@ -56,9 +56,7 @@ class LoadingFragment : Fragment() {
|
|||
null -> showLoading(binding)
|
||||
|
||||
// Anything else is an error
|
||||
else -> {
|
||||
showError(binding, response)
|
||||
}
|
||||
else -> showError(binding, response)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,22 +55,20 @@ data class Song(
|
|||
|
||||
/**
|
||||
* Apply a genre to a song.
|
||||
* @throws IllegalStateException When a genre is already applied.
|
||||
*/
|
||||
fun applyGenre(genre: Genre) {
|
||||
check(mGenre == null) { "Genre is already applied" }
|
||||
|
||||
mGenre = genre
|
||||
if (mGenre == null) {
|
||||
mGenre = genre
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply an album to a song.
|
||||
* @throws IllegalStateException When an album is already applied.
|
||||
*/
|
||||
fun applyAlbum(album: Album) {
|
||||
check(mAlbum == null) { "Album is already applied" }
|
||||
|
||||
mAlbum = album
|
||||
if (mAlbum == null) {
|
||||
mAlbum = album
|
||||
}
|
||||
}
|
||||
|
||||
val seconds = duration / 1000
|
||||
|
|
Loading…
Reference in a new issue