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)
|
||||
|
||||
12
app/src/main/res/drawable/ic_chip_user.xml
Normal file
12
app/src/main/res/drawable/ic_chip_user.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="12dp"
|
||||
android:height="12dp"
|
||||
android:tint="?android:textColorPrimary"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000"
|
||||
android:pathData="M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z" />
|
||||
</vector>
|
||||
Reference in New Issue
Block a user