Skip to content

Instantly share code, notes, and snippets.

@ademirqueiroga
Created February 6, 2023 11:12
Show Gist options
  • Save ademirqueiroga/9a2acd6925b7dc83a0cab783154b5f2d to your computer and use it in GitHub Desktop.
Save ademirqueiroga/9a2acd6925b7dc83a0cab783154b5f2d to your computer and use it in GitHub Desktop.
AwesomeTransportControlGlue.onSecondaryActionPressed
private fun onSecondaryActionPressed(action: Action) {
val adapter = controlsRow.secondaryActionsAdapter as? ArrayObjectAdapter ?: return
if (action is PlaybackControlsRow.MultiAction) {
action.nextIndex()
notifyItemChanged(adapter, action)
}
when (action) {
shuffleAction -> {
playerAdapter.setShuffleAction(shuffleAction.index)
if (shuffleAction.index == PlaybackControlsRow.ShuffleAction.INDEX_ON) {
shuffledPositions.shuffle()
}
}
repeatAction -> playerAdapter.setRepeatAction(repeatAction.index)
thumbsUpAction -> currentMovie.let(LikedMovies::toggle)
myListAction -> currentMovie.let(MyList::toggle)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment