Show number of manga per source in migrate menu (#4703)
(cherry picked from commit c87b0e77de414d3a28ef1aa7e4868edd88ccfa7e) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt
This commit is contained in:
parent
4ee110e225
commit
aa376dc3a5
@ -28,9 +28,14 @@ class MigrationSourcesPresenter(
|
|||||||
|
|
||||||
private fun findSourcesWithManga(library: List<Manga>): List<SourceItem> {
|
private fun findSourcesWithManga(library: List<Manga>): List<SourceItem> {
|
||||||
val header = SelectionHeader()
|
val header = SelectionHeader()
|
||||||
return library.asSequence().map { it.source }.toSet()
|
return library
|
||||||
.mapNotNull { if (it != LocalSource.ID /* SY --> */ && it != MERGED_SOURCE_ID /* SY <-- */) sourceManager.getOrStub(it) else null }
|
.groupBy { it.source }
|
||||||
.sortedBy { it.name.toLowerCase() }
|
.filterKeys { it != LocalSource.ID /* SY --> */ && it != MERGED_SOURCE_ID /* SY <-- */ }
|
||||||
.map { SourceItem(it, header) }.toList()
|
.map {
|
||||||
|
val source = sourceManager.getOrStub(it.key)
|
||||||
|
SourceItem(source, it.value.size, header)
|
||||||
|
}
|
||||||
|
.sortedBy { it.source.name.toLowerCase() }
|
||||||
|
.toList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ class SourceHolder(view: View, val adapter: SourceAdapter) :
|
|||||||
fun bind(item: SourceItem) {
|
fun bind(item: SourceItem) {
|
||||||
val source = item.source
|
val source = item.source
|
||||||
|
|
||||||
binding.title.text = source.name
|
binding.title.text = "${source.name} (${item.mangaCount})"
|
||||||
binding.subtitle.isVisible = source.lang != ""
|
binding.subtitle.isVisible = source.lang != ""
|
||||||
binding.subtitle.text = LocaleHelper.getDisplayName(source.lang)
|
binding.subtitle.text = LocaleHelper.getDisplayName(source.lang)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.source.Source
|
|||||||
* @param source Instance of [Source] containing source information.
|
* @param source Instance of [Source] containing source information.
|
||||||
* @param header The header for this item.
|
* @param header The header for this item.
|
||||||
*/
|
*/
|
||||||
data class SourceItem(val source: Source, val header: SelectionHeader) :
|
data class SourceItem(val source: Source, val mangaCount: Int, val header: SelectionHeader) :
|
||||||
AbstractSectionableItem<SourceHolder, SelectionHeader>(header) {
|
AbstractSectionableItem<SourceHolder, SelectionHeader>(header) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user