Skip to content

Commit

Permalink
apply patch
Browse files Browse the repository at this point in the history
Signed-off-by: parneet-guraya <[email protected]>
  • Loading branch information
parneet-guraya committed Sep 11, 2024
1 parent b9855e8 commit d8ed2ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/owncloud/android/media/MediaControlView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d8ed2ce

Please sign in to comment.