MangaSummaryView: Fix incomplete description on tablet ui (#6518)

This commit is contained in:
Ivan Iskandar 2022-01-30 22:47:53 +07:00 committed by GitHub
parent 7de707c60a
commit cf5e60f8eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -290,9 +290,9 @@ class MangaInfoHeaderAdapter(
binding.mangaCover.loadAnyAutoPause(manga)
// Manga info section
binding.mangaSummarySection.isVisible = !manga.description.isNullOrBlank() || !manga.genre.isNullOrBlank()
binding.mangaSummarySection.description = manga.description
binding.mangaSummarySection.setTags(manga.getGenres(), controller::performGenreSearch)
binding.mangaSummarySection.description = manga.description
binding.mangaSummarySection.isVisible = !manga.description.isNullOrBlank() || !manga.genre.isNullOrBlank()
}
/**

View File

@ -59,9 +59,11 @@ class MangaSummaryView @JvmOverloads constructor(
doOnNextLayout {
updateExpandState()
}
if (!isInLayout) {
requestLayout()
}
}
}
fun setTags(items: List<String>?, onClick: (item: String) -> Unit) {
listOfNotNull(binding.tagChipsShrunk, binding.tagChipsExpanded).forEach { chips ->
@ -141,7 +143,10 @@ class MangaSummaryView @JvmOverloads constructor(
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
if (!recalculateHeights) {
// Wait until parent view has determined the exact width
// because this affect the description line count
val measureWidthFreely = MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY
if (!recalculateHeights || measureWidthFreely) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
return
}