mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 18:19:16 +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 uy.kohesive.injekt.injectLazy
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.TreeMap
|
import java.util.TreeMap
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipFile
|
|
||||||
|
|
||||||
class DownloadStatsScreenModel(
|
class DownloadStatsScreenModel(
|
||||||
private val getLibraryManga: GetLibraryManga = Injekt.get(),
|
private val getLibraryManga: GetLibraryManga = Injekt.get(),
|
||||||
@ -99,34 +97,15 @@ class DownloadStatsScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getFileSize(file: File): Long {
|
private fun getFileSize(file: File): Long {
|
||||||
val archiveFormats = setOf(".zip", ".cbz", ".rar", ".cbr")
|
|
||||||
return if (file.isDirectory) {
|
return if (file.isDirectory) {
|
||||||
getFolderSize(file.path)
|
getFolderSize(file.path)
|
||||||
} else if (file.isFile) {
|
} else if (file.isFile) {
|
||||||
file.length()
|
file.length()
|
||||||
} else if (file.extension.lowercase() in archiveFormats) {
|
|
||||||
getZipFileSize(file)
|
|
||||||
} else {
|
} else {
|
||||||
0
|
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) {
|
fun runSortAction(mode: SortingMode) {
|
||||||
when (mode) {
|
when (mode) {
|
||||||
SortingMode.BY_ALPHABET -> sortByAlphabet()
|
SortingMode.BY_ALPHABET -> sortByAlphabet()
|
||||||
|
Loading…
Reference in New Issue
Block a user