Improve loading display of namespace tags
This commit is contained in:
parent
af4979fcba
commit
42d8b97f9b
@ -397,7 +397,7 @@ class MangaInfoHeaderAdapter(
|
|||||||
// SY -->
|
// SY -->
|
||||||
// if (source?.getMainSource<NamespaceSource>() != null) {
|
// if (source?.getMainSource<NamespaceSource>() != null) {
|
||||||
setChipsWithNamespace(
|
setChipsWithNamespace(
|
||||||
manga.genre,
|
manga.getGenres(),
|
||||||
meta
|
meta
|
||||||
)
|
)
|
||||||
// binding.mangaGenresTagsFullChips.isVisible = false
|
// binding.mangaGenresTagsFullChips.isVisible = false
|
||||||
@ -483,7 +483,7 @@ class MangaInfoHeaderAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setChipsWithNamespace(genre: String?, meta: RaisedSearchMetadata?) {
|
private fun setChipsWithNamespace(genre: List<String>?, meta: RaisedSearchMetadata?) {
|
||||||
val namespaceTags = when {
|
val namespaceTags = when {
|
||||||
meta != null -> {
|
meta != null -> {
|
||||||
meta.tags
|
meta.tags
|
||||||
@ -499,7 +499,24 @@ class MangaInfoHeaderAdapter(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
genre != null -> {
|
genre != null -> {
|
||||||
listOf(NamespaceTagsItem(null, genre.split(",").map { it.trim() to null }))
|
if (genre.all { it.contains(':') }) {
|
||||||
|
genre
|
||||||
|
.map { tag ->
|
||||||
|
val index = tag.indexOf(':')
|
||||||
|
tag.substring(0, index).trim() to tag.substring(index + 1).trim()
|
||||||
|
}
|
||||||
|
.groupBy {
|
||||||
|
it.first
|
||||||
|
}
|
||||||
|
.mapValues { group ->
|
||||||
|
group.value.map { it.second to 0 }
|
||||||
|
}
|
||||||
|
.map { (namespace, tags) ->
|
||||||
|
NamespaceTagsItem(namespace, tags)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
listOf(NamespaceTagsItem(null, genre.map { it to null }))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else -> emptyList()
|
else -> emptyList()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user