Skip to content

Commit

Permalink
[camera] Fix immediate camera animation on API level 23.
Browse files Browse the repository at this point in the history
  • Loading branch information
pengdev committed Nov 15, 2022
1 parent 0a2438b commit 481fdef
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ abstract class CameraAnimator<out T> (
*/
final override fun start() {
postOnAnimatorThread {
if (duration == 0L && startDelay == 0L) {
val tmpListeners = listeners.toList()
val tmpUpdateListeners = userUpdateListeners.toList()
tmpListeners.forEach {
it.onAnimationStart(this)
}
internalUpdateListener?.onAnimationUpdate(this)
tmpUpdateListeners.forEach {
it?.onAnimationUpdate(this)
}
tmpListeners.forEach {
it.onAnimationEnd(this)
}
return@postOnAnimatorThread
}
if (registered) {
canceled = false
super.start()
Expand All @@ -93,6 +108,10 @@ abstract class CameraAnimator<out T> (
}
}

override fun getAnimatedValue(): Any {
return super.getAnimatedValue() ?: targets.last() as Any
}

/**
* Add an animator listener
*
Expand Down

0 comments on commit 481fdef

Please sign in to comment.