mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 23:41:50 +01:00
Minor code cleanup
This commit is contained in:
parent
69be3e1e87
commit
00fe4cdf2d
@ -33,9 +33,6 @@ import java.util.TimeZone
|
|||||||
|
|
||||||
class AboutController : SettingsController() {
|
class AboutController : SettingsController() {
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks for new releases
|
|
||||||
*/
|
|
||||||
private val updateChecker by lazy { GithubUpdateChecker() }
|
private val updateChecker by lazy { GithubUpdateChecker() }
|
||||||
|
|
||||||
private val dateFormat: DateFormat = preferences.dateFormat()
|
private val dateFormat: DateFormat = preferences.dateFormat()
|
||||||
|
@ -20,7 +20,7 @@ class DirectoryPageLoader(val file: File) : PageLoader() {
|
|||||||
override fun getPages(): Observable<List<ReaderPage>> {
|
override fun getPages(): Observable<List<ReaderPage>> {
|
||||||
return file.listFiles()
|
return file.listFiles()
|
||||||
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { FileInputStream(it) } }
|
.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 ->
|
.mapIndexed { i, file ->
|
||||||
val streamFn = { FileInputStream(file) }
|
val streamFn = { FileInputStream(file) }
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
|
@ -8,7 +8,6 @@ import eu.kanade.tachiyomi.util.system.ImageUtil
|
|||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.util.zip.ZipEntry
|
|
||||||
import java.util.zip.ZipFile
|
import java.util.zip.ZipFile
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +39,7 @@ class ZipPageLoader(file: File) : PageLoader() {
|
|||||||
override fun getPages(): Observable<List<ReaderPage>> {
|
override fun getPages(): Observable<List<ReaderPage>> {
|
||||||
return zip.entries().toList()
|
return zip.entries().toList()
|
||||||
.filter { !it.isDirectory && ImageUtil.isImage(it.name) { zip.getInputStream(it) } }
|
.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 ->
|
.mapIndexed { i, entry ->
|
||||||
val streamFn = { zip.getInputStream(entry) }
|
val streamFn = { zip.getInputStream(entry) }
|
||||||
ReaderPage(i).apply {
|
ReaderPage(i).apply {
|
||||||
|
@ -202,7 +202,7 @@ class SettingsBackupController : SettingsController() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
CODE_BACKUP_RESTORE -> {
|
CODE_BACKUP_RESTORE -> {
|
||||||
uri?.path?.let { path ->
|
uri?.path?.let {
|
||||||
val fileName = DocumentFile.fromSingleUri(activity, uri)!!.name!!
|
val fileName = DocumentFile.fromSingleUri(activity, uri)!!.name!!
|
||||||
when {
|
when {
|
||||||
fileName.endsWith(".proto.gz") -> {
|
fileName.endsWith(".proto.gz") -> {
|
||||||
@ -255,7 +255,6 @@ class SettingsBackupController : SettingsController() {
|
|||||||
|
|
||||||
fun createBackup(flags: Int, type: Int) {
|
fun createBackup(flags: Int, type: Int) {
|
||||||
backupFlags = flags
|
backupFlags = flags
|
||||||
val currentDir = preferences.backupsDirectory().get()
|
|
||||||
val code = when (type) {
|
val code = when (type) {
|
||||||
BackupConst.BACKUP_TYPE_FULL -> CODE_FULL_BACKUP_CREATE
|
BackupConst.BACKUP_TYPE_FULL -> CODE_FULL_BACKUP_CREATE
|
||||||
else -> CODE_LEGACY_BACKUP_CREATE
|
else -> CODE_LEGACY_BACKUP_CREATE
|
||||||
|
Loading…
Reference in New Issue
Block a user