diff --git a/app/src/main/java/com/nextcloud/client/media/BackgroundPlayerService.kt b/app/src/main/java/com/nextcloud/client/media/BackgroundPlayerService.kt index 04db61f8adc4..e2e89544cf90 100644 --- a/app/src/main/java/com/nextcloud/client/media/BackgroundPlayerService.kt +++ b/app/src/main/java/com/nextcloud/client/media/BackgroundPlayerService.kt @@ -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() } diff --git a/app/src/main/java/com/owncloud/android/media/MediaControlView.kt b/app/src/main/java/com/owncloud/android/media/MediaControlView.kt index 694b8cf3256d..217c1c153501 100644 --- a/app/src/main/java/com/owncloud/android/media/MediaControlView.kt +++ b/app/src/main/java/com/owncloud/android/media/MediaControlView.kt @@ -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