mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 03:11:53 +01:00
Upping to conductor v3.0.0
Had to fork off conductor-support-preference to up that to 3.0.0 as well. @arkon if you want I can submit a pr for main/conductor-support-preference for this but I'm just validating all is fine first (also I dont need the viepager library so it's easier for me to it), still double checking if it's all good first anyway
This commit is contained in:
parent
59c98f03d5
commit
dbc3d335a0
@ -227,11 +227,9 @@ dependencies {
|
|||||||
implementation("com.getkeepsafe.taptargetview:taptargetview:1.13.0")
|
implementation("com.getkeepsafe.taptargetview:taptargetview:1.13.0")
|
||||||
|
|
||||||
// Conductor
|
// Conductor
|
||||||
implementation("com.bluelinelabs:conductor:2.1.5")
|
val conductorVersion = "3.0.0"
|
||||||
implementation("com.bluelinelabs:conductor-support:2.1.5") {
|
implementation("com.bluelinelabs:conductor:$conductorVersion")
|
||||||
exclude("group", "com.android.support")
|
implementation("com.github.jays2kings:conductor-support-preference:3.0.0")
|
||||||
}
|
|
||||||
implementation("com.github.tachiyomiorg:conductor-support-preference:2.0.0")
|
|
||||||
|
|
||||||
// RxBindings
|
// RxBindings
|
||||||
implementation("com.jakewharton.rxbinding:rxbinding-kotlin:${Versions.RX_BINDING}")
|
implementation("com.jakewharton.rxbinding:rxbinding-kotlin:${Versions.RX_BINDING}")
|
||||||
|
@ -11,7 +11,6 @@ import androidx.viewbinding.ViewBinding
|
|||||||
import com.bluelinelabs.conductor.Controller
|
import com.bluelinelabs.conductor.Controller
|
||||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
import com.bluelinelabs.conductor.ControllerChangeType
|
import com.bluelinelabs.conductor.ControllerChangeType
|
||||||
import com.bluelinelabs.conductor.RestoreViewOnCreateController
|
|
||||||
import eu.kanade.tachiyomi.util.view.removeQueryListener
|
import eu.kanade.tachiyomi.util.view.removeQueryListener
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
@ -19,7 +18,7 @@ import kotlinx.coroutines.cancel
|
|||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
|
|
||||||
abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
||||||
RestoreViewOnCreateController(bundle) {
|
Controller(bundle) {
|
||||||
|
|
||||||
lateinit var binding: VB
|
lateinit var binding: VB
|
||||||
lateinit var viewScope: CoroutineScope
|
lateinit var viewScope: CoroutineScope
|
||||||
@ -73,7 +72,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
val onRoot: Boolean
|
val onRoot: Boolean
|
||||||
get() = router.backstack.lastOrNull()?.controller() == this
|
get() = router.backstack.lastOrNull()?.controller == this
|
||||||
|
|
||||||
open fun getTitle(): String? {
|
open fun getTitle(): String? {
|
||||||
return null
|
return null
|
||||||
@ -93,7 +92,7 @@ abstract class BaseController<VB : ViewBinding>(bundle: Bundle? = null) :
|
|||||||
parentController = parentController.parentController
|
parentController = parentController.parentController
|
||||||
}
|
}
|
||||||
|
|
||||||
if (router.backstack.lastOrNull()?.controller() == this) {
|
if (router.backstack.lastOrNull()?.controller == this) {
|
||||||
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
(activity as? AppCompatActivity)?.supportActionBar?.title = getTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.bluelinelabs.conductor.RestoreViewOnCreateController
|
import com.bluelinelabs.conductor.Controller
|
||||||
import com.bluelinelabs.conductor.Router
|
import com.bluelinelabs.conductor.Router
|
||||||
import com.bluelinelabs.conductor.RouterTransaction
|
import com.bluelinelabs.conductor.RouterTransaction
|
||||||
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
||||||
@ -17,7 +17,7 @@ import com.bluelinelabs.conductor.changehandler.SimpleSwapChangeHandler
|
|||||||
*
|
*
|
||||||
* Implementations should override this class and implement [.onCreateDialog] to create a custom dialog, such as an [android.app.AlertDialog]
|
* Implementations should override this class and implement [.onCreateDialog] to create a custom dialog, such as an [android.app.AlertDialog]
|
||||||
*/
|
*/
|
||||||
abstract class DialogController : RestoreViewOnCreateController {
|
abstract class DialogController : Controller {
|
||||||
|
|
||||||
protected var dialog: Dialog? = null
|
protected var dialog: Dialog? = null
|
||||||
private set
|
private set
|
||||||
|
@ -110,7 +110,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
private val downloadManager: DownloadManager by injectLazy()
|
private val downloadManager: DownloadManager by injectLazy()
|
||||||
private val mangaShortcutManager: MangaShortcutManager by injectLazy()
|
private val mangaShortcutManager: MangaShortcutManager by injectLazy()
|
||||||
private val hideBottomNav
|
private val hideBottomNav
|
||||||
get() = router.backstackSize > 1 && router.backstack[1].controller() !is DialogController
|
get() = router.backstackSize > 1 && router.backstack[1].controller !is DialogController
|
||||||
|
|
||||||
private val updateChecker by lazy { UpdateChecker.getUpdateChecker() }
|
private val updateChecker by lazy { UpdateChecker.getUpdateChecker() }
|
||||||
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
|
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
|
||||||
@ -190,7 +190,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
binding.bottomNav.selectedItemId = id
|
binding.bottomNav.selectedItemId = id
|
||||||
binding.bottomNav.post {
|
binding.bottomNav.post {
|
||||||
val controller =
|
val controller =
|
||||||
router.backstack.firstOrNull()?.controller() as? BottomSheetController
|
router.backstack.firstOrNull()?.controller as? BottomSheetController
|
||||||
controller?.showSheet()
|
controller?.showSheet()
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
@ -198,7 +198,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
binding.bottomNav.setOnNavigationItemSelectedListener { item ->
|
binding.bottomNav.setOnNavigationItemSelectedListener { item ->
|
||||||
val id = item.itemId
|
val id = item.itemId
|
||||||
val currentController = router.backstack.lastOrNull()?.controller()
|
val currentController = router.backstack.lastOrNull()?.controller
|
||||||
if (!continueSwitchingTabs && currentController is BottomNavBarInterface) {
|
if (!continueSwitchingTabs && currentController is BottomNavBarInterface) {
|
||||||
if (!currentController.canChangeTabs {
|
if (!currentController.canChangeTabs {
|
||||||
continueSwitchingTabs = true
|
continueSwitchingTabs = true
|
||||||
@ -271,14 +271,14 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.toolbar.setNavigationOnClickListener {
|
binding.toolbar.setNavigationOnClickListener {
|
||||||
val rootSearchController = router.backstack.lastOrNull()?.controller()
|
val rootSearchController = router.backstack.lastOrNull()?.controller
|
||||||
if (rootSearchController is RootSearchInterface) {
|
if (rootSearchController is RootSearchInterface) {
|
||||||
rootSearchController.expandSearch()
|
rootSearchController.expandSearch()
|
||||||
} else onBackPressed()
|
} else onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.cardToolbar.setNavigationOnClickListener {
|
binding.cardToolbar.setNavigationOnClickListener {
|
||||||
val rootSearchController = router.backstack.lastOrNull()?.controller()
|
val rootSearchController = router.backstack.lastOrNull()?.controller
|
||||||
if (rootSearchController is RootSearchInterface) {
|
if (rootSearchController is RootSearchInterface) {
|
||||||
rootSearchController.expandSearch()
|
rootSearchController.expandSearch()
|
||||||
} else onBackPressed()
|
} else onBackPressed()
|
||||||
@ -322,11 +322,11 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
syncActivityViewWithController(router.backstack.lastOrNull()?.controller())
|
syncActivityViewWithController(router.backstack.lastOrNull()?.controller)
|
||||||
|
|
||||||
binding.toolbar.navigationIcon = if (router.backstackSize > 1) drawerArrow else searchDrawable
|
binding.toolbar.navigationIcon = if (router.backstackSize > 1) drawerArrow else searchDrawable
|
||||||
(router.backstack.lastOrNull()?.controller() as? BaseController<*>)?.setTitle()
|
(router.backstack.lastOrNull()?.controller as? BaseController<*>)?.setTitle()
|
||||||
(router.backstack.lastOrNull()?.controller() as? SettingsController)?.setTitle()
|
(router.backstack.lastOrNull()?.controller as? SettingsController)?.setTitle()
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
// Show changelog if needed
|
// Show changelog if needed
|
||||||
@ -348,7 +348,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
binding.cardToolbar.setIncognitoMode(it)
|
binding.cardToolbar.setIncognitoMode(it)
|
||||||
}
|
}
|
||||||
setExtensionsBadge()
|
setExtensionsBadge()
|
||||||
setFloatingToolbar(canShowFloatingToolbar(router.backstack.lastOrNull()?.controller()))
|
setFloatingToolbar(canShowFloatingToolbar(router.backstack.lastOrNull()?.controller))
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun setFloatingToolbar(show: Boolean, solidBG: Boolean = false) {
|
open fun setFloatingToolbar(show: Boolean, solidBG: Boolean = false) {
|
||||||
@ -367,7 +367,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
if (show && !solidBG) Color.TRANSPARENT else getResourceColor(R.attr.colorSecondary)
|
if (show && !solidBG) Color.TRANSPARENT else getResourceColor(R.attr.colorSecondary)
|
||||||
)
|
)
|
||||||
currentToolbar?.setNavigationOnClickListener {
|
currentToolbar?.setNavigationOnClickListener {
|
||||||
val rootSearchController = router.backstack.lastOrNull()?.controller()
|
val rootSearchController = router.backstack.lastOrNull()?.controller
|
||||||
if (rootSearchController is RootSearchInterface) {
|
if (rootSearchController is RootSearchInterface) {
|
||||||
rootSearchController.expandSearch()
|
rootSearchController.expandSearch()
|
||||||
} else onBackPressed()
|
} else onBackPressed()
|
||||||
@ -549,7 +549,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
binding.bottomNav.post {
|
binding.bottomNav.post {
|
||||||
val controller =
|
val controller =
|
||||||
router.backstack.firstOrNull()?.controller() as? RecentsController
|
router.backstack.firstOrNull()?.controller as? RecentsController
|
||||||
controller?.tempJumpTo(
|
controller?.tempJumpTo(
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
SHORTCUT_RECENTLY_UPDATED -> RecentsPresenter.VIEW_TYPE_ONLY_UPDATES
|
SHORTCUT_RECENTLY_UPDATED -> RecentsPresenter.VIEW_TYPE_ONLY_UPDATES
|
||||||
@ -567,7 +567,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
binding.bottomNav.post {
|
binding.bottomNav.post {
|
||||||
val controller =
|
val controller =
|
||||||
router.backstack.firstOrNull()?.controller() as? BrowseController
|
router.backstack.firstOrNull()?.controller as? BrowseController
|
||||||
controller?.showSheet()
|
controller?.showSheet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -579,7 +579,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
SHORTCUT_UPDATE_NOTES -> {
|
SHORTCUT_UPDATE_NOTES -> {
|
||||||
val extras = intent.extras ?: return false
|
val extras = intent.extras ?: return false
|
||||||
if (router.backstack.isEmpty()) binding.bottomNav.selectedItemId = R.id.nav_library
|
if (router.backstack.isEmpty()) binding.bottomNav.selectedItemId = R.id.nav_library
|
||||||
if (router.backstack.lastOrNull()?.controller() !is AboutController.NewUpdateDialogController) {
|
if (router.backstack.lastOrNull()?.controller !is AboutController.NewUpdateDialogController) {
|
||||||
AboutController.NewUpdateDialogController(extras).showDialog(router)
|
AboutController.NewUpdateDialogController(extras).showDialog(router)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -593,7 +593,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
router.popToRoot()
|
router.popToRoot()
|
||||||
binding.bottomNav.post {
|
binding.bottomNav.post {
|
||||||
val controller =
|
val controller =
|
||||||
router.backstack.firstOrNull()?.controller() as? RecentsController
|
router.backstack.firstOrNull()?.controller as? RecentsController
|
||||||
controller?.showSheet()
|
controller?.showSheet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -614,7 +614,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
val sheetController = router.backstack.last().controller() as? BottomSheetController
|
val sheetController = router.backstack.last().controller as? BottomSheetController
|
||||||
if (if (router.backstackSize == 1) !(sheetController?.handleSheetBack() ?: false)
|
if (if (router.backstackSize == 1) !(sheetController?.handleSheetBack() ?: false)
|
||||||
else !router.handleBack()
|
else !router.handleBack()
|
||||||
) {
|
) {
|
||||||
@ -874,7 +874,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
diffY <= 0
|
diffY <= 0
|
||||||
) {
|
) {
|
||||||
val bottomSheetController =
|
val bottomSheetController =
|
||||||
router.backstack.lastOrNull()?.controller() as? BottomSheetController
|
router.backstack.lastOrNull()?.controller as? BottomSheetController
|
||||||
bottomSheetController?.showSheet()
|
bottomSheetController?.showSheet()
|
||||||
}
|
}
|
||||||
result = true
|
result = true
|
||||||
|
@ -28,8 +28,8 @@ class SearchActivity : MainActivity() {
|
|||||||
binding.cardToolbar.navigationIcon = drawerArrow
|
binding.cardToolbar.navigationIcon = drawerArrow
|
||||||
binding.toolbar.setNavigationOnClickListener { popToRoot() }
|
binding.toolbar.setNavigationOnClickListener { popToRoot() }
|
||||||
binding.cardToolbar.setNavigationOnClickListener { popToRoot() }
|
binding.cardToolbar.setNavigationOnClickListener { popToRoot() }
|
||||||
(router.backstack.lastOrNull()?.controller() as? BaseController<*>)?.setTitle()
|
(router.backstack.lastOrNull()?.controller as? BaseController<*>)?.setTitle()
|
||||||
(router.backstack.lastOrNull()?.controller() as? SettingsController)?.setTitle()
|
(router.backstack.lastOrNull()?.controller as? SettingsController)?.setTitle()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
|
@ -284,7 +284,7 @@ class MangaDetailsController :
|
|||||||
if (isColor == toolbarIsColored) return
|
if (isColor == toolbarIsColored) return
|
||||||
toolbarIsColored = isColor
|
toolbarIsColored = isColor
|
||||||
val isCurrentController =
|
val isCurrentController =
|
||||||
router?.backstack?.lastOrNull()?.controller() == this@MangaDetailsController
|
router?.backstack?.lastOrNull()?.controller == this@MangaDetailsController
|
||||||
if (isCurrentController) setTitle()
|
if (isCurrentController) setTitle()
|
||||||
if (actionMode != null) {
|
if (actionMode != null) {
|
||||||
activityBinding?.toolbar?.setBackgroundColor(Color.TRANSPARENT)
|
activityBinding?.toolbar?.setBackgroundColor(Color.TRANSPARENT)
|
||||||
@ -421,7 +421,7 @@ class MangaDetailsController :
|
|||||||
}
|
}
|
||||||
// fetch cover again in case the user set a new cover while reading
|
// fetch cover again in case the user set a new cover while reading
|
||||||
setPaletteColor()
|
setPaletteColor()
|
||||||
val isCurrentController = router?.backstack?.lastOrNull()?.controller() ==
|
val isCurrentController = router?.backstack?.lastOrNull()?.controller ==
|
||||||
this
|
this
|
||||||
if (isCurrentController) {
|
if (isCurrentController) {
|
||||||
setStatusBarAndToolbar()
|
setStatusBarAndToolbar()
|
||||||
@ -434,7 +434,7 @@ class MangaDetailsController :
|
|||||||
setActionBar(true)
|
setActionBar(true)
|
||||||
setStatusBarAndToolbar()
|
setStatusBarAndToolbar()
|
||||||
} else if (type == ControllerChangeType.PUSH_EXIT || type == ControllerChangeType.POP_EXIT) {
|
} else if (type == ControllerChangeType.PUSH_EXIT || type == ControllerChangeType.POP_EXIT) {
|
||||||
if (router.backstack.lastOrNull()?.controller() is DialogController) {
|
if (router.backstack.lastOrNull()?.controller is DialogController) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (type == ControllerChangeType.POP_EXIT) {
|
if (type == ControllerChangeType.POP_EXIT) {
|
||||||
@ -447,9 +447,9 @@ class MangaDetailsController :
|
|||||||
R.attr.colorSecondary
|
R.attr.colorSecondary
|
||||||
) ?: Color.BLACK
|
) ?: Color.BLACK
|
||||||
if (router.backstackSize > 0 &&
|
if (router.backstackSize > 0 &&
|
||||||
router.backstack.last().controller() !is MangaDetailsController
|
router.backstack.last().controller !is MangaDetailsController
|
||||||
) {
|
) {
|
||||||
if (router.backstack.last().controller() !is FloatingSearchInterface) {
|
if (router.backstack.last().controller !is FloatingSearchInterface) {
|
||||||
activityBinding?.appBar?.setBackgroundColor(colorSecondary)
|
activityBinding?.appBar?.setBackgroundColor(colorSecondary)
|
||||||
}
|
}
|
||||||
activityBinding?.toolbar?.setBackgroundColor(colorSecondary)
|
activityBinding?.toolbar?.setBackgroundColor(colorSecondary)
|
||||||
@ -1064,7 +1064,7 @@ class MangaDetailsController :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun tagClicked(text: String) {
|
override fun tagClicked(text: String) {
|
||||||
val firstController = router.backstack.first()?.controller()
|
val firstController = router.backstack.first()?.controller
|
||||||
if (firstController is LibraryController && router.backstack.size == 2) {
|
if (firstController is LibraryController && router.backstack.size == 2) {
|
||||||
router.handleBack()
|
router.handleBack()
|
||||||
firstController.search(text)
|
firstController.search(text)
|
||||||
|
@ -273,7 +273,7 @@ class MigrationListController(bundle: Bundle? = null) :
|
|||||||
|
|
||||||
override fun updateCount() {
|
override fun updateCount() {
|
||||||
launchUI {
|
launchUI {
|
||||||
if (router.backstack.last().controller() == this@MigrationListController) {
|
if (router.backstack.last().controller == this@MigrationListController) {
|
||||||
setTitle()
|
setTitle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,16 +407,16 @@ class MigrationListController(bundle: Bundle? = null) :
|
|||||||
private fun navigateOut() {
|
private fun navigateOut() {
|
||||||
if (migratingManga?.size == 1) {
|
if (migratingManga?.size == 1) {
|
||||||
launchUI {
|
launchUI {
|
||||||
val hasDetails = router.backstack.any { it.controller() is MangaDetailsController }
|
val hasDetails = router.backstack.any { it.controller is MangaDetailsController }
|
||||||
if (hasDetails) {
|
if (hasDetails) {
|
||||||
val manga = migratingManga?.firstOrNull()?.searchResult?.get()?.let {
|
val manga = migratingManga?.firstOrNull()?.searchResult?.get()?.let {
|
||||||
db.getManga(it).executeOnIO()
|
db.getManga(it).executeOnIO()
|
||||||
}
|
}
|
||||||
if (manga != null) {
|
if (manga != null) {
|
||||||
val newStack = router.backstack.filter {
|
val newStack = router.backstack.filter {
|
||||||
it.controller() !is MangaDetailsController &&
|
it.controller !is MangaDetailsController &&
|
||||||
it.controller() !is MigrationListController &&
|
it.controller !is MigrationListController &&
|
||||||
it.controller() !is PreMigrationController
|
it.controller !is PreMigrationController
|
||||||
} + MangaDetailsController(manga).withFadeTransaction()
|
} + MangaDetailsController(manga).withFadeTransaction()
|
||||||
router.setBackstack(newStack, FadeChangeHandler())
|
router.setBackstack(newStack, FadeChangeHandler())
|
||||||
return@launchUI
|
return@launchUI
|
||||||
|
@ -642,7 +642,7 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (type == ControllerChangeType.POP_EXIT) presenter.onDestroy()
|
if (type == ControllerChangeType.POP_EXIT) presenter.onDestroy()
|
||||||
if (router.backstack.lastOrNull()?.controller() !is DialogController) {
|
if (router.backstack.lastOrNull()?.controller !is DialogController) {
|
||||||
(activity as? MainActivity)?.showTabBar(false)
|
(activity as? MainActivity)?.showTabBar(false)
|
||||||
}
|
}
|
||||||
snack?.dismiss()
|
snack?.dismiss()
|
||||||
|
@ -175,7 +175,7 @@ class SettingsSourcesController : SettingsController() {
|
|||||||
searchView.clearFocus()
|
searchView.clearFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
searchView.queryTextChanges().filter { router.backstack.lastOrNull()?.controller() == this }
|
searchView.queryTextChanges().filter { router.backstack.lastOrNull()?.controller == this }
|
||||||
.subscribeUntilDestroy {
|
.subscribeUntilDestroy {
|
||||||
query = it.toString()
|
query = it.toString()
|
||||||
drawSources()
|
drawSources()
|
||||||
|
@ -218,7 +218,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
|||||||
|
|
||||||
// val searchEventsObservable = searchView.queryTextChangeEvents()
|
// val searchEventsObservable = searchView.queryTextChangeEvents()
|
||||||
// .skip(1)
|
// .skip(1)
|
||||||
// .filter { router.backstack.lastOrNull()?.controller() == this@BrowseSourceController }
|
// .filter { router.backstack.lastOrNull()?.controller == this@BrowseSourceController }
|
||||||
// .share()
|
// .share()
|
||||||
// val writingObservable = searchEventsObservable
|
// val writingObservable = searchEventsObservable
|
||||||
// .filter { !it.isSubmitted }
|
// .filter { !it.isSubmitted }
|
||||||
@ -239,7 +239,7 @@ open class BrowseSourceController(bundle: Bundle) :
|
|||||||
searchItem.fixExpand(
|
searchItem.fixExpand(
|
||||||
onExpand = { invalidateMenuOnExpand() },
|
onExpand = { invalidateMenuOnExpand() },
|
||||||
onCollapse = {
|
onCollapse = {
|
||||||
if (router.backstackSize >= 2 && router.backstack[router.backstackSize - 2].controller() is GlobalSearchController) {
|
if (router.backstackSize >= 2 && router.backstack[router.backstackSize - 2].controller is GlobalSearchController) {
|
||||||
router.popController(this)
|
router.popController(this)
|
||||||
} else {
|
} else {
|
||||||
searchWithQuery("")
|
searchWithQuery("")
|
||||||
|
@ -49,7 +49,7 @@ fun Controller.setOnQueryTextChangeListener(
|
|||||||
object : SearchView.OnQueryTextListener {
|
object : SearchView.OnQueryTextListener {
|
||||||
override fun onQueryTextChange(newText: String?): Boolean {
|
override fun onQueryTextChange(newText: String?): Boolean {
|
||||||
if (!onlyOnSubmit && router.backstack.lastOrNull()
|
if (!onlyOnSubmit && router.backstack.lastOrNull()
|
||||||
?.controller() == this@setOnQueryTextChangeListener
|
?.controller == this@setOnQueryTextChangeListener
|
||||||
) {
|
) {
|
||||||
return f(newText)
|
return f(newText)
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ fun Controller.setOnQueryTextChangeListener(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onQueryTextSubmit(query: String?): Boolean {
|
override fun onQueryTextSubmit(query: String?): Boolean {
|
||||||
if (router.backstack.lastOrNull()?.controller() == this@setOnQueryTextChangeListener) {
|
if (router.backstack.lastOrNull()?.controller == this@setOnQueryTextChangeListener) {
|
||||||
if (hideKbOnSubmit) {
|
if (hideKbOnSubmit) {
|
||||||
val imm =
|
val imm =
|
||||||
activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
activity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager
|
||||||
@ -147,7 +147,7 @@ fun Controller.liftAppbarWith(recycler: RecyclerView, padView: Boolean = false)
|
|||||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
super.onScrolled(recyclerView, dx, dy)
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
if (router?.backstack?.lastOrNull()
|
if (router?.backstack?.lastOrNull()
|
||||||
?.controller() == this@liftAppbarWith && activity != null
|
?.controller == this@liftAppbarWith && activity != null
|
||||||
) {
|
) {
|
||||||
val notAtTop = recycler.canScrollVertically(-1)
|
val notAtTop = recycler.canScrollVertically(-1)
|
||||||
if (notAtTop != elevate) elevateFunc(notAtTop)
|
if (notAtTop != elevate) elevateFunc(notAtTop)
|
||||||
@ -286,7 +286,7 @@ fun Controller.scrollViewWith(
|
|||||||
if (!customPadding && lastY == 0f && (
|
if (!customPadding && lastY == 0f && (
|
||||||
(
|
(
|
||||||
this@scrollViewWith !is FloatingSearchInterface && router.backstack.lastOrNull()
|
this@scrollViewWith !is FloatingSearchInterface && router.backstack.lastOrNull()
|
||||||
?.controller() is MangaDetailsController
|
?.controller is MangaDetailsController
|
||||||
) || includeTabView
|
) || includeTabView
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -332,7 +332,7 @@ fun Controller.scrollViewWith(
|
|||||||
super.onScrolled(recyclerView, dx, dy)
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
if (recyclerView.tag == MaterialFastScroll.noUpdate) return
|
if (recyclerView.tag == MaterialFastScroll.noUpdate) return
|
||||||
if (router?.backstack?.lastOrNull()
|
if (router?.backstack?.lastOrNull()
|
||||||
?.controller() == this@scrollViewWith && statusBarHeight > -1 &&
|
?.controller == this@scrollViewWith && statusBarHeight > -1 &&
|
||||||
activity != null && activityBinding!!.appBar.height > 0 &&
|
activity != null && activityBinding!!.appBar.height > 0 &&
|
||||||
recycler.translationY == 0f
|
recycler.translationY == 0f
|
||||||
) {
|
) {
|
||||||
@ -396,7 +396,7 @@ fun Controller.scrollViewWith(
|
|||||||
super.onScrollStateChanged(recyclerView, newState)
|
super.onScrollStateChanged(recyclerView, newState)
|
||||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
if (router?.backstack?.lastOrNull()
|
if (router?.backstack?.lastOrNull()
|
||||||
?.controller() == this@scrollViewWith && statusBarHeight > -1 &&
|
?.controller == this@scrollViewWith && statusBarHeight > -1 &&
|
||||||
activity != null && activityBinding!!.appBar.height > 0 &&
|
activity != null && activityBinding!!.appBar.height > 0 &&
|
||||||
recycler.translationY == 0f
|
recycler.translationY == 0f
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user