Clean up LibraryItem (#9072)

* Move LibraryItem vars to constructor vals

* Convert LibraryItem to data class

Remove redundant equals and hashCode

* Remove unused LibraryItem.displayMode

* Simplify LibraryItem.matches()

* Align types in LibraryItem and LibraryBadges

* fixup! Simplify LibraryItem.matches()
This commit is contained in:
Two-Ai
2023-02-12 15:25:27 -05:00
committed by GitHub
parent f6e6a7ddf1
commit 7b118eba22
6 changed files with 37 additions and 78 deletions

View File

@@ -7,7 +7,7 @@ import eu.kanade.presentation.components.Badge
import eu.kanade.tachiyomi.R
@Composable
fun DownloadsBadge(count: Int) {
fun DownloadsBadge(count: Long) {
if (count > 0) {
Badge(
text = "$count",
@@ -18,7 +18,7 @@ fun DownloadsBadge(count: Int) {
}
@Composable
fun UnreadBadge(count: Int) {
fun UnreadBadge(count: Long) {
if (count > 0) {
Badge(text = "$count")
}

View File

@@ -46,8 +46,8 @@ fun LibraryComfortableGrid(
lastModified = manga.coverLastModified,
),
coverBadgeStart = {
DownloadsBadge(count = libraryItem.downloadCount.toInt())
UnreadBadge(count = libraryItem.unreadCount.toInt())
DownloadsBadge(count = libraryItem.downloadCount)
UnreadBadge(count = libraryItem.unreadCount)
},
coverBadgeEnd = {
LanguageBadge(

View File

@@ -47,8 +47,8 @@ fun LibraryCompactGrid(
lastModified = manga.coverLastModified,
),
coverBadgeStart = {
DownloadsBadge(count = libraryItem.downloadCount.toInt())
UnreadBadge(count = libraryItem.unreadCount.toInt())
DownloadsBadge(count = libraryItem.downloadCount)
UnreadBadge(count = libraryItem.unreadCount)
},
coverBadgeEnd = {
LanguageBadge(

View File

@@ -56,8 +56,8 @@ fun LibraryList(
lastModified = manga.coverLastModified,
),
badge = {
DownloadsBadge(count = libraryItem.downloadCount.toInt())
UnreadBadge(count = libraryItem.unreadCount.toInt())
DownloadsBadge(count = libraryItem.downloadCount)
UnreadBadge(count = libraryItem.unreadCount)
LanguageBadge(
isLocal = libraryItem.isLocal,
sourceLanguage = libraryItem.sourceLanguage,