Calculate time spent on each item by user of a recycler view list, to serve as an engagement/analytics metric.
- Key files - MainActivity, MainViewModel, RecyclerViewTracker
- Based on Kotlin Coroutines and Flow
- Filter out view types that are not required to be tracked
- Tracking should stopped/resumed based on activity/fragment lifecycle
- Two types of implementation - Complete visibility & Height percentage based visibility
- In some cases, the current implementation will not respect the loading time required to populate the list for the very first time.
- With the help of these great blogs: krtkush & ProAndroidDev