Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
private fun LazyListState.visibleAreaContainsItem(
currentlyPlayedIndex: Int?,
videos: List<VideoItem>
): Boolean {
return when {
currentlyPlayedIndex == null -> false
videos.isEmpty() -> false
else -> {
layoutInfo.visibleItemsInfo.map { videos[it.index] }.contains(videos[currentlyPlayedIndex])
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment