Linting fixes

(cherry picked from commit 3f63b320c4)
This commit is contained in:
Jobobby04
2020-05-02 00:03:03 -04:00
parent e4ff988f4d
commit 03e5c5ca10
9 changed files with 75 additions and 75 deletions

View File

@ -18,20 +18,20 @@ interface ChapterQueries : DbProvider {
fun getChapters(manga: Manga) = getChaptersByMangaId(manga.id) fun getChapters(manga: Manga) = getChaptersByMangaId(manga.id)
fun getChaptersByMangaId(mangaId: Long?) = db.get() fun getChaptersByMangaId(mangaId: Long?) = db.get()
.listOfObjects(Chapter::class.java) .listOfObjects(Chapter::class.java)
.withQuery(Query.builder() .withQuery(Query.builder()
.table(ChapterTable.TABLE) .table(ChapterTable.TABLE)
.where("${ChapterTable.COL_MANGA_ID} = ?") .where("${ChapterTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId) .whereArgs(mangaId)
.build()) .build())
.prepare() .prepare()
fun getChaptersByMergedMangaId(mangaId: Long) = db.get() fun getChaptersByMergedMangaId(mangaId: Long) = db.get()
.listOfObjects(Chapter::class.java) .listOfObjects(Chapter::class.java)
.withQuery(RawQuery.builder() .withQuery(RawQuery.builder()
.query(getMergedChaptersQuery(mangaId)) .query(getMergedChaptersQuery(mangaId))
.build()) .build())
.prepare() .prepare()
fun getRecentChapters(date: Date) = db.get() fun getRecentChapters(date: Date) = db.get()
.listOfObjects(MangaChapter::class.java) .listOfObjects(MangaChapter::class.java)
@ -79,13 +79,13 @@ interface ChapterQueries : DbProvider {
.prepare() .prepare()
fun getChapters(url: String) = db.get() fun getChapters(url: String) = db.get()
.listOfObjects(Chapter::class.java) .listOfObjects(Chapter::class.java)
.withQuery(Query.builder() .withQuery(Query.builder()
.table(ChapterTable.TABLE) .table(ChapterTable.TABLE)
.where("${ChapterTable.COL_URL} = ?") .where("${ChapterTable.COL_URL} = ?")
.whereArgs(url) .whereArgs(url)
.build()) .build())
.prepare() .prepare()
fun insertChapter(chapter: Chapter) = db.put().`object`(chapter).prepare() fun insertChapter(chapter: Chapter) = db.put().`object`(chapter).prepare()

View File

@ -19,13 +19,13 @@ class ExtensionFilterController : SettingsController() {
val activeLangs = preferences.enabledLanguages().get() val activeLangs = preferences.enabledLanguages().get()
val availableLangs = val availableLangs =
Injekt.get<ExtensionManager>().availableExtensions.groupBy { Injekt.get<ExtensionManager>().availableExtensions.groupBy {
it.lang it.lang
}.keys.minus("all").partition { }.keys.minus("all").partition {
it in activeLangs it in activeLangs
}.let { }.let {
it.first + it.second it.first + it.second
} }
availableLangs.forEach { availableLangs.forEach {
switchPreference { switchPreference {

View File

@ -37,12 +37,12 @@ class SaveImageNotifier(private val context: Context) {
*/ */
fun onComplete(file: File) { fun onComplete(file: File) {
val bitmap = GlideApp.with(context) val bitmap = GlideApp.with(context)
.asBitmap() .asBitmap()
.load(file) .load(file)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true) .skipMemoryCache(true)
.submit(720, 1280) .submit(720, 1280)
.get() .get()
if (bitmap != null) { if (bitmap != null) {
showCompleteNotification(file, bitmap) showCompleteNotification(file, bitmap)

View File

@ -19,16 +19,16 @@ 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(Comparator<File> { 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 {
stream = streamFn stream = streamFn
status = Page.READY status = Page.READY
}
} }
.let { Observable.just(it) } }
.let { Observable.just(it) }
} }
/** /**

View File

@ -30,14 +30,14 @@ class EpubPageLoader(file: File) : PageLoader() {
*/ */
override fun getPages(): Observable<List<ReaderPage>> { override fun getPages(): Observable<List<ReaderPage>> {
return epub.getImagesFromPages() return epub.getImagesFromPages()
.mapIndexed { i, path -> .mapIndexed { i, path ->
val streamFn = { epub.getInputStream(epub.getEntry(path)!!) } val streamFn = { epub.getInputStream(epub.getEntry(path)!!) }
ReaderPage(i).apply { ReaderPage(i).apply {
stream = streamFn stream = streamFn
status = Page.READY status = Page.READY
}
} }
.let { Observable.just(it) } }
.let { Observable.just(it) }
} }
/** /**

View File

@ -43,17 +43,17 @@ class RarPageLoader(file: File) : PageLoader() {
*/ */
override fun getPages(): Observable<List<ReaderPage>> { override fun getPages(): Observable<List<ReaderPage>> {
return archive.fileHeaders return archive.fileHeaders
.filter { !it.isDirectory && ImageUtil.isImage(it.fileNameString) { archive.getInputStream(it) } } .filter { !it.isDirectory && ImageUtil.isImage(it.fileNameString) { archive.getInputStream(it) } }
.sortedWith(Comparator<FileHeader> { f1, f2 -> f1.fileNameString.compareToCaseInsensitiveNaturalOrder(f2.fileNameString) }) .sortedWith(Comparator<FileHeader> { f1, f2 -> f1.fileNameString.compareToCaseInsensitiveNaturalOrder(f2.fileNameString) })
.mapIndexed { i, header -> .mapIndexed { i, header ->
val streamFn = { getStream(header) } val streamFn = { getStream(header) }
ReaderPage(i).apply { ReaderPage(i).apply {
stream = streamFn stream = streamFn
status = Page.READY status = Page.READY
}
} }
.let { Observable.just(it) } }
.let { Observable.just(it) }
} }
/** /**

View File

@ -33,16 +33,16 @@ 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(Comparator<ZipEntry> { 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 {
stream = streamFn stream = streamFn
status = Page.READY status = Page.READY
}
} }
.let { Observable.just(it) } }
.let { Observable.just(it) }
} }
/** /**

View File

@ -146,13 +146,13 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
} }
animate() animate()
.apply { .apply {
newX?.let { x(it) } newX?.let { x(it) }
newY?.let { y(it) } newY?.let { y(it) }
} }
.setInterpolator(DecelerateInterpolator()) .setInterpolator(DecelerateInterpolator())
.setDuration(400) .setDuration(400)
.start() .start()
return true return true
} }

View File

@ -139,8 +139,8 @@ class EpubFile(file: File) : Closeable {
*/ */
private fun getPagesFromDocument(document: Document): List<String> { private fun getPagesFromDocument(document: Document): List<String> {
val pages = document.select("manifest > item") val pages = document.select("manifest > item")
.filter { "application/xhtml+xml" == it.attr("media-type") } .filter { "application/xhtml+xml" == it.attr("media-type") }
.associateBy { it.attr("id") } .associateBy { it.attr("id") }
val spine = document.select("spine > itemref").map { it.attr("idref") } val spine = document.select("spine > itemref").map { it.attr("idref") }
return spine.mapNotNull { pages[it] }.map { it.attr("href") } return spine.mapNotNull { pages[it] }.map { it.attr("href") }