mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-11 03:28:56 +01:00
Update libraries, some lints (#4099)
* Update some plugins * Fix some miscellaneous lints
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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, _ ->
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -27,9 +27,9 @@ class MigrationSourcesPresenter(
|
||||
|
||||
private fun findSourcesWithManga(library: List<Manga>): List<SourceItem> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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) ->
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -101,11 +101,11 @@ class LibraryItem(val manga: LibraryManga, private val libraryDisplayMode: Prefe
|
||||
private fun containsGenre(tag: String, genres: List<String>?): 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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,9 +409,7 @@ class LibraryPresenter(
|
||||
val mc = mutableListOf<MangaCategory>()
|
||||
|
||||
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)
|
||||
|
||||
@@ -31,7 +31,7 @@ class SetTrackReadingDatesDialog<T> : 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<TrackManager>().getService(track.sync_id)!!
|
||||
item = TrackItem(track, service)
|
||||
dateToUpdate = ReadingDate.Start
|
||||
|
||||
@@ -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<TrackHolder>() {
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<Chapter>): List<Chapter> {
|
||||
return allChapters.sortedBy { it.date_upload }
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user