Minor code cleanup

This commit is contained in:
arkon 2020-12-13 18:11:18 -05:00
parent 69be3e1e87
commit 00fe4cdf2d
4 changed files with 3 additions and 8 deletions

View file

@ -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()

View file

@ -20,7 +20,7 @@ class DirectoryPageLoader(val file: File) : PageLoader() {
override fun getPages(): Observable<List<ReaderPage>> {
return file.listFiles()
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } }
.sortedWith(Comparator<File> { 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 {

View file

@ -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<List<ReaderPage>> {
return zip.entries().toList()
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { zip.getInputStream(it) } }
.sortedWith(Comparator<ZipEntry> { 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 {

View file

@ -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