mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-09 20:29:24 +01:00
Moved coroutines exts to system until folder
why was this in lang arkon??
This commit is contained in:
parent
3c54485ecf
commit
aea88f43d7
@ -15,8 +15,8 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||||
import eu.kanade.tachiyomi.source.online.fetchAllImageUrlsFromPageList
|
import eu.kanade.tachiyomi.source.online.fetchAllImageUrlsFromPageList
|
||||||
import eu.kanade.tachiyomi.util.lang.RetryWithDelay
|
import eu.kanade.tachiyomi.util.lang.RetryWithDelay
|
||||||
import eu.kanade.tachiyomi.util.lang.launchNow
|
import eu.kanade.tachiyomi.util.system.launchNow
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
||||||
import eu.kanade.tachiyomi.util.storage.saveTo
|
import eu.kanade.tachiyomi.util.storage.saveTo
|
||||||
@ -230,42 +230,43 @@ class Downloader(
|
|||||||
* @param chapters the list of chapters to download.
|
* @param chapters the list of chapters to download.
|
||||||
* @param autoStart whether to start the downloader after enqueing the chapters.
|
* @param autoStart whether to start the downloader after enqueing the chapters.
|
||||||
*/
|
*/
|
||||||
fun queueChapters(manga: Manga, chapters: List<Chapter>, autoStart: Boolean) = launchUI {
|
fun queueChapters(manga: Manga, chapters: List<Chapter>, autoStart: Boolean) =
|
||||||
val source = sourceManager.get(manga.source) as? HttpSource ?: return@launchUI
|
launchUI {
|
||||||
val wasEmpty = queue.isEmpty()
|
val source = sourceManager.get(manga.source) as? HttpSource ?: return@launchUI
|
||||||
// Called in background thread, the operation can be slow with SAF.
|
val wasEmpty = queue.isEmpty()
|
||||||
val chaptersWithoutDir = async {
|
// Called in background thread, the operation can be slow with SAF.
|
||||||
chapters
|
val chaptersWithoutDir = async {
|
||||||
|
chapters
|
||||||
// Filter out those already downloaded.
|
// Filter out those already downloaded.
|
||||||
.filter { provider.findChapterDir(it, manga, source) == null }
|
.filter { provider.findChapterDir(it, manga, source) == null }
|
||||||
// Add chapters to queue from the start.
|
// Add chapters to queue from the start.
|
||||||
.sortedByDescending { it.source_order }
|
.sortedByDescending { it.source_order }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs in main thread (synchronization needed).
|
// Runs in main thread (synchronization needed).
|
||||||
val chaptersToQueue = chaptersWithoutDir.await()
|
val chaptersToQueue = chaptersWithoutDir.await()
|
||||||
// Filter out those already enqueued.
|
// Filter out those already enqueued.
|
||||||
.filter { chapter -> queue.none { it.chapter.id == chapter.id } }
|
.filter { chapter -> queue.none { it.chapter.id == chapter.id } }
|
||||||
// Create a download for each one.
|
// Create a download for each one.
|
||||||
.map { Download(source, manga, it) }
|
.map { Download(source, manga, it) }
|
||||||
|
|
||||||
if (chaptersToQueue.isNotEmpty()) {
|
if (chaptersToQueue.isNotEmpty()) {
|
||||||
queue.addAll(chaptersToQueue)
|
queue.addAll(chaptersToQueue)
|
||||||
|
|
||||||
// Initialize queue size.
|
// Initialize queue size.
|
||||||
notifier.initialQueueSize = queue.size
|
notifier.initialQueueSize = queue.size
|
||||||
|
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
// Send the list of downloads to the downloader.
|
// Send the list of downloads to the downloader.
|
||||||
downloadsRelay.call(chaptersToQueue)
|
downloadsRelay.call(chaptersToQueue)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start downloader if needed
|
// Start downloader if needed
|
||||||
if (autoStart && wasEmpty) {
|
if (autoStart && wasEmpty) {
|
||||||
DownloadService.start(this@Downloader.context)
|
DownloadService.start(this@Downloader.context)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the observable which downloads a chapter.
|
* Returns the observable which downloads a chapter.
|
||||||
|
@ -12,7 +12,7 @@ import eu.kanade.tachiyomi.extension.util.ExtensionInstallReceiver
|
|||||||
import eu.kanade.tachiyomi.extension.util.ExtensionInstaller
|
import eu.kanade.tachiyomi.extension.util.ExtensionInstaller
|
||||||
import eu.kanade.tachiyomi.extension.util.ExtensionLoader
|
import eu.kanade.tachiyomi.extension.util.ExtensionLoader
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.util.lang.launchNow
|
import eu.kanade.tachiyomi.util.system.launchNow
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import rx.android.schedulers.AndroidSchedulers
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
@ -252,16 +252,13 @@ class ExtensionManager(
|
|||||||
|
|
||||||
val ctx = context
|
val ctx = context
|
||||||
launchNow {
|
launchNow {
|
||||||
nowTrustedExtensions
|
nowTrustedExtensions.map { extension ->
|
||||||
.map { extension ->
|
async { ExtensionLoader.loadExtensionFromPkgName(ctx, extension.pkgName) }
|
||||||
async { ExtensionLoader.loadExtensionFromPkgName(ctx, extension.pkgName) }
|
}.map { it.await() }.forEach { result ->
|
||||||
}
|
if (result is LoadResult.Success) {
|
||||||
.map { it.await() }
|
registerNewExtension(result.extension)
|
||||||
.forEach { result ->
|
|
||||||
if (result is LoadResult.Success) {
|
|
||||||
registerNewExtension(result.extension)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import android.content.Intent
|
|||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import eu.kanade.tachiyomi.extension.model.Extension
|
import eu.kanade.tachiyomi.extension.model.Extension
|
||||||
import eu.kanade.tachiyomi.extension.model.LoadResult
|
import eu.kanade.tachiyomi.extension.model.LoadResult
|
||||||
import eu.kanade.tachiyomi.util.lang.launchNow
|
import eu.kanade.tachiyomi.util.system.launchNow
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -61,7 +61,8 @@ internal class ExtensionInstallReceiver(private val listener: Listener) :
|
|||||||
when (result) {
|
when (result) {
|
||||||
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
|
is LoadResult.Success -> listener.onExtensionUpdated(result.extension)
|
||||||
// Not needed as a package can't be upgraded if the signature is different
|
// Not needed as a package can't be upgraded if the signature is different
|
||||||
is LoadResult.Untrusted -> {}
|
is LoadResult.Untrusted -> {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
|||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
import eu.kanade.tachiyomi.ui.category.CategoryAdapter
|
import eu.kanade.tachiyomi.ui.category.CategoryAdapter
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.view.inflate
|
import eu.kanade.tachiyomi.util.view.inflate
|
||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
|
@ -4,10 +4,8 @@ import android.animation.ObjectAnimator
|
|||||||
import android.app.SearchManager
|
import android.app.SearchManager
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.content.res.Resources
|
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.graphics.Typeface
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@ -17,11 +15,6 @@ import android.webkit.WebView
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
|
|
||||||
import androidx.appcompat.app.AppCompatDelegate.setDefaultNightMode
|
|
||||||
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
|
import androidx.appcompat.graphics.drawable.DrawerArrowDrawable
|
||||||
import androidx.biometric.BiometricManager
|
import androidx.biometric.BiometricManager
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
@ -53,7 +46,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
|||||||
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
import eu.kanade.tachiyomi.ui.recent_updates.RecentChaptersController
|
||||||
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
import eu.kanade.tachiyomi.ui.recently_read.RecentlyReadController
|
||||||
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
import eu.kanade.tachiyomi.ui.setting.SettingsMainController
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
package eu.kanade.tachiyomi.ui.migration
|
package eu.kanade.tachiyomi.ui.migration
|
||||||
|
|
||||||
import android.app.Dialog
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
|
||||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||||
import eu.davidea.flexibleadapter.items.IFlexible
|
import eu.davidea.flexibleadapter.items.IFlexible
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
@ -13,15 +10,13 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
|||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag
|
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||||
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
|
import eu.kanade.tachiyomi.ui.migration.manga.design.PreMigrationController
|
||||||
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController
|
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationListController
|
||||||
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
|
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
|
||||||
import eu.kanade.tachiyomi.util.await
|
import eu.kanade.tachiyomi.util.await
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationProcedureConfig
|
import eu.kanade.tachiyomi.ui.migration.manga.process.MigrationProcedureConfig
|
||||||
import kotlinx.android.synthetic.main.migration_controller.*
|
import kotlinx.android.synthetic.main.migration_controller.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@ -128,17 +123,20 @@ class MigrationController : NucleusController<MigrationPresenter>(),
|
|||||||
|
|
||||||
launchUI {
|
launchUI {
|
||||||
val manga = Injekt.get<DatabaseHelper>().getFavoriteMangas().asRxSingle().await(
|
val manga = Injekt.get<DatabaseHelper>().getFavoriteMangas().asRxSingle().await(
|
||||||
Schedulers.io())
|
Schedulers.io()
|
||||||
val sourceMangas = manga.asSequence().filter { it.source == item.source.id }.map { it.id!! }.toList()
|
)
|
||||||
|
val sourceMangas =
|
||||||
|
manga.asSequence().filter { it.source == item.source.id }.map { it.id!! }.toList()
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
router.pushController(
|
router.pushController(
|
||||||
if (Injekt.get<PreferencesHelper>().skipPreMigration().getOrDefault()) {
|
if (Injekt.get<PreferencesHelper>().skipPreMigration().getOrDefault()) {
|
||||||
MigrationListController.create(
|
MigrationListController.create(
|
||||||
MigrationProcedureConfig( sourceMangas, null)
|
MigrationProcedureConfig(sourceMangas, null)
|
||||||
)
|
)
|
||||||
}
|
} else {
|
||||||
else { PreMigrationController.create(sourceMangas) }
|
PreMigrationController.create(sourceMangas)
|
||||||
.withFadeTransaction())
|
}.withFadeTransaction()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ import eu.kanade.tachiyomi.ui.migration.MigrationMangaDialog
|
|||||||
import eu.kanade.tachiyomi.ui.migration.SearchController
|
import eu.kanade.tachiyomi.ui.migration.SearchController
|
||||||
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
|
import eu.kanade.tachiyomi.util.view.RecyclerWindowInsetsListener
|
||||||
import eu.kanade.tachiyomi.util.await
|
import eu.kanade.tachiyomi.util.await
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
import eu.kanade.tachiyomi.util.chapter.syncChaptersWithSource
|
||||||
import eu.kanade.tachiyomi.util.system.toast
|
import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.android.synthetic.main.chapters_controller.*
|
import kotlinx.android.synthetic.main.chapters_controller.*
|
||||||
@ -274,8 +274,9 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
val res = resources
|
val res = resources
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
activity?.toast(
|
activity?.toast(
|
||||||
res.getQuantityString(R.plurals.manga_migrated,
|
res.getQuantityString(
|
||||||
manaulMigrations, manaulMigrations)
|
R.plurals.manga_migrated, manaulMigrations, manaulMigrations
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
router.popCurrentController()
|
router.popCurrentController()
|
||||||
@ -319,8 +320,7 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
syncChaptersWithSource(db, chapters, localManga, source)
|
syncChaptersWithSource(db, chapters, localManga, source)
|
||||||
}
|
} catch (e: Exception) {
|
||||||
catch (e: Exception) {
|
|
||||||
return@async null
|
return@async null
|
||||||
}
|
}
|
||||||
localManga
|
localManga
|
||||||
@ -343,8 +343,7 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
|||||||
migratingManga.manga.migrationStatus = MigrationStatus.MANGA_FOUND
|
migratingManga.manga.migrationStatus = MigrationStatus.MANGA_FOUND
|
||||||
migratingManga.manga.searchResult.set(result.id)
|
migratingManga.manga.searchResult.set(result.id)
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
migratingManga.manga.migrationStatus = MigrationStatus.MANGA_NOT_FOUND
|
migratingManga.manga.migrationStatus = MigrationStatus.MANGA_NOT_FOUND
|
||||||
activity?.toast(R.string.error_fetching_migration, Toast.LENGTH_LONG)
|
activity?.toast(R.string.error_fetching_migration, Toast.LENGTH_LONG)
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
|
@ -9,10 +9,9 @@ import eu.kanade.tachiyomi.data.database.models.MangaCategory
|
|||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||||
import eu.kanade.tachiyomi.ui.migration.MigrationFlags
|
import eu.kanade.tachiyomi.ui.migration.MigrationFlags
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.cancel
|
import kotlinx.coroutines.cancel
|
||||||
import kotlinx.coroutines.isActive
|
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
@ -75,8 +74,9 @@ class MigrationProcessAdapter(
|
|||||||
launchUI {
|
launchUI {
|
||||||
val manga = getItem(position)?.manga ?: return@launchUI
|
val manga = getItem(position)?.manga ?: return@launchUI
|
||||||
db.inTransaction {
|
db.inTransaction {
|
||||||
val toMangaObj = db.getManga(manga.searchResult.get() ?: return@launchUI).executeAsBlocking()
|
val toMangaObj =
|
||||||
?: return@launchUI
|
db.getManga(manga.searchResult.get() ?: return@launchUI).executeAsBlocking()
|
||||||
|
?: return@launchUI
|
||||||
migrateMangaInternal(
|
migrateMangaInternal(
|
||||||
manga.manga() ?: return@launchUI, toMangaObj, !copy
|
manga.manga() ?: return@launchUI, toMangaObj, !copy
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,7 @@ import eu.kanade.tachiyomi.ui.manga.MangaController
|
|||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
import eu.kanade.tachiyomi.util.view.invisible
|
import eu.kanade.tachiyomi.util.view.invisible
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||||
import eu.kanade.tachiyomi.util.view.visible
|
import eu.kanade.tachiyomi.util.view.visible
|
||||||
import kotlinx.android.synthetic.main.migration_manga_card.view.*
|
import kotlinx.android.synthetic.main.migration_manga_card.view.*
|
||||||
@ -49,10 +49,14 @@ class MigrationProcessHolder(
|
|||||||
val manga = item.manga.manga()
|
val manga = item.manga.manga()
|
||||||
val source = item.manga.mangaSource()
|
val source = item.manga.mangaSource()
|
||||||
|
|
||||||
migration_menu.setVectorCompat(R.drawable.ic_more_vert_black_24dp, view.context
|
migration_menu.setVectorCompat(
|
||||||
.getResourceColor(R.attr.icon_color))
|
R.drawable.ic_more_vert_black_24dp, view.context.getResourceColor(R.attr.icon_color)
|
||||||
skip_manga.setVectorCompat(R.drawable.ic_close_white_24dp, view.context.getResourceColor(R
|
)
|
||||||
.attr.icon_color))
|
skip_manga.setVectorCompat(
|
||||||
|
R.drawable.ic_close_white_24dp, view.context.getResourceColor(
|
||||||
|
R.attr.icon_color
|
||||||
|
)
|
||||||
|
)
|
||||||
migration_menu.invisible()
|
migration_menu.invisible()
|
||||||
skip_manga.visible()
|
skip_manga.visible()
|
||||||
migration_manga_card_to.resetManga()
|
migration_manga_card_to.resetManga()
|
||||||
@ -62,8 +66,7 @@ class MigrationProcessHolder(
|
|||||||
migration_manga_card_from.setOnClickListener {
|
migration_manga_card_from.setOnClickListener {
|
||||||
adapter.controller.router.pushController(
|
adapter.controller.router.pushController(
|
||||||
MangaController(
|
MangaController(
|
||||||
manga,
|
manga, true
|
||||||
true
|
|
||||||
).withFadeTransaction()
|
).withFadeTransaction()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -87,8 +90,7 @@ class MigrationProcessHolder(
|
|||||||
sourceManager.get(it)
|
sourceManager.get(it)
|
||||||
}
|
}
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
if (item.manga.mangaId != this@MigrationProcessHolder.item?.manga?.mangaId ||
|
if (item.manga.mangaId != this@MigrationProcessHolder.item?.manga?.mangaId || item.manga.migrationStatus == MigrationStatus.RUNNUNG) {
|
||||||
item.manga.migrationStatus == MigrationStatus.RUNNUNG) {
|
|
||||||
return@withContext
|
return@withContext
|
||||||
}
|
}
|
||||||
if (searchResult != null && resultSource != null) {
|
if (searchResult != null && resultSource != null) {
|
||||||
@ -102,8 +104,8 @@ class MigrationProcessHolder(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
migration_manga_card_to.loading_group.gone()
|
migration_manga_card_to.loading_group.gone()
|
||||||
migration_manga_card_to.title.text = view.context.applicationContext
|
migration_manga_card_to.title.text =
|
||||||
.getString(R.string.no_alternatives_found)
|
view.context.applicationContext.getString(R.string.no_alternatives_found)
|
||||||
}
|
}
|
||||||
migration_menu.visible()
|
migration_menu.visible()
|
||||||
skip_manga.gone()
|
skip_manga.gone()
|
||||||
|
@ -45,7 +45,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.L2RPagerViewer
|
|||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.VerticalPagerViewer
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.lang.plusAssign
|
import eu.kanade.tachiyomi.util.lang.plusAssign
|
||||||
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
import eu.kanade.tachiyomi.util.storage.getUriCompat
|
||||||
import eu.kanade.tachiyomi.util.system.GLUtil
|
import eu.kanade.tachiyomi.util.system.GLUtil
|
||||||
|
@ -35,7 +35,7 @@ import eu.kanade.tachiyomi.source.model.Page
|
|||||||
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
import eu.kanade.tachiyomi.ui.reader.model.ReaderPage
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar
|
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderProgressBar
|
||||||
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType
|
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig.ZoomType
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import eu.kanade.tachiyomi.util.system.ImageUtil
|
import eu.kanade.tachiyomi.util.system.ImageUtil
|
||||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||||
import eu.kanade.tachiyomi.util.view.gone
|
import eu.kanade.tachiyomi.util.view.gone
|
||||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.setting
|
|||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import android.view.View
|
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
@ -14,12 +13,11 @@ import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
|||||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Target
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
|
||||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||||
import eu.kanade.tachiyomi.source.SourceManager
|
import eu.kanade.tachiyomi.source.SourceManager
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||||
import eu.kanade.tachiyomi.ui.library.LibraryController
|
import eu.kanade.tachiyomi.ui.library.LibraryController
|
||||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
import eu.kanade.tachiyomi.util.system.launchUI
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -105,8 +103,13 @@ class SettingsAdvancedController : SettingsController() {
|
|||||||
}
|
}
|
||||||
launchUI {
|
launchUI {
|
||||||
val activity = activity ?: return@launchUI
|
val activity = activity ?: return@launchUI
|
||||||
val cleanupString = if (foldersCleared == 0) activity.getString(R.string.no_cleanup_done)
|
val cleanupString =
|
||||||
else resources!!.getQuantityString(R.plurals.cleanup_done, foldersCleared, foldersCleared)
|
if (foldersCleared == 0) activity.getString(R.string.no_cleanup_done)
|
||||||
|
else resources!!.getQuantityString(
|
||||||
|
R.plurals.cleanup_done,
|
||||||
|
foldersCleared,
|
||||||
|
foldersCleared
|
||||||
|
)
|
||||||
activity.toast(cleanupString, Toast.LENGTH_LONG)
|
activity.toast(cleanupString, Toast.LENGTH_LONG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package eu.kanade.tachiyomi.util.lang
|
package eu.kanade.tachiyomi.util.system
|
||||||
|
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
Loading…
x
Reference in New Issue
Block a user