I want to achieve color changing status bar with crossfade animation as shown below. Can I have a clue how to do that?
Status bar color change animation:

Thanks!
Edited (7 July 2018) - C'mon guys, this is NOT a duplicate
Anyway, finally I found a solution using ValueAnimator and ArgbEvaluator.
val mColorAnimation = ValueAnimator.ofObject(ArgbEvaluator(), firstColor, secondColor, thirdColor, fourthColor) 
mColorAnimation.duration = (pageCount - 1) * 10000000000L
mColorAnimation.addUpdateListener { animator ->
    val color = animator.animatedValue as Int
    // change status, navigation, and action bar color
    window.statusBarColor = color
    window.navigationBarColor = color
    supportActionBar?.setBackgroundDrawable(ColorDrawable(color))
}
main_viewpager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener{
    override fun onPageScrollStateChanged(state: Int) { /* unused */ }
    override fun onPageSelected(position: Int) { /* unused */ }
    override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
        mColorAnimation.currentPlayTime = ((positionOffset + position) * 10000000000).toLong()
    }
})
 
    
 
    