override fun onTransitionCompleted()

in app/src/main/java/com/amazonaws/ivs/player/scrollablefeed/ui/MainActivity.kt [84:104]


            override fun onTransitionCompleted(motionLayout: MotionLayout?, currentId: Int) {
                super.onTransitionCompleted(motionLayout, currentId)
                val currentTime = Date().time
                val transitionDelay = currentTime - lastTransitionTime
                lastTransitionTime = currentTime
                // Workaround for a Bug in ConstraintLayout that causes multiple onTransitionCallbacks for no reason
                if (transitionDelay < TRANSITION_THRESHOLD) return
                Timber.d("Transition completed: $currentId, ${R.id.state_top}, ${R.id.state_center}, ${R.id.state_bottom}")
                when (currentId) {
                    R.id.state_top -> {
                        viewModel.scrollStreams(ScrollDirection.UP)
                        resetCenterStream()
                        motionLayout?.jumpToState(R.id.state_center)
                    }
                    R.id.state_bottom -> {
                        viewModel.scrollStreams(ScrollDirection.DOWN)
                        resetCenterStream()
                        motionLayout?.jumpToState(R.id.state_center)
                    }
                }
            }