From c2b8fea291686a148b98778aa8550e5fa61d8ab3 Mon Sep 17 00:00:00 2001 From: Taco Date: Tue, 8 Dec 2020 22:21:08 -0500 Subject: [PATCH] Update libraries, some lints (#4099) * Update some plugins * Fix some miscellaneous lints --- app/build.gradle | 3 +-- .../tachiyomi/data/backup/AbstractBackupManager.kt | 4 ++-- .../tachiyomi/data/backup/AbstractBackupRestore.kt | 1 - .../kanade/tachiyomi/data/download/DownloadCache.kt | 2 +- .../data/download/DownloadPendingDeleter.kt | 4 ++-- .../tachiyomi/data/library/LibraryUpdateNotifier.kt | 3 +-- .../tachiyomi/data/library/LibraryUpdateService.kt | 4 ++-- .../tachiyomi/data/track/myanimelist/MyAnimeList.kt | 8 ++------ .../tachiyomi/extension/api/ExtensionGithubApi.kt | 2 -- .../ui/browse/extension/ExtensionController.kt | 2 +- .../extension/details/ExtensionDetailsPresenter.kt | 2 +- .../ui/browse/migration/search/SearchPresenter.kt | 2 +- .../migration/sources/MigrationSourcesPresenter.kt | 4 ++-- .../tachiyomi/ui/browse/source/SourcePresenter.kt | 1 - .../browse/source/browse/BrowseSourceController.kt | 2 +- .../ui/browse/source/browse/BrowseSourcePresenter.kt | 6 +++--- .../source/globalsearch/GlobalSearchController.kt | 2 +- .../source/globalsearch/GlobalSearchPresenter.kt | 5 ++--- .../tachiyomi/ui/category/CategoryPresenter.kt | 2 +- .../eu/kanade/tachiyomi/ui/library/LibraryItem.kt | 4 ++-- .../kanade/tachiyomi/ui/library/LibraryPresenter.kt | 4 +--- .../ui/manga/track/SetTrackReadingDatesDialog.kt | 2 +- .../kanade/tachiyomi/ui/manga/track/TrackAdapter.kt | 1 - .../tachiyomi/ui/manga/track/TrackSearchAdapter.kt | 2 +- .../tachiyomi/ui/reader/ChapterLoadStrategy.kt | 2 +- .../tachiyomi/ui/reader/ReaderSettingsSheet.kt | 1 - .../ui/reader/viewer/webtoon/WebtoonViewer.kt | 2 +- .../eu/kanade/tachiyomi/util/storage/EpubFile.kt | 12 ++++++------ .../eu/kanade/tachiyomi/util/system/ImageUtil.kt | 5 +---- build.gradle.kts | 4 ++-- buildSrc/src/main/kotlin/Dependencies.kt | 3 ++- 31 files changed, 42 insertions(+), 59 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e60d74bdd2..c08833a609 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -266,8 +266,7 @@ dependencies { implementation "io.github.reactivecircus.flowbinding:flowbinding-viewpager:$flowbinding_version" // Licenses - // NOTE: REMEMBER TO UPDATE GRADLE PLUGIN - implementation 'com.mikepenz:aboutlibraries:8.4.2' + implementation "com.mikepenz:aboutlibraries:$BuildPluginsVersion.ABOUTLIB_PLUGIN" // Tests testImplementation 'junit:junit:4.13' diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupManager.kt index f211b7038c..1e65fe4cbd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupManager.kt @@ -41,8 +41,8 @@ abstract class AbstractBackupManager(protected val context: Context) { internal fun restoreChapterFetchObservable(source: Source, manga: Manga, chapters: List): Observable, List>> { return source.fetchChapterList(manga) .map { syncChaptersWithSource(databaseHelper, it, manga, source) } - .doOnNext { pair -> - if (pair.first.isNotEmpty()) { + .doOnNext { (first) -> + if (first.isNotEmpty()) { chapters.forEach { it.manga_id = manga.id } updateChapters(chapters) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupRestore.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupRestore.kt index 19e41c429a..9a0926e3b3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupRestore.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/AbstractBackupRestore.kt @@ -11,7 +11,6 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.util.chapter.NoChaptersException import kotlinx.coroutines.Job -import okio.source import rx.Observable import uy.kohesive.injekt.injectLazy import java.io.File diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index edf719e74a..891e5d2863 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -128,7 +128,7 @@ class DownloadCache( .orEmpty() .associate { it.name to SourceDirectory(it) } .mapNotNullKeys { entry -> - onlineSources.find { provider.getSourceDirName(it).toLowerCase() == entry.key?.toLowerCase() }?.id + onlineSources.find { provider.getSourceDirName(it).equals(entry.key, ignoreCase = true) }?.id } rootDir.files = sourceDirs diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt index f9ff46b5f2..d42fe982a5 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadPendingDeleter.kt @@ -89,8 +89,8 @@ class DownloadPendingDeleter(context: Context) { } lastAddedEntry = null - return entries.associate { entry -> - entry.manga.toModel() to entry.chapters.map { it.toModel() } + return entries.associate { (chapters, manga) -> + manga.toModel() to chapters.map { it.toModel() } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt index 697d76b3f7..26fb7e6e1a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateNotifier.kt @@ -165,8 +165,7 @@ class LibraryUpdateNotifier(private val context: Context) { // Per-manga notification if (!preferences.hideNotificationContent()) { - updates.forEach { - val (manga, chapters) = it + updates.forEach { (manga, chapters) -> notify(manga.id.hashCode(), createNewChaptersNotification(manga, chapters)) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index 4884f87c0a..ca411c6fc1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -275,7 +275,7 @@ class LibraryUpdateService( Pair(emptyList(), emptyList()) } // Filter out mangas without new chapters (or failed). - .filter { pair -> pair.first.isNotEmpty() } + .filter { (first) -> first.isNotEmpty() } .doOnNext { if (manga.shouldDownloadNewChapters(db, preferences)) { downloadChapters(manga, it.first) @@ -317,7 +317,7 @@ class LibraryUpdateService( ) } } - .map { manga -> manga.first } + .map { (first) -> first } } private fun downloadChapters(manga: Manga, chapters: List) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt index a87bb61cef..5aaf8c065b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/myanimelist/MyAnimeList.kt @@ -149,13 +149,9 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) { private fun saveCSRF(csrf: String) = preferences.trackToken(this).set(csrf) private fun checkCookies(): Boolean { - var ckCount = 0 val url = BASE_URL.toHttpUrlOrNull()!! - for (ck in networkService.cookieManager.get(url)) { - if (ck.name == USER_SESSION_COOKIE || ck.name == LOGGED_IN_COOKIE) { - ckCount++ - } - } + val ckCount = networkService.cookieManager.get(url).count { + it.name == USER_SESSION_COOKIE || it.name == LOGGED_IN_COOKIE } return ckCount == 2 } diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index 941c6e6e24..6268b2f053 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -1,8 +1,6 @@ package eu.kanade.tachiyomi.extension.api import android.content.Context -import com.github.salomonbrys.kotson.get -import com.github.salomonbrys.kotson.int import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.LoadResult diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt index 7fe30b04f4..2b86eb8319 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/ExtensionController.kt @@ -185,7 +185,7 @@ open class ExtensionController : } private fun drawExtensions() { - if (!query.isBlank()) { + if (query.isNotBlank()) { adapter?.updateDataSet( extensions.filter { it.extension.name.contains(query, ignoreCase = true) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt index e43ea629d6..149de4b119 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/extension/details/ExtensionDetailsPresenter.kt @@ -24,7 +24,7 @@ class ExtensionDetailsPresenter( extensionManager.getInstalledExtensionsObservable() .skip(1) .filter { extensions -> extensions.none { it.pkgName == pkgName } } - .map { Unit } + .map { } .take(1) .observeOn(AndroidSchedulers.mainThread()) .subscribeFirst({ view, _ -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt index 277ec75294..bd8e4aa848 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt @@ -97,7 +97,7 @@ class SearchPresenter( val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking() val maxChapterRead = prevMangaChapters .filter { it.read } - .maxBy { it.chapter_number }?.chapter_number + .maxByOrNull { it.chapter_number }?.chapter_number val bookmarkedChapters = prevMangaChapters .filter { it.bookmark && it.isRecognizedNumber } .map { it.chapter_number } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt index 72a3a25264..61181ba2ed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesPresenter.kt @@ -27,9 +27,9 @@ class MigrationSourcesPresenter( private fun findSourcesWithManga(library: List): List { val header = SelectionHeader() - return library.map { it.source }.toSet() + return library.asSequence().map { it.source }.toSet() .mapNotNull { if (it != LocalSource.ID) sourceManager.getOrStub(it) else null } .sortedBy { it.name.toLowerCase() } - .map { SourceItem(it, header) } + .map { SourceItem(it, header) }.toList() } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt index eeee195c5a..a51deafb5d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt @@ -13,7 +13,6 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.onStart import rx.Observable diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt index 330c81ffee..d2ab129c2c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt @@ -264,7 +264,7 @@ open class BrowseSourceController(bundle: Bundle) : searchView.maxWidth = Int.MAX_VALUE val query = presenter.query - if (!query.isBlank()) { + if (query.isNotBlank()) { searchItem.expandActionView() searchView.setQuery(query, true) searchView.clearFocus() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt index 840aae6fc5..e2de202315 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourcePresenter.kt @@ -52,7 +52,7 @@ import java.util.Date */ open class BrowseSourcePresenter( private val sourceId: Long, - private val searchQuery: String? = null, + searchQuery: String? = null, private val sourceManager: SourceManager = Injekt.get(), private val db: DatabaseHelper = Injekt.get(), private val prefs: PreferencesHelper = Injekt.get(), @@ -153,9 +153,9 @@ open class BrowseSourcePresenter( pagerSubscription?.let { remove(it) } pagerSubscription = pager.results() .observeOn(Schedulers.io()) - .map { pair -> pair.first to pair.second.map { networkToLocalManga(it, sourceId) } } + .map { (first, second) -> first to second.map { networkToLocalManga(it, sourceId) } } .doOnNext { initializeMangas(it.second) } - .map { pair -> pair.first to pair.second.map { SourceItem(it, sourceDisplayMode) } } + .map { (first, second) -> first to second.map { SourceItem(it, sourceDisplayMode) } } .observeOn(AndroidSchedulers.mainThread()) .subscribeReplay( { view, (page, mangas) -> diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt index 9f18df694e..012cff7200 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt @@ -195,7 +195,7 @@ open class GlobalSearchController( adapter?.updateDataSet(searchResult) - val progress = searchResult.mapNotNull { it.results }.count().toDouble() / searchResult.size + val progress = searchResult.mapNotNull { it.results }.size.toDouble() / searchResult.size if (progress < 1) { binding.progressBar.isVisible = true binding.progressBar.progress = (progress * 100).toInt() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt index 9912413c59..48214dbd66 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchPresenter.kt @@ -222,9 +222,8 @@ open class GlobalSearchPresenter( private fun initializeFetchImageSubscription() { fetchImageSubscription?.unsubscribe() fetchImageSubscription = fetchImageSubject.observeOn(Schedulers.io()) - .flatMap { pair -> - val source = pair.second - Observable.from(pair.first).filter { it.thumbnail_url == null && !it.initialized } + .flatMap { (first, source) -> + Observable.from(first).filter { it.thumbnail_url == null && !it.initialized } .map { Pair(it, source) } .concatMap { getMangaDetailsObservable(it.first, it.second) } .map { Pair(source as CatalogueSource, it) } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt index 273d62e3ea..1c6aab6b6a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt @@ -52,7 +52,7 @@ class CategoryPresenter( val cat = Category.create(name) // Set the new item in the last position. - cat.order = categories.map { it.order + 1 }.max() ?: 0 + cat.order = categories.map { it.order + 1 }.maxOrNull() ?: 0 // Insert into database. db.insertCategory(cat).asRxObservable().subscribe() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt index 21d8f481b2..8a46667aca 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt @@ -101,11 +101,11 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe private fun containsGenre(tag: String, genres: List?): Boolean { return if (tag.startsWith("-")) { genres?.find { - it.trim().toLowerCase() == tag.substringAfter("-").toLowerCase() + it.trim().equals(tag.substringAfter("-"), ignoreCase = true) } == null } else { genres?.find { - it.trim().toLowerCase() == tag.toLowerCase() + it.trim().equals(tag, ignoreCase = true) } != null } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 2bb7658b15..be0be7ec52 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -409,9 +409,7 @@ class LibraryPresenter( val mc = mutableListOf() for (manga in mangas) { - for (cat in categories) { - mc.add(MangaCategory.create(manga, cat)) - } + categories.mapTo(mc) { MangaCategory.create(manga, it) } } db.setMangaCategories(mc, mangas) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt index 36984dd64d..f1e0ee5ffe 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/SetTrackReadingDatesDialog.kt @@ -31,7 +31,7 @@ class SetTrackReadingDatesDialog : DialogController @Suppress("unused") constructor(bundle: Bundle) : super(bundle) { - val track = bundle.getSerializable(SetTrackReadingDatesDialog.KEY_ITEM_TRACK) as Track + val track = bundle.getSerializable(KEY_ITEM_TRACK) as Track val service = Injekt.get().getService(track.sync_id)!! item = TrackItem(track, service) dateToUpdate = ReadingDate.Start diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt index deb95aa950..221212ef7f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackAdapter.kt @@ -4,7 +4,6 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import eu.kanade.tachiyomi.databinding.TrackItemBinding -import eu.kanade.tachiyomi.util.view.inflate class TrackAdapter(controller: TrackController) : RecyclerView.Adapter() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt index dd8769ab03..0520f4260a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackSearchAdapter.kt @@ -47,7 +47,7 @@ class TrackSearchAdapter(context: Context) : binding.trackSearchTitle.text = track.title binding.trackSearchSummary.text = track.summary GlideApp.with(view.context).clear(binding.trackSearchCover) - if (!track.cover_url.isEmpty()) { + if (track.cover_url.isNotEmpty()) { GlideApp.with(view.context) .load(track.cover_url) .diskCacheStrategy(DiskCacheStrategy.RESOURCE) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ChapterLoadStrategy.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ChapterLoadStrategy.kt index f637e5b09f..0d5d18d60b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ChapterLoadStrategy.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ChapterLoadStrategy.kt @@ -39,7 +39,7 @@ class ChapterLoadByNumber { /** * Load strategy using the chapter upload date. This ordering ignores scanlators */ -class ChapterLoadByUploadDate() { +class ChapterLoadByUploadDate { fun get(allChapters: List): List { return allChapters.sortedBy { it.date_upload } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt index 698660553f..e3ef93a445 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderSettingsSheet.kt @@ -6,7 +6,6 @@ import android.widget.Spinner import androidx.annotation.ArrayRes import androidx.core.view.isInvisible import androidx.core.view.isVisible -import androidx.core.view.plusAssign import androidx.core.widget.NestedScrollView import com.google.android.material.bottomsheet.BottomSheetDialog import com.tfcporciuncula.flow.Preference diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt index e2a4492369..58676cb0ad 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonViewer.kt @@ -152,7 +152,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr // Initial opening - preload allowed currentPage ?: return true - val nextItem = adapter.items.getOrNull(adapter.items.count() - 1) + val nextItem = adapter.items.getOrNull(adapter.items.size - 1) val nextChapter = (nextItem as? ChapterTransition.Next)?.to ?: (nextItem as? ReaderPage)?.chapter // Allow preload for diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt b/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt index 656467850f..9a8b24be8e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/storage/EpubFile.kt @@ -175,10 +175,10 @@ class EpubFile(file: File) : Closeable { */ private fun getPathSeparator(): String { val meta = zip.getEntry("META-INF\\container.xml") - if (meta != null) { - return "\\" + return if (meta != null) { + "\\" } else { - return "/" + "/" } } @@ -206,10 +206,10 @@ class EpubFile(file: File) : Closeable { */ private fun getParentDirectory(path: String): String { val separatorIndex = path.lastIndexOf(pathSeparator) - if (separatorIndex >= 0) { - return path.substring(0, separatorIndex) + return if (separatorIndex >= 0) { + path.substring(0, separatorIndex) } else { - return "" + "" } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index b519a3361e..ca6bb9a64d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -51,10 +51,7 @@ object ImageUtil { } private fun ByteArray.compareWith(magic: ByteArray): Boolean { - for (i in magic.indices) { - if (this[i] != magic[i]) return false - } - return true + return magic.indices.none { this[it] != magic[it] } } private fun charByteArrayOf(vararg bytes: Int): ByteArray { diff --git a/build.gradle.kts b/build.gradle.kts index 243efc4a7c..4430339fb3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,8 +26,8 @@ subprojects { buildscript { dependencies { classpath("com.github.zellius:android-shortcut-gradle-plugin:0.1.2") - classpath("com.google.gms:google-services:4.3.3") - classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:8.3.0") + classpath("com.google.gms:google-services:4.3.4") + classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:" + BuildPluginsVersion.ABOUTLIB_PLUGIN) classpath(kotlin("serialization", version = BuildPluginsVersion.KOTLIN)) } repositories { diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 08d61fa29b..75f369cda9 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -2,5 +2,6 @@ object BuildPluginsVersion { const val AGP = "4.1.1" const val KOTLIN = "1.4.20" const val KOTLINTER = "3.0.2" - const val VERSIONS_PLUGIN = "0.33.0" + const val VERSIONS_PLUGIN = "0.36.0" + const val ABOUTLIB_PLUGIN = "8.6.3" }