mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2025-01-12 00:59:09 +01:00
Fixing bottom nav disappearing when changelog shows
This commit is contained in:
parent
2e4af90b63
commit
6753a3c6ff
@ -452,7 +452,6 @@ class LibraryController(
|
|||||||
DownloadService.callListeners()
|
DownloadService.callListeners()
|
||||||
LibraryUpdateService.setListener(this)
|
LibraryUpdateService.setListener(this)
|
||||||
} else closeTip()
|
} else closeTip()
|
||||||
if (type == ControllerChangeType.POP_ENTER) filter_bottom_sheet.hideIfPossible()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResumed(activity: Activity) {
|
override fun onActivityResumed(activity: Activity) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package eu.kanade.tachiyomi.ui.main
|
package eu.kanade.tachiyomi.ui.main
|
||||||
|
|
||||||
import android.animation.Animator
|
|
||||||
import android.animation.AnimatorSet
|
import android.animation.AnimatorSet
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@ -64,7 +63,9 @@ import eu.kanade.tachiyomi.util.view.getItemView
|
|||||||
import eu.kanade.tachiyomi.util.view.snack
|
import eu.kanade.tachiyomi.util.view.snack
|
||||||
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
import eu.kanade.tachiyomi.util.view.updateLayoutParams
|
||||||
import eu.kanade.tachiyomi.util.view.updatePadding
|
import eu.kanade.tachiyomi.util.view.updatePadding
|
||||||
|
import eu.kanade.tachiyomi.util.view.visibleIf
|
||||||
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
import eu.kanade.tachiyomi.util.view.withFadeTransaction
|
||||||
|
import eu.kanade.tachiyomi.widget.EndAnimatorListener
|
||||||
import kotlinx.android.synthetic.main.main_activity.*
|
import kotlinx.android.synthetic.main.main_activity.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
@ -92,6 +93,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
|||||||
|
|
||||||
private var animationSet: AnimatorSet? = null
|
private var animationSet: AnimatorSet? = null
|
||||||
private val downloadManager: DownloadManager by injectLazy()
|
private val downloadManager: DownloadManager by injectLazy()
|
||||||
|
private val hideBottomNav
|
||||||
|
get() = router.backstackSize > 1 && router.backstack[1].controller() !is DialogController
|
||||||
|
|
||||||
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
||||||
this.snackBar = snackBar
|
this.snackBar = snackBar
|
||||||
@ -233,8 +236,8 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
|||||||
} else onBackPressed()
|
} else onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
bottom_nav.visibility = if (router.backstackSize > 1) View.GONE else View.VISIBLE
|
bottom_nav.visibleIf(!hideBottomNav)
|
||||||
bottom_nav.alpha = if (router.backstackSize > 1) 0f else 1f
|
bottom_nav.alpha = if (hideBottomNav) 0f else 1f
|
||||||
router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener {
|
router.addChangeListener(object : ControllerChangeHandler.ControllerChangeListener {
|
||||||
override fun onChangeStarted(
|
override fun onChangeStarted(
|
||||||
to: Controller?,
|
to: Controller?,
|
||||||
@ -525,35 +528,23 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
|
|||||||
}
|
}
|
||||||
drawerArrow?.progress = 1f
|
drawerArrow?.progress = 1f
|
||||||
|
|
||||||
if (to !is DialogController) {
|
bottom_nav.visibility = if (!hideBottomNav) View.VISIBLE else bottom_nav.visibility
|
||||||
bottom_nav.visibility =
|
|
||||||
if (router.backstackSize == 0 || (router.backstackSize <= 1 && !isPush)) View.VISIBLE else bottom_nav.visibility
|
|
||||||
animationSet?.cancel()
|
animationSet?.cancel()
|
||||||
animationSet = AnimatorSet()
|
animationSet = AnimatorSet()
|
||||||
val alphaAnimation = ValueAnimator.ofFloat(
|
val alphaAnimation = ValueAnimator.ofFloat(
|
||||||
bottom_nav.alpha, if (router.backstackSize > 1) 0f else 1f
|
bottom_nav.alpha, if (hideBottomNav) 0f else 1f
|
||||||
)
|
)
|
||||||
alphaAnimation.addUpdateListener { valueAnimator ->
|
alphaAnimation.addUpdateListener { valueAnimator ->
|
||||||
bottom_nav.alpha = valueAnimator.animatedValue as Float
|
bottom_nav.alpha = valueAnimator.animatedValue as Float
|
||||||
}
|
}
|
||||||
alphaAnimation.addListener(object : Animator.AnimatorListener {
|
alphaAnimation.addListener(EndAnimatorListener {
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
bottom_nav.visibility = if (hideBottomNav) View.GONE else View.VISIBLE
|
||||||
bottom_nav.visibility =
|
|
||||||
if (router.backstackSize > 1) View.GONE else View.VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationCancel(animation: Animator?) {}
|
|
||||||
|
|
||||||
override fun onAnimationRepeat(animation: Animator?) {}
|
|
||||||
|
|
||||||
override fun onAnimationStart(animation: Animator?) {}
|
|
||||||
})
|
})
|
||||||
alphaAnimation.duration = 200
|
alphaAnimation.duration = 200
|
||||||
alphaAnimation.startDelay = 50
|
alphaAnimation.startDelay = 50
|
||||||
animationSet?.playTogether(alphaAnimation)
|
animationSet?.playTogether(alphaAnimation)
|
||||||
animationSet?.start()
|
animationSet?.start()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun downloadStatusChanged(downloading: Boolean) {
|
override fun downloadStatusChanged(downloading: Boolean) {
|
||||||
val hasQueue = downloading || downloadManager.hasQueue()
|
val hasQueue = downloading || downloadManager.hasQueue()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user