mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-13 06:07:31 +01:00
Handle null Anilist start dates (fixes #4685)
This commit is contained in:
parent
78285bdf37
commit
99ba84c810
2 changed files with 15 additions and 18 deletions
|
@ -246,12 +246,9 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
||||||
val date = try {
|
val date = try {
|
||||||
val date = Calendar.getInstance()
|
val date = Calendar.getInstance()
|
||||||
date.set(
|
date.set(
|
||||||
struct["startDate"]!!.jsonObject["year"]!!.jsonPrimitive.intOrNull ?: 0,
|
struct["startDate"]!!.jsonObject["year"]!!.jsonPrimitive.int,
|
||||||
(
|
struct["startDate"]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
|
||||||
struct["startDate"]!!.jsonObject["month"]!!.jsonPrimitive.intOrNull
|
struct["startDate"]!!.jsonObject["day"]!!.jsonPrimitive.int
|
||||||
?: 0
|
|
||||||
) - 1,
|
|
||||||
struct["startDate"]!!.jsonObject["day"]!!.jsonPrimitive.intOrNull ?: 0
|
|
||||||
)
|
)
|
||||||
date.timeInMillis
|
date.timeInMillis
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
|
|
|
@ -55,24 +55,24 @@ class TrackSearchAdapter(context: Context) :
|
||||||
.into(binding.trackSearchCover)
|
.into(binding.trackSearchCover)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track.publishing_status.isBlank()) {
|
val hasStatus = track.publishing_status.isNotBlank()
|
||||||
binding.trackSearchStatus.isVisible = false
|
binding.trackSearchStatus.isVisible = hasStatus
|
||||||
binding.trackSearchStatusResult.isVisible = false
|
binding.trackSearchStatusResult.isVisible = hasStatus
|
||||||
} else {
|
if (hasStatus) {
|
||||||
binding.trackSearchStatusResult.text = track.publishing_status.capitalize()
|
binding.trackSearchStatusResult.text = track.publishing_status.capitalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track.publishing_type.isBlank()) {
|
val hasType = track.publishing_type.isNotBlank()
|
||||||
binding.trackSearchType.isVisible = false
|
binding.trackSearchType.isVisible = hasType
|
||||||
binding.trackSearchTypeResult.isVisible = false
|
binding.trackSearchTypeResult.isVisible = hasType
|
||||||
} else {
|
if (hasType) {
|
||||||
binding.trackSearchTypeResult.text = track.publishing_type.capitalize()
|
binding.trackSearchTypeResult.text = track.publishing_type.capitalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track.start_date.isBlank()) {
|
val hasStartDate = track.start_date.isNotBlank()
|
||||||
binding.trackSearchStart.isVisible = false
|
binding.trackSearchStart.isVisible = hasStartDate
|
||||||
binding.trackSearchStartResult.isVisible = false
|
binding.trackSearchStartResult.isVisible = hasStartDate
|
||||||
} else {
|
if (hasStartDate) {
|
||||||
binding.trackSearchStartResult.text = track.start_date
|
binding.trackSearchStartResult.text = track.start_date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue