mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-12 21:35:18 +01:00
Global search from extensions intents no longer show search toolbar
Also fixed search toolbar up button in search activity not going back to main activity
This commit is contained in:
parent
797174843a
commit
94406f6480
@ -148,7 +148,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||
binding = MainActivityBinding.inflate(layoutInflater)
|
||||
|
||||
setContentView(binding.root)
|
||||
setFloatingToolbar(true)
|
||||
setFloatingToolbar(this !is SearchActivity)
|
||||
|
||||
drawerArrow = DrawerArrowDrawable(this)
|
||||
drawerArrow?.color = getResourceColor(R.attr.actionBarTintColor)
|
||||
@ -346,7 +346,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||
setExtensionsBadge()
|
||||
}
|
||||
|
||||
fun setFloatingToolbar(show: Boolean, solidBG: Boolean = false) {
|
||||
open fun setFloatingToolbar(show: Boolean, solidBG: Boolean = false) {
|
||||
val oldTB = currentToolbar
|
||||
currentToolbar = if (show) {
|
||||
binding.cardToolbar
|
||||
@ -654,7 +654,9 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||
val searchItem = menu?.findItem(R.id.action_search)
|
||||
searchItem?.isVisible = currentToolbar != binding.cardToolbar
|
||||
if (currentToolbar == binding.cardToolbar) {
|
||||
searchItem?.isVisible = false
|
||||
}
|
||||
return super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
@ -711,7 +713,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
||||
}
|
||||
|
||||
protected fun canShowFloatingToolbar(controller: Controller?) =
|
||||
controller is FloatingSearchInterface
|
||||
(controller is FloatingSearchInterface && controller.showFloatingBar())
|
||||
|
||||
protected open fun syncActivityViewWithController(
|
||||
to: Controller?,
|
||||
@ -910,6 +912,8 @@ interface FloatingSearchInterface {
|
||||
}
|
||||
return title
|
||||
}
|
||||
|
||||
fun showFloatingBar() = true
|
||||
}
|
||||
|
||||
interface BottomSheetController {
|
||||
|
@ -51,6 +51,11 @@ class SearchActivity : MainActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setFloatingToolbar(show: Boolean, solidBG: Boolean) {
|
||||
super.setFloatingToolbar(show, solidBG)
|
||||
currentToolbar?.setNavigationOnClickListener { popToRoot() }
|
||||
}
|
||||
|
||||
private fun intentShouldGoBack() =
|
||||
intent.action in listOf(SHORTCUT_MANGA, SHORTCUT_READER_SETTINGS, SHORTCUT_BROWSE)
|
||||
|
||||
|
@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.ui.main.FloatingSearchInterface
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.main.SearchActivity
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaDetailsController
|
||||
import eu.kanade.tachiyomi.ui.source.browse.BrowseSourceController
|
||||
import eu.kanade.tachiyomi.util.addOrRemoveToFavorites
|
||||
@ -26,6 +27,7 @@ import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.updatePaddingRelative
|
||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import kotlin.math.max
|
||||
|
||||
/**
|
||||
* This controller shows and manages the different search result in global search.
|
||||
@ -127,6 +129,11 @@ open class GlobalSearchController(
|
||||
}
|
||||
}
|
||||
|
||||
override fun showFloatingBar() =
|
||||
activity !is SearchActivity ||
|
||||
customTitle == null ||
|
||||
extensionFilter == null
|
||||
|
||||
/**
|
||||
* Adds items to the options menu.
|
||||
*
|
||||
@ -175,7 +182,7 @@ open class GlobalSearchController(
|
||||
adapter = GlobalSearchAdapter(this)
|
||||
|
||||
binding.recycler.updatePaddingRelative(
|
||||
top = (activityBinding?.toolbar?.height ?: 0) +
|
||||
top = max(activityBinding?.toolbar?.height ?: 0, (activityBinding?.cardToolbar?.height ?: 0)) +
|
||||
(activity?.window?.decorView?.rootWindowInsets?.systemWindowInsetTop ?: 0)
|
||||
)
|
||||
|
||||
@ -242,6 +249,7 @@ open class GlobalSearchController(
|
||||
)
|
||||
return
|
||||
} else if (results != null) {
|
||||
(activity as? SearchActivity)?.setFloatingToolbar(true)
|
||||
customTitle = null
|
||||
setTitle()
|
||||
activity?.invalidateOptionsMenu()
|
||||
|
Loading…
Reference in New Issue
Block a user