From 00fe4cdf2d3e8e37e236c57c06b3db7884b26620 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 13 Dec 2020 18:11:18 -0500 Subject: [PATCH] Minor code cleanup --- .../main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt | 3 --- .../kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt | 3 +-- .../eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt | 3 +-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt index 01ff6f6304..cad7c57270 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/more/AboutController.kt @@ -33,9 +33,6 @@ import java.util.TimeZone class AboutController : SettingsController() { - /** - * Checks for new releases - */ private val updateChecker by lazy { GithubUpdateChecker() } private val dateFormat: DateFormat = preferences.dateFormat() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt index 71671b6fc2..d836cc0c35 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/DirectoryPageLoader.kt @@ -20,7 +20,7 @@ class DirectoryPageLoader(val file: File) : PageLoader() { override fun getPages(): Observable> { return file.listFiles() .filter { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } } - .sortedWith(Comparator { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }) + .sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) } .mapIndexed { i, file -> val streamFn = { FileInputStream(file) } ReaderPage(i).apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt index a48c404a66..bee0d372a2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ZipPageLoader.kt @@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.util.system.ImageUtil import rx.Observable import java.io.File import java.nio.charset.StandardCharsets -import java.util.zip.ZipEntry import java.util.zip.ZipFile /** @@ -40,7 +39,7 @@ class ZipPageLoader(file: File) : PageLoader() { override fun getPages(): Observable> { return zip.entries().toList() .filter { !it.isDirectory && ImageUtil.isImage(it.name) { zip.getInputStream(it) } } - .sortedWith(Comparator { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) }) + .sortedWith { f1, f2 -> f1.name.compareToCaseInsensitiveNaturalOrder(f2.name) } .mapIndexed { i, entry -> val streamFn = { zip.getInputStream(entry) } ReaderPage(i).apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt index 9d703461c6..c6ddb1bdc5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsBackupController.kt @@ -202,7 +202,7 @@ class SettingsBackupController : SettingsController() { ) } CODE_BACKUP_RESTORE -> { - uri?.path?.let { path -> + uri?.path?.let { val fileName = DocumentFile.fromSingleUri(activity, uri)!!.name!! when { fileName.endsWith(".proto.gz") -> { @@ -255,7 +255,6 @@ class SettingsBackupController : SettingsController() { fun createBackup(flags: Int, type: Int) { backupFlags = flags - val currentDir = preferences.backupsDirectory().get() val code = when (type) { BackupConst.BACKUP_TYPE_FULL -> CODE_FULL_BACKUP_CREATE else -> CODE_LEGACY_BACKUP_CREATE