mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Fixed crash when rapidly trying to skip manga
This commit is contained in:
parent
e342d4960c
commit
14c80436fc
@ -17,6 +17,7 @@ import com.afollestad.materialdialogs.MaterialDialog
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.preference.getOrDefault
|
||||
import eu.kanade.tachiyomi.smartsearch.SmartSearchEngine
|
||||
@ -254,11 +255,16 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
|
||||
activity?.invalidateOptionsMenu()
|
||||
}
|
||||
|
||||
override fun removeManga(position: Int) {
|
||||
override fun removeManga(item: MigrationProcessItem) {
|
||||
val ids = config?.mangaIds?.toMutableList() ?: return
|
||||
ids.removeAt(position)
|
||||
migratingManga?.removeAt(position)
|
||||
config.mangaIds = ids
|
||||
val index = ids.indexOf(item.manga.mangaId)
|
||||
if (index > -1) {
|
||||
ids.removeAt(index)
|
||||
config.mangaIds = ids
|
||||
val index2 = migratingManga?.indexOf(item.manga) ?: return
|
||||
if (index2 > -1)
|
||||
migratingManga?.removeAt(index2)
|
||||
}
|
||||
}
|
||||
|
||||
override fun noMigration() {
|
||||
|
@ -36,7 +36,7 @@ class MigrationProcessAdapter(
|
||||
interface MigrationProcessInterface {
|
||||
fun onMenuItemClick(position: Int, item: MenuItem)
|
||||
fun enableButtons()
|
||||
fun removeManga(position: Int)
|
||||
fun removeManga(item: MigrationProcessItem)
|
||||
fun noMigration()
|
||||
}
|
||||
|
||||
@ -84,8 +84,9 @@ class MigrationProcessAdapter(
|
||||
}
|
||||
|
||||
fun removeManga(position: Int) {
|
||||
menuItemListener.removeManga(position)
|
||||
getItem(position)?.manga?.migrationJob?.cancel()
|
||||
val item = getItem(position) ?: return
|
||||
menuItemListener.removeManga(item)
|
||||
item?.manga?.migrationJob?.cancel()
|
||||
removeItem(position)
|
||||
items = currentItems
|
||||
sourceFinished()
|
||||
|
Loading…
Reference in New Issue
Block a user