Lift toolbar on scroll in extension details and manga controllers
This commit is contained in:
parent
8db34eb3dd
commit
748a720199
5 changed files with 20 additions and 7 deletions
|
@ -0,0 +1,3 @@
|
|||
package eu.kanade.tachiyomi.ui.base.controller
|
||||
|
||||
interface ToolbarLiftOnScrollController
|
|
@ -34,8 +34,8 @@ import eu.kanade.tachiyomi.source.CatalogueSource
|
|||
import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.getPreferenceKey
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.NucleusController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.util.preference.DSL
|
||||
import eu.kanade.tachiyomi.util.preference.onChange
|
||||
|
@ -50,7 +50,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
@SuppressLint("RestrictedApi")
|
||||
class ExtensionDetailsController(bundle: Bundle? = null) :
|
||||
NucleusController<ExtensionDetailControllerBinding, ExtensionDetailsPresenter>(bundle),
|
||||
NoToolbarElevationController {
|
||||
ToolbarLiftOnScrollController {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import eu.kanade.tachiyomi.ui.base.controller.FabController
|
|||
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.TabbedController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.ToolbarLiftOnScrollController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.browse.BrowseController
|
||||
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchController
|
||||
|
@ -355,10 +356,16 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
|
|||
to.configureFab(binding.rootFab)
|
||||
}
|
||||
|
||||
if (to is NoToolbarElevationController) {
|
||||
binding.appbar.disableElevation()
|
||||
} else {
|
||||
binding.appbar.enableElevation()
|
||||
when (to) {
|
||||
is NoToolbarElevationController -> {
|
||||
binding.appbar.disableElevation()
|
||||
}
|
||||
is ToolbarLiftOnScrollController -> {
|
||||
binding.appbar.enableElevation(true)
|
||||
}
|
||||
else -> {
|
||||
binding.appbar.enableElevation(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ import eu.kanade.tachiyomi.source.SourceManager
|
|||
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.ToolbarLiftOnScrollController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.search.SearchController
|
||||
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceController
|
||||
|
@ -85,6 +86,7 @@ import uy.kohesive.injekt.injectLazy
|
|||
|
||||
class MangaController :
|
||||
NucleusController<MangaControllerBinding, MangaPresenter>,
|
||||
ToolbarLiftOnScrollController,
|
||||
FabController,
|
||||
ActionMode.Callback,
|
||||
FlexibleAdapter.OnItemClickListener,
|
||||
|
|
|
@ -18,8 +18,9 @@ class ElevationAppBarLayout @JvmOverloads constructor(
|
|||
origStateAnimator = stateListAnimator
|
||||
}
|
||||
|
||||
fun enableElevation() {
|
||||
fun enableElevation(liftOnScroll: Boolean) {
|
||||
stateListAnimator = origStateAnimator
|
||||
isLiftOnScroll = liftOnScroll
|
||||
}
|
||||
|
||||
fun disableElevation() {
|
||||
|
|
Reference in a new issue