Release date can be null, changed model and added checks.

This commit is contained in:
Antoine POPINEAU 2020-07-08 14:08:35 +02:00
parent 37f4b1da9e
commit e17c706ae3
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class AlbumsAdapter(val context: Context?, private val listener: OnAlbumClickLis
holder.artist.text = album.artist.name
holder.release_date.visibility = View.GONE
album.release_date.split('-').getOrNull(0)?.let { year ->
album.release_date?.split('-')?.getOrNull(0)?.let { year ->
if (year.isNotEmpty()) {
holder.release_date.visibility = View.VISIBLE
holder.release_date.text = year

View File

@ -71,7 +71,7 @@ data class Album(
val artist: Artist,
val title: String,
val cover: Covers,
val release_date: String
val release_date: String?
) : SearchResult {
data class Artist(val name: String)