mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor LibraryCategoryAdapter scroll text logic
This commit is contained in:
parent
238b21c2e2
commit
17138d2b68
1 changed files with 4 additions and 22 deletions
|
@ -200,21 +200,13 @@ class LibraryCategoryAdapter(val controller: LibraryController?) :
|
||||||
val id = item.manga.id ?: return ""
|
val id = item.manga.id ?: return ""
|
||||||
val history = db.getChapters(id).executeAsBlocking()
|
val history = db.getChapters(id).executeAsBlocking()
|
||||||
val last = history.maxOfOrNull { it.date_fetch }
|
val last = history.maxOfOrNull { it.date_fetch }
|
||||||
if (last != null && last > 100) {
|
context.timeSpanFromNow(R.string.fetched_, last ?: 0)
|
||||||
context.timeSpanFromNow(R.string.fetched_, last)
|
|
||||||
} else {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LibrarySort.LastRead -> {
|
LibrarySort.LastRead -> {
|
||||||
val id = item.manga.id ?: return ""
|
val id = item.manga.id ?: return ""
|
||||||
val history = db.getHistoryByMangaId(id).executeAsBlocking()
|
val history = db.getHistoryByMangaId(id).executeAsBlocking()
|
||||||
val last = history.maxOfOrNull { it.last_read }
|
val last = history.maxOfOrNull { it.last_read }
|
||||||
if (last != null && last > 100) {
|
context.timeSpanFromNow(R.string.read_, last ?: 0)
|
||||||
context.timeSpanFromNow(R.string.read_, last)
|
|
||||||
} else {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LibrarySort.Unread -> {
|
LibrarySort.Unread -> {
|
||||||
val unread = item.manga.unread
|
val unread = item.manga.unread
|
||||||
|
@ -233,20 +225,10 @@ class LibraryCategoryAdapter(val controller: LibraryController?) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LibrarySort.LatestChapter -> {
|
LibrarySort.LatestChapter -> {
|
||||||
val lastUpdate = item.manga.last_update
|
context.timeSpanFromNow(R.string.updated_, item.manga.last_update)
|
||||||
if (lastUpdate > 0) {
|
|
||||||
context.timeSpanFromNow(R.string.updated_, lastUpdate)
|
|
||||||
} else {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LibrarySort.DateAdded -> {
|
LibrarySort.DateAdded -> {
|
||||||
val added = item.manga.date_added
|
context.timeSpanFromNow(R.string.added_, item.manga.date_added)
|
||||||
if (added > 0) {
|
|
||||||
context.timeSpanFromNow(R.string.added_, added)
|
|
||||||
} else {
|
|
||||||
"N/A"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LibrarySort.Title -> {
|
LibrarySort.Title -> {
|
||||||
val title = if (preferences.removeArticles().get()) {
|
val title = if (preferences.removeArticles().get()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue