From b6ae4e2b41a6f2066290bc5d94ac444ef064c831 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Thu, 12 May 2022 13:14:35 +0300 Subject: [PATCH] Fix empty chapters placeholder --- .../org/koitharu/kotatsu/details/ui/DetailsViewModel.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt index ec8c4f83f..382899c3a 100644 --- a/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt @@ -1,7 +1,6 @@ package org.koitharu.kotatsu.details.ui import androidx.lifecycle.* -import java.io.IOException import kotlinx.coroutines.* import kotlinx.coroutines.flow.* import org.koitharu.kotatsu.R @@ -24,6 +23,7 @@ import org.koitharu.kotatsu.tracker.domain.TrackingRepository import org.koitharu.kotatsu.utils.SingleLiveEvent import org.koitharu.kotatsu.utils.ext.asLiveDataDistinct import org.koitharu.kotatsu.utils.ext.printStackTraceDebug +import java.io.IOException class DetailsViewModel( intent: MangaIntent, @@ -87,8 +87,8 @@ class DetailsViewModel( branches.indexOf(selected) }.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default) - val isChaptersEmpty = delegate.manga.map { m -> - m?.chapters?.isEmpty() == true + val isChaptersEmpty: LiveData = delegate.manga.map { m -> + m != null && m.chapters.isNullOrEmpty() }.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default, false) val chapters = combine(