Skip to content

Instantly share code, notes, and snippets.

@rubenquadros
Last active September 4, 2021 17:52
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 rubenquadros/8d45b36107a2d71a6ef68e7b4c1f9be7 to your computer and use it in GitHub Desktop.
Save rubenquadros/8d45b36107a2d71a6ef68e7b4c1f9be7 to your computer and use it in GitHub Desktop.
Final video item
@Composable
fun VideoItem(
index: Int,
video: VideoResultEntity,
currentPlaying: State<Int>,
onVideoChange: (Int) -> Unit
) {
val currentlyPlaying = remember {
mutableStateOf(false)
}
currentlyPlaying.value = index == currentPlaying.value
ConstraintLayout(
modifier =
Modifier.testTag("VideoParent")
.padding(8.dp)
.wrapContentSize()
.clickable {
// notify video player to play this video
onVideoChange(index)
}
) {
// rest of the things remain same
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment