mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
Change animation for bottom nav switching to fade in, but not fade out
This commit is contained in:
parent
f12193c119
commit
b3ad1afd9a
3 changed files with 10 additions and 2 deletions
|
@ -21,6 +21,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
|
|||
removesFromViewOnPush
|
||||
)
|
||||
|
||||
var fadeOut = true
|
||||
override fun getAnimator(
|
||||
container: ViewGroup,
|
||||
from: View?,
|
||||
|
@ -36,7 +37,7 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
|
|||
|
||||
val hasSideNav = container.context.resources.configuration?.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
if (from != null && (!isPush || removesFromViewOnPush())) {
|
||||
if (!hasSideNav) {
|
||||
if (!hasSideNav && fadeOut) {
|
||||
animator.play(ObjectAnimator.ofFloat(from, View.ALPHA, 0f))
|
||||
} else {
|
||||
container.removeView(from)
|
||||
|
|
|
@ -88,6 +88,7 @@ import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsetsCompat
|
|||
import eu.kanade.tachiyomi.util.view.getItemView
|
||||
import eu.kanade.tachiyomi.util.view.snack
|
||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.util.view.withFadeInTransaction
|
||||
import eu.kanade.tachiyomi.widget.EndAnimatorListener
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
|
@ -755,7 +756,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||
}
|
||||
|
||||
private fun setRoot(controller: Controller, id: Int) {
|
||||
router.setRoot(controller.withFadeTransaction().tag(id.toString()))
|
||||
router.setRoot(controller.withFadeInTransaction().tag(id.toString()))
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
|
||||
|
|
|
@ -570,6 +570,12 @@ fun Controller.withFadeTransaction(): RouterTransaction {
|
|||
.popChangeHandler(OneWayFadeChangeHandler())
|
||||
}
|
||||
|
||||
fun Controller.withFadeInTransaction(): RouterTransaction {
|
||||
return RouterTransaction.with(this)
|
||||
.pushChangeHandler(OneWayFadeChangeHandler().apply { fadeOut = false })
|
||||
.popChangeHandler(OneWayFadeChangeHandler())
|
||||
}
|
||||
|
||||
fun Controller.openInBrowser(url: String) {
|
||||
try {
|
||||
val intent = Intent(Intent.ACTION_VIEW, url.toUri())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue