Created
October 5, 2021 21:47
-
-
Save Skyyo/997e2e5ff49849b0d2c988912f2e70d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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