Implement simple stats screen (#8068)
* Implement simple stats screen * Review Changes * Some other changes * Remove unused * Small changes * Review Changes 2 + Cleanup * Review Changes 3 * Cleanup leftovers * Optimize imports
This commit is contained in:
@@ -107,6 +107,19 @@ class DownloadCache(
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of downloaded chapters.
|
||||
*/
|
||||
fun getTotalDownloadCount(): Int {
|
||||
renewCache()
|
||||
|
||||
return rootDownloadsDir.sourceDirs.values.sumOf { sourceDir ->
|
||||
sourceDir.mangaDirs.values.sumOf { mangaDir ->
|
||||
mangaDir.chapterDirs.size
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of downloaded chapters for a manga.
|
||||
*
|
||||
|
||||
@@ -205,6 +205,13 @@ class DownloadManager(
|
||||
.firstOrNull { it.chapter.id == chapter.id && it.chapter.manga_id == chapter.mangaId }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of downloaded chapters.
|
||||
*/
|
||||
fun getDownloadCount(): Int {
|
||||
return cache.getTotalDownloadCount()
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the amount of downloaded chapters for a manga.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user