apply patch

Signed-off-by: parneet-guraya <gurayaparneet@gmail.com>
This commit is contained in:
parneet-guraya 2024-09-11 19:27:29 +05:30
parent b9855e8a86
commit d8ed2ce5c7
No known key found for this signature in database
GPG key ID: 63B807C4B2A9064B
2 changed files with 7 additions and 7 deletions

View file

@ -113,7 +113,7 @@ class BackgroundPlayerService : MediaSessionService(), Injectable {
.setDisplayName("PlayPause")
.setIconResId(
CommandButton.getIconResIdForIconConstant(
if (mediaSession?.player?.isPlaying!!) {
if (mediaSession?.player?.isPlaying == true) {
CommandButton.ICON_PAUSE
} else {
CommandButton.ICON_PLAY
@ -215,7 +215,7 @@ class BackgroundPlayerService : MediaSessionService(), Injectable {
private fun release() {
val player = mediaSession?.player
if (player!!.playWhenReady) {
if (player?.playWhenReady == true) {
// Make sure the service is not in foreground.
player.pause()
}

View file

@ -100,14 +100,14 @@ class MediaControlView(context: Context, attrs: AttributeSet?) :
*/
private fun disableUnsupportedButtons() {
try {
if (playerControl!!.isCommandAvailable(Player.COMMAND_PLAY_PAUSE).not()) {
if (playerControl?.isCommandAvailable(Player.COMMAND_PLAY_PAUSE)?.not() == true) {
binding.playBtn.isEnabled = false
}
if (playerControl!!.isCommandAvailable(Player.COMMAND_SEEK_BACK).not()) {
if (playerControl?.isCommandAvailable(Player.COMMAND_SEEK_BACK)?.not() == true) {
binding.rewindBtn.isEnabled = false
}
if (playerControl!!.isCommandAvailable(Player.COMMAND_SEEK_FORWARD).not()) {
if (playerControl?.isCommandAvailable(Player.COMMAND_SEEK_FORWARD)?.not() == true) {
binding.forwardBtn.isEnabled = false
}
} catch (ex: IncompatibleClassChangeError) {
@ -234,12 +234,12 @@ class MediaControlView(context: Context, attrs: AttributeSet?) :
R.drawable.ic_play
}
)
binding.forwardBtn.visibility = if (playerControl!!.isCommandAvailable(Player.COMMAND_SEEK_FORWARD)) {
binding.forwardBtn.visibility = if (playerControl?.isCommandAvailable(Player.COMMAND_SEEK_FORWARD) == true) {
VISIBLE
} else {
INVISIBLE
}
binding.rewindBtn.visibility = if (playerControl!!.isCommandAvailable(Player.COMMAND_SEEK_BACK)) {
binding.rewindBtn.visibility = if (playerControl?.isCommandAvailable(Player.COMMAND_SEEK_BACK) == true) {
VISIBLE
} else {
INVISIBLE