mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 16:29:20 +01:00
delete useless code
This commit is contained in:
parent
d4ad60515b
commit
cc4e994682
@ -22,8 +22,6 @@ import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.io.File
|
||||
import java.util.TreeMap
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
|
||||
class DownloadStatsScreenModel(
|
||||
private val getLibraryManga: GetLibraryManga = Injekt.get(),
|
||||
@ -99,34 +97,15 @@ class DownloadStatsScreenModel(
|
||||
}
|
||||
|
||||
private fun getFileSize(file: File): Long {
|
||||
val archiveFormats = setOf(".zip", ".cbz", ".rar", ".cbr")
|
||||
return if (file.isDirectory) {
|
||||
getFolderSize(file.path)
|
||||
} else if (file.isFile) {
|
||||
file.length()
|
||||
} else if (file.extension.lowercase() in archiveFormats) {
|
||||
getZipFileSize(file)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
private fun getZipFileSize(file: File): Long {
|
||||
var size: Long = 0
|
||||
|
||||
val zipFile = ZipFile(file)
|
||||
val entries = zipFile.entries()
|
||||
|
||||
while (entries.hasMoreElements()) {
|
||||
val entry: ZipEntry = entries.nextElement()
|
||||
size += entry.size
|
||||
}
|
||||
|
||||
zipFile.close()
|
||||
|
||||
return size
|
||||
}
|
||||
|
||||
fun runSortAction(mode: SortingMode) {
|
||||
when (mode) {
|
||||
SortingMode.BY_ALPHABET -> sortByAlphabet()
|
||||
|
Loading…
Reference in New Issue
Block a user