Merge remote-tracking branch 'upstream/media3-flat' into media3-flat

This commit is contained in:
Holger Müller 2022-04-08 21:55:14 +02:00
commit 1c7c4839b3
2 changed files with 9 additions and 7 deletions

View File

@ -422,9 +422,9 @@ class PlayerFragment :
private fun updateShuffleButtonState(isEnabled: Boolean) { private fun updateShuffleButtonState(isEnabled: Boolean) {
if (isEnabled) { if (isEnabled) {
shuffleButton.alpha = 1f shuffleButton.alpha = ALPHA_ACTIVATED
} else { } else {
shuffleButton.alpha = 0.3f shuffleButton.alpha = ALPHA_DEACTIVATED
} }
} }
@ -436,7 +436,7 @@ class PlayerFragment :
requireContext(), R.attr.media_repeat_off requireContext(), R.attr.media_repeat_off
) )
) )
repeatButton.alpha = 0.3f repeatButton.alpha = ALPHA_DEACTIVATED
} }
1 -> { 1 -> {
repeatButton.setImageDrawable( repeatButton.setImageDrawable(
@ -444,7 +444,7 @@ class PlayerFragment :
requireContext(), R.attr.media_repeat_single requireContext(), R.attr.media_repeat_single
) )
) )
repeatButton.alpha = 1f repeatButton.alpha = ALPHA_ACTIVATED
} }
2 -> { 2 -> {
repeatButton.setImageDrawable( repeatButton.setImageDrawable(
@ -452,7 +452,7 @@ class PlayerFragment :
requireContext(), R.attr.media_repeat_all requireContext(), R.attr.media_repeat_all
) )
) )
repeatButton.alpha = 1f repeatButton.alpha = ALPHA_ACTIVATED
} }
else -> { else -> {
} }
@ -954,7 +954,7 @@ class PlayerFragment :
super.onSelectedChanged(viewHolder, actionState) super.onSelectedChanged(viewHolder, actionState)
if (actionState == ACTION_STATE_DRAG) { if (actionState == ACTION_STATE_DRAG) {
viewHolder?.itemView?.alpha = 0.6f viewHolder?.itemView?.alpha = ALPHA_DEACTIVATED
} }
} }
@ -1256,5 +1256,7 @@ class PlayerFragment :
companion object { companion object {
private const val PERCENTAGE_OF_SCREEN_FOR_SWIPE = 5 private const val PERCENTAGE_OF_SCREEN_FOR_SWIPE = 5
private const val ALPHA_ACTIVATED = 1f
private const val ALPHA_DEACTIVATED = 0.4f
} }
} }

View File

@ -289,7 +289,7 @@ class MediaPlayerController(
@Synchronized @Synchronized
fun togglePlayPause() { fun togglePlayPause() {
if (playbackState == Player.STATE_IDLE) autoPlayStart = true if (playbackState == Player.STATE_IDLE) autoPlayStart = true
if (controller?.isPlaying == false) { if (controller?.isPlaying == true) {
controller?.pause() controller?.pause()
} else { } else {
controller?.play() controller?.play()