From 71ece73d99ffc070741a6e121d2043954fbeab6e Mon Sep 17 00:00:00 2001 From: Clarence Castillo Date: Sat, 2 Jan 2021 05:46:44 +0800 Subject: [PATCH] Direct user back to global search when coming from source search results (#4196) --- .../ui/browse/source/browse/BrowseSourceController.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt index 22ed21e7a..28e2288ee 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt @@ -35,6 +35,7 @@ import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.ui.base.controller.FabController import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction +import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController import eu.kanade.tachiyomi.ui.library.ChangeMangaCategoriesDialog import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.manga.MangaController @@ -279,7 +280,12 @@ open class BrowseSourceController(bundle: Bundle) : searchItem.fixExpand( onExpand = { invalidateMenuOnExpand() }, onCollapse = { - searchWithQuery("") + if (router.backstackSize >= 2 && router.backstack[router.backstackSize - 2].controller() is GlobalSearchController) { + router.popController(this) + } else { + searchWithQuery("") + } + true } )