Update OneWayFadeChangeHandler to match TachiyomiSY
Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
parent
de35a4c62a
commit
c68e7c8da7
1 changed files with 5 additions and 3 deletions
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.base.controller
|
||||||
|
|
||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorSet
|
import android.animation.AnimatorSet
|
||||||
|
import android.animation.ObjectAnimator
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||||
|
@ -26,15 +27,16 @@ class OneWayFadeChangeHandler : FadeChangeHandler {
|
||||||
isPush: Boolean,
|
isPush: Boolean,
|
||||||
toAddedToContainer: Boolean
|
toAddedToContainer: Boolean
|
||||||
): Animator {
|
): Animator {
|
||||||
|
val animator = AnimatorSet()
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
return super.getAnimator(container, from, to, isPush, toAddedToContainer)
|
val start: Float = if (toAddedToContainer) 0F else to.alpha
|
||||||
|
animator.play(ObjectAnimator.ofFloat(to, View.ALPHA, start, 1f))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from != null && (!isPush || removesFromViewOnPush())) {
|
if (from != null && (!isPush || removesFromViewOnPush())) {
|
||||||
container.removeView(from)
|
container.removeView(from)
|
||||||
}
|
}
|
||||||
|
return animator
|
||||||
return AnimatorSet()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun copy(): ControllerChangeHandler {
|
override fun copy(): ControllerChangeHandler {
|
||||||
|
|
Reference in a new issue