mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Fixed crash when rapidly trying to skip manga
(cherry picked from commit 14c80436fcb92d22f0691b7b68caf524fd09cab5)
This commit is contained in:
		| @@ -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() { | ||||
|   | ||||
| @@ -34,7 +34,7 @@ class MigrationProcessAdapter( | ||||
|     interface MigrationProcessInterface { | ||||
|         fun onMenuItemClick(position: Int, item: MenuItem) | ||||
|         fun enableButtons() | ||||
|         fun removeManga(position: Int) | ||||
|         fun removeManga(item: MigrationProcessItem) | ||||
|         fun noMigration() | ||||
|     } | ||||
|  | ||||
| @@ -82,8 +82,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() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user