mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 04:09:18 +01:00
Using maxByOrNull in more places
needed for newer versions of kotlin
This commit is contained in:
parent
1f54bacb98
commit
da8d6f3fa4
@ -73,7 +73,7 @@ class SmartSearchEngine(
|
||||
}
|
||||
}
|
||||
|
||||
return eligibleManga.maxBy { it.dist }?.manga
|
||||
return eligibleManga.maxByOrNull { it.dist }?.manga
|
||||
}
|
||||
private fun removeTextInBrackets(text: String, readForward: Boolean): String {
|
||||
val bracketPairs = listOf(
|
||||
|
@ -109,7 +109,7 @@ class MigrationPresenter(
|
||||
|
||||
val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking()
|
||||
val maxChapterRead =
|
||||
prevMangaChapters.filter { it.read }.maxBy { it.chapter_number }?.chapter_number
|
||||
prevMangaChapters.filter { it.read }.maxOfOrNull { it.chapter_number }
|
||||
if (maxChapterRead != null) {
|
||||
val dbChapters = db.getChapters(manga).executeAsBlocking()
|
||||
for (chapter in dbChapters) {
|
||||
|
@ -204,7 +204,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
||||
}
|
||||
}
|
||||
}
|
||||
}.mapNotNull { it.await() }.maxBy { it.second }?.first
|
||||
}.mapNotNull { it.await() }.maxByOrNull { it.second }?.first
|
||||
} else {
|
||||
validSources.forEachIndexed { index, source ->
|
||||
val searchResult = try {
|
||||
|
@ -159,7 +159,7 @@ class MigrationProcessHolder(
|
||||
|
||||
val mangaChapters = db.getChapters(manga).executeAsBlocking()
|
||||
unreadDownloadBadge.badgeView.setChapters(mangaChapters.size)
|
||||
val latestChapter = mangaChapters.maxBy { it.chapter_number }?.chapter_number ?: -1f
|
||||
val latestChapter = mangaChapters.maxOfOrNull { it.chapter_number } ?: -1f
|
||||
|
||||
if (latestChapter > 0f) {
|
||||
subtitle.text = root.context.getString(
|
||||
|
@ -286,7 +286,7 @@ fun Context.openInBrowser(url: String, forceBrowser: Boolean): Boolean {
|
||||
)
|
||||
.build()
|
||||
if (forceBrowser) {
|
||||
val packages = getCustomTabsPackages().maxBy { it.preferredOrder }
|
||||
val packages = getCustomTabsPackages().maxByOrNull { it.preferredOrder }
|
||||
val processName = packages?.activityInfo?.processName ?: return false
|
||||
intent.intent.`package` = processName
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user