-
-
Save Arunshaik2001/f9f06ab40e19532c76fdbede69d569c9 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 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