Skip to content

Instantly share code, notes, and snippets.

@Skyyo
Created October 5, 2021 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skyyo/997e2e5ff49849b0d2c988912f2e70d2 to your computer and use it in GitHub Desktop.
Save Skyyo/997e2e5ff49849b0d2c988912f2e70d2 to your computer and use it in GitHub Desktop.
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