Remove useless context switches
This commit is contained in:
parent
441358f1ae
commit
29d786d8db
@ -17,7 +17,6 @@ import eu.kanade.tachiyomi.source.SourceManager
|
|||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||||
import eu.kanade.tachiyomi.util.lang.withUIContext
|
|
||||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||||
import exh.source.MERGED_SOURCE_ID
|
import exh.source.MERGED_SOURCE_ID
|
||||||
import exh.util.executeOnIO
|
import exh.util.executeOnIO
|
||||||
@ -63,19 +62,17 @@ class MigrationProcessHolder(
|
|||||||
binding.skipManga.isVisible = true
|
binding.skipManga.isVisible = true
|
||||||
binding.migrationMangaCardTo.resetManga()
|
binding.migrationMangaCardTo.resetManga()
|
||||||
if (manga != null) {
|
if (manga != null) {
|
||||||
withUIContext {
|
binding.migrationMangaCardFrom.attachManga(manga, source)
|
||||||
binding.migrationMangaCardFrom.attachManga(manga, source)
|
binding.migrationMangaCardFrom.root.clicks()
|
||||||
binding.migrationMangaCardFrom.root.clicks()
|
.onEach {
|
||||||
.onEach {
|
adapter.controller.router.pushController(
|
||||||
adapter.controller.router.pushController(
|
MangaController(
|
||||||
MangaController(
|
manga,
|
||||||
manga,
|
true
|
||||||
true
|
).withFadeTransaction()
|
||||||
).withFadeTransaction()
|
)
|
||||||
)
|
}
|
||||||
}
|
.launchIn(adapter.controller.viewScope)
|
||||||
.launchIn(adapter.controller.viewScope)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*launchUI {
|
/*launchUI {
|
||||||
item.manga.progress.asFlow().collect { (max, progress) ->
|
item.manga.progress.asFlow().collect { (max, progress) ->
|
||||||
@ -94,37 +91,36 @@ class MigrationProcessHolder(
|
|||||||
val resultSource = searchResult?.source?.let {
|
val resultSource = searchResult?.source?.let {
|
||||||
sourceManager.get(it)
|
sourceManager.get(it)
|
||||||
}
|
}
|
||||||
withUIContext {
|
|
||||||
if (item.manga.mangaId != this@MigrationProcessHolder.item?.manga?.mangaId ||
|
if (item.manga.mangaId != this@MigrationProcessHolder.item?.manga?.mangaId ||
|
||||||
item.manga.migrationStatus == MigrationStatus.RUNNING
|
item.manga.migrationStatus == MigrationStatus.RUNNING
|
||||||
) {
|
) {
|
||||||
return@withUIContext
|
return@launchUI
|
||||||
}
|
|
||||||
if (searchResult != null && resultSource != null) {
|
|
||||||
binding.migrationMangaCardTo.attachManga(searchResult, resultSource)
|
|
||||||
binding.migrationMangaCardTo.root.clicks()
|
|
||||||
.onEach {
|
|
||||||
adapter.controller.router.pushController(
|
|
||||||
MangaController(
|
|
||||||
searchResult,
|
|
||||||
true
|
|
||||||
).withFadeTransaction()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.launchIn(adapter.controller.viewScope)
|
|
||||||
} else {
|
|
||||||
if (adapter.hideNotFound) {
|
|
||||||
adapter.removeManga(bindingAdapterPosition)
|
|
||||||
} else {
|
|
||||||
binding.migrationMangaCardTo.loadingGroup.isVisible = false
|
|
||||||
binding.migrationMangaCardTo.title.text = view.context.applicationContext
|
|
||||||
.getString(R.string.no_alternatives_found)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
binding.migrationMenu.isVisible = true
|
|
||||||
binding.skipManga.isVisible = false
|
|
||||||
adapter.sourceFinished()
|
|
||||||
}
|
}
|
||||||
|
if (searchResult != null && resultSource != null) {
|
||||||
|
binding.migrationMangaCardTo.attachManga(searchResult, resultSource)
|
||||||
|
binding.migrationMangaCardTo.root.clicks()
|
||||||
|
.onEach {
|
||||||
|
adapter.controller.router.pushController(
|
||||||
|
MangaController(
|
||||||
|
searchResult,
|
||||||
|
true
|
||||||
|
).withFadeTransaction()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
.launchIn(adapter.controller.viewScope)
|
||||||
|
} else {
|
||||||
|
if (adapter.hideNotFound) {
|
||||||
|
adapter.removeManga(bindingAdapterPosition)
|
||||||
|
} else {
|
||||||
|
binding.migrationMangaCardTo.loadingGroup.isVisible = false
|
||||||
|
binding.migrationMangaCardTo.title.text = view.context.applicationContext
|
||||||
|
.getString(R.string.no_alternatives_found)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.migrationMenu.isVisible = true
|
||||||
|
binding.skipManga.isVisible = false
|
||||||
|
adapter.sourceFinished()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user