Show authors
This commit is contained in:
@@ -43,10 +43,14 @@ abstract class GroupleRepository(
|
||||
return root.select("div.tile").mapNotNull { node ->
|
||||
val imgDiv = node.selectFirst("div.img") ?: return@mapNotNull null
|
||||
val descDiv = node.selectFirst("div.desc") ?: return@mapNotNull null
|
||||
if (descDiv.getElementsByAttributeValue("data-type", "author").isNotEmpty()) {
|
||||
return@mapNotNull null //skip author
|
||||
}
|
||||
val href = imgDiv.selectFirst("a").attr("href")?.withDomain(domain)
|
||||
?: return@mapNotNull null
|
||||
val title = descDiv.selectFirst("h3")?.selectFirst("a")?.text()
|
||||
?: return@mapNotNull null
|
||||
val tileInfo = descDiv.selectFirst("div.tile-info")
|
||||
Manga(
|
||||
id = href.longHashCode(),
|
||||
url = href,
|
||||
@@ -60,9 +64,9 @@ abstract class GroupleRepository(
|
||||
?.toFloatOrNull()
|
||||
?.div(10f)
|
||||
} ?: Manga.NO_RATING,
|
||||
author = tileInfo?.selectFirst("a.person-link")?.text(),
|
||||
tags = safe {
|
||||
descDiv.selectFirst("div.tile-info")
|
||||
?.select("a.element-link")
|
||||
tileInfo?.select("a.element-link")
|
||||
?.map {
|
||||
MangaTag(
|
||||
title = it.text(),
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.koitharu.kotatsu.core.model.MangaHistory
|
||||
import org.koitharu.kotatsu.ui.common.BaseFragment
|
||||
import org.koitharu.kotatsu.ui.main.list.favourites.categories.FavouriteCategoriesDialog
|
||||
import org.koitharu.kotatsu.ui.reader.ReaderActivity
|
||||
import org.koitharu.kotatsu.utils.ext.setChips
|
||||
import org.koitharu.kotatsu.utils.ext.addChips
|
||||
import org.koitharu.kotatsu.utils.ext.textAndVisible
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@@ -41,7 +41,16 @@ class MangaDetailsFragment : BaseFragment(R.layout.fragment_details), MangaDetai
|
||||
ratingBar.progress = (ratingBar.max * manga.rating).roundToInt()
|
||||
ratingBar.isVisible = true
|
||||
}
|
||||
chips_tags.setChips(manga.tags) {
|
||||
chips_tags.removeAllViews()
|
||||
manga.author?.let { a ->
|
||||
chips_tags.addChips(listOf(a)) {
|
||||
create(
|
||||
text = it,
|
||||
iconRes = R.drawable.ic_chip_user
|
||||
)
|
||||
}
|
||||
}
|
||||
chips_tags.addChips(manga.tags) {
|
||||
create(
|
||||
text = it.title,
|
||||
iconRes = R.drawable.ic_chip_tag,
|
||||
|
||||
@@ -72,8 +72,7 @@ var TextView.textAndVisible: CharSequence?
|
||||
isGone = value.isNullOrEmpty()
|
||||
}
|
||||
|
||||
fun <T> ChipGroup.setChips(data: Iterable<T>, action: ChipsFactory.(T) -> Chip) {
|
||||
removeAllViews()
|
||||
fun <T> ChipGroup.addChips(data: Iterable<T>, action: ChipsFactory.(T) -> Chip) {
|
||||
val factory = ChipsFactory(context)
|
||||
data.forEach {
|
||||
val chip = factory.action(it)
|
||||
|
||||
Reference in New Issue
Block a user