Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Last active January 21, 2023 15:11
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 Arunshaik2001/f9f06ab40e19532c76fdbede69d569c9 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/f9f06ab40e19532c76fdbede69d569c9 to your computer and use it in GitHub Desktop.
private fun updatePictureInPictureParams(started: Boolean): PictureInPictureParams {
val visibleRect = Rect()
binding.timerBackground.getGlobalVisibleRect(visibleRect)
val params = PictureInPictureParams.Builder()
.setActions(
listOf(
if (started) {
createRemoteAction(
R.drawable.ic_pause_24dp,
R.string.pause,
START_OR_PAUSE_TIME,
CONTROL_TYPE_START_OR_PAUSE
)
} else {
createRemoteAction(
R.drawable.ic_play_arrow_24dp,
R.string.start,
START_OR_PAUSE_TIME,
CONTROL_TYPE_START_OR_PAUSE
)
}
)
)
.setAspectRatio(Rational(16, 9))
.setSourceRectHint(visibleRect)
.setAutoEnterEnabled(true)
.setSeamlessResizeEnabled(false)
.build()
setPictureInPictureParams(params)
return params
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment