Improving genre search started from the manga page of a popular manga (#4375)

Co-authored-by: E3FxGaming <E3FxGaming@users.noreply.github.com>
This commit is contained in:
arkon
2021-07-10 16:04:28 -04:00
parent 1ef7722504
commit 62955e7385
3 changed files with 74 additions and 2 deletions
@@ -638,6 +638,29 @@ class MangaController :
}
}
/**
* Performs a genre search using the provided genre name.
*
* @param genreName the search genre to the parent controller
*/
fun performGenreSearch(genreName: String) {
if (router.backstackSize < 2) {
return
}
val previousController = router.backstack[router.backstackSize - 2].controller
val presenterSource = presenter.source
if (previousController is BrowseSourceController &&
presenterSource is HttpSource
) {
router.handleBack()
previousController.searchWithGenre(genreName)
} else {
performSearch(genreName)
}
}
private fun shareCover() {
try {
val activity = activity!!
@@ -262,11 +262,11 @@ class MangaInfoHeaderAdapter(
if (!manga.genre.isNullOrBlank()) {
binding.mangaGenresTagsCompactChips.setChips(
manga.getGenres(),
controller::performSearch
controller::performGenreSearch
)
binding.mangaGenresTagsFullChips.setChips(
manga.getGenres(),
controller::performSearch
controller::performGenreSearch
)
} else {
binding.mangaGenresTagsCompactChips.isVisible = false