Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Adopt tab/controller transitions from SY

Original author: @jobobby04
Cette révision appartient à :
arkon 2020-08-22 13:03:39 -04:00
Parent 9920ff617b
révision 9ba11a585f
3 fichiers modifiés avec 7 ajouts et 7 suppressions

Voir le fichier

@ -28,8 +28,8 @@ fun Controller.requestPermissionsSafe(permissions: Array<String>, requestCode: I
}
}
fun Controller.withFadeTransaction(duration: Long = 150L): RouterTransaction {
fun Controller.withFadeTransaction(): RouterTransaction {
return RouterTransaction.with(this)
.pushChangeHandler(FadeChangeHandler(duration))
.popChangeHandler(FadeChangeHandler(duration))
.pushChangeHandler(FadeChangeHandler())
.popChangeHandler(FadeChangeHandler())
}

Voir le fichier

@ -86,7 +86,7 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
setSupportActionBar(binding.toolbar)
tabAnimator = ViewHeightAnimator(binding.tabs)
tabAnimator = ViewHeightAnimator(binding.tabs, 0L)
bottomNavAnimator = ViewHeightAnimator(binding.bottomNav)
// Set behavior of bottom nav
@ -312,7 +312,7 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
}
private fun setRoot(controller: Controller, id: Int) {
router.setRoot(RouterTransaction.with(controller).tag(id.toString()))
router.setRoot(controller.withFadeTransaction().tag(id.toString()))
}
private fun syncActivityViewWithController(to: Controller?, from: Controller? = null) {

Voir le fichier

@ -6,7 +6,7 @@ import android.view.ViewTreeObserver
import android.view.animation.DecelerateInterpolator
import androidx.annotation.Keep
class ViewHeightAnimator(val view: View) {
class ViewHeightAnimator(val view: View, val duration: Long = 250L) {
/**
* The default height of the view. It's unknown until the view is layout.
@ -23,7 +23,7 @@ class ViewHeightAnimator(val view: View) {
*/
private val animation by lazy {
ObjectAnimator.ofInt(this, "height", height).apply {
duration = 250L
duration = this@ViewHeightAnimator.duration
interpolator = DecelerateInterpolator()
}
}