parent
47f14e8555
commit
8ebda219c4
@ -413,20 +413,17 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
|||||||
activity?.toast(activity?.getString(R.string.manga_added_library))
|
activity?.toast(activity?.getString(R.string.manga_added_library))
|
||||||
}
|
}
|
||||||
val categories = presenter.getCategories()
|
val categories = presenter.getCategories()
|
||||||
val defaultCategory = categories.find { it.id == preferences.defaultCategory() }
|
if (categories.size <= 1) {
|
||||||
when {
|
// default or the one from the user then just add to favorite.
|
||||||
defaultCategory != null -> presenter.moveMangaToCategory(manga, defaultCategory)
|
presenter.moveMangaToCategory(manga, categories.firstOrNull())
|
||||||
categories.size <= 1 -> // default or the one from the user
|
} else {
|
||||||
presenter.moveMangaToCategory(manga, categories.firstOrNull())
|
val ids = presenter.getMangaCategoryIds(manga)
|
||||||
else -> {
|
val preselected = ids.mapNotNull { id ->
|
||||||
val ids = presenter.getMangaCategoryIds(manga)
|
categories.indexOfFirst { it.id == id }.takeIf { it != -1 }
|
||||||
val preselected = ids.mapNotNull { id ->
|
}.toTypedArray()
|
||||||
categories.indexOfFirst { it.id == id }.takeIf { it != -1 }
|
|
||||||
}.toTypedArray()
|
|
||||||
|
|
||||||
ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected)
|
ChangeMangaCategoriesDialog(this, listOf(manga), categories, preselected)
|
||||||
.showDialog(router)
|
.showDialog(router)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user