Browse Source

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

housekeeping/remove-warnings
Antoine POPINEAU 4 years ago
parent
commit
e17c706ae3
No known key found for this signature in database
GPG Key ID: A78AC64694F84063
  1. 2
      app/src/main/java/com/github/apognu/otter/adapters/AlbumsAdapter.kt
  2. 2
      app/src/main/java/com/github/apognu/otter/utils/Models.kt

2
app/src/main/java/com/github/apognu/otter/adapters/AlbumsAdapter.kt

@ -43,7 +43,7 @@ class AlbumsAdapter(val context: Context?, private val listener: OnAlbumClickLis @@ -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

2
app/src/main/java/com/github/apognu/otter/utils/Models.kt

@ -71,7 +71,7 @@ data class Album( @@ -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)

Loading…
Cancel
Save