fix scanlator in body of updates

This commit is contained in:
Jays2Kings 2023-03-03 20:04:49 -05:00
parent 0485a7f692
commit 982cbc42fd

View file

@ -232,18 +232,17 @@ class RecentMangaHolder(
it.findViewById<DownloadButton>(R.id.download_button)?.tag it.findViewById<DownloadButton>(R.id.download_button)?.tag
}.toList() }.toList()
if (extraIds == item.mch.extraChapters.map { it.id }) { if (extraIds == item.mch.extraChapters.map { it.id }) {
var hasSameChapter = false
item.mch.extraChapters.forEachIndexed { index, chapter -> item.mch.extraChapters.forEachIndexed { index, chapter ->
RecentSubChapterItemBinding.bind(binding.moreChaptersLayout.getChildAt(index)) val binding =
.configureView(chapter, item) RecentSubChapterItemBinding.bind(binding.moreChaptersLayout.getChildAt(index))
} binding.configureView(chapter, item)
if (isUpdates && binding.moreChaptersLayout.children.any { view -> if (isUpdates && !binding.subtitle.text.isNullOrBlank() && !hasSameChapter) {
!RecentSubChapterItemBinding.bind(view).subtitle.text.isNullOrBlank() showScanlatorInBody(moreVisible, item)
} hasSameChapter = true
) { }
showScanlatorInBody(moreVisible, item)
} else {
addMoreUpdatesText(!moreVisible, item)
} }
addMoreUpdatesText(!moreVisible, item)
} else { } else {
binding.moreChaptersLayout.removeAllViews() binding.moreChaptersLayout.removeAllViews()
var hasSameChapter = false var hasSameChapter = false
@ -255,16 +254,9 @@ class RecentMangaHolder(
true, true,
) )
binding.configureView(chapter, item) binding.configureView(chapter, item)
if (isUpdates && chapter.isRecognizedNumber && if (isUpdates && !binding.subtitle.text.isNullOrBlank() && !hasSameChapter) {
chapter.chapter_number == item.chapter.chapter_number && showScanlatorInBody(moreVisible, item)
!chapter.scanlator.isNullOrBlank() hasSameChapter = true
) {
binding.subtitle.text = chapter.scanlator
binding.subtitle.isVisible = true
if (!hasSameChapter) {
showScanlatorInBody(moreVisible, item)
hasSameChapter = true
}
} }
} }
addMoreUpdatesText(!moreVisible, item) addMoreUpdatesText(!moreVisible, item)
@ -348,6 +340,12 @@ class RecentMangaHolder(
context.timeSpanFromNow(R.string.read_, dateRead) context.timeSpanFromNow(R.string.read_, dateRead)
.takeIf { date - dateRead < TimeUnit.DAYS.toMillis(1) } .takeIf { date - dateRead < TimeUnit.DAYS.toMillis(1) }
} ?: "" } ?: ""
if (isUpdates && chapter.isRecognizedNumber &&
chapter.chapter_number == item.chapter.chapter_number &&
!chapter.scanlator.isNullOrBlank()
) {
subtitle.text = chapter.scanlator
}
subtitle.isVisible = subtitle.text.isNotBlank() subtitle.isVisible = subtitle.text.isNotBlank()
title.textSize = (if (subtitle.isVisible) 14f else 14.5f) title.textSize = (if (subtitle.isVisible) 14f else 14.5f)
root.setOnClickListener { root.setOnClickListener {