mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 04:45:07 +01:00
Crash fixes in recents
This commit is contained in:
parent
48dae05980
commit
780585caed
@ -61,6 +61,6 @@ class RecentMangaItem(
|
|||||||
val showRemoveHistory = (adapter as? RecentMangaAdapter)?.showRemoveHistory ?: true
|
val showRemoveHistory = (adapter as? RecentMangaAdapter)?.showRemoveHistory ?: true
|
||||||
val showTitleFirst = (adapter as? RecentMangaAdapter)?.showTitleFirst ?: false
|
val showTitleFirst = (adapter as? RecentMangaAdapter)?.showTitleFirst ?: false
|
||||||
if (mch.manga.id == null) (holder as? RecentMangaFooterHolder)?.bind((header as? RecentMangaHeaderItem)?.recentsType ?: 0)
|
if (mch.manga.id == null) (holder as? RecentMangaFooterHolder)?.bind((header as? RecentMangaHeaderItem)?.recentsType ?: 0)
|
||||||
else (holder as? RecentMangaHolder)?.bind(this, showDLs, showRemoveHistory, showTitleFirst)
|
else if (chapter.id != null) (holder as? RecentMangaHolder)?.bind(this, showDLs, showRemoveHistory, showTitleFirst)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ class RecentsPresenter(
|
|||||||
|
|
||||||
private var scope = CoroutineScope(Job() + Dispatchers.Default)
|
private var scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
|
|
||||||
|
private var recentsJob: Job? = null
|
||||||
var recentItems = listOf<RecentMangaItem>()
|
var recentItems = listOf<RecentMangaItem>()
|
||||||
private set
|
private set
|
||||||
var query = ""
|
var query = ""
|
||||||
@ -88,10 +89,11 @@ class RecentsPresenter(
|
|||||||
getRecents()
|
getRecents()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getRecents(updatePageCount: Boolean = false, retryCount: Int = 0, itemCount: Int = 0) {
|
fun getRecents(updatePageCount: Boolean = false) {
|
||||||
val oldQuery = query
|
val oldQuery = query
|
||||||
scope.launch {
|
recentsJob?.cancel()
|
||||||
runRecents(oldQuery, updatePageCount, retryCount, itemCount)
|
recentsJob = scope.launch {
|
||||||
|
runRecents(oldQuery, updatePageCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +322,7 @@ class RecentsPresenter(
|
|||||||
* @param chapters the list of chapter from the database.
|
* @param chapters the list of chapter from the database.
|
||||||
*/
|
*/
|
||||||
private fun setDownloadedChapters(chapters: List<RecentMangaItem>) {
|
private fun setDownloadedChapters(chapters: List<RecentMangaItem>) {
|
||||||
for (item in chapters) {
|
for (item in chapters.filter { it.chapter.id != null }) {
|
||||||
if (downloadManager.isChapterDownloaded(item.chapter, item.mch.manga)) {
|
if (downloadManager.isChapterDownloaded(item.chapter, item.mch.manga)) {
|
||||||
item.status = Download.DOWNLOADED
|
item.status = Download.DOWNLOADED
|
||||||
} else if (downloadManager.hasQueue()) {
|
} else if (downloadManager.hasQueue()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user