[Android] Fix audio animated drawable on lower Android versions
Nicolas Pomepuy
git at videolan.org
Tue Sep 5 09:39:13 UTC 2023
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep 4 08:12:53 2023 +0200| [1f192a1956be6d4f4e456a08649f02652a2bf6d9] | committer: Duncan McNamara
Fix audio animated drawable on lower Android versions
Fixes #2991
> https://code.videolan.org/videolan/vlc-android/commit/1f192a1956be6d4f4e456a08649f02652a2bf6d9
---
.../vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
index b2fa455fae..9af2659738 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.kt
@@ -111,6 +111,8 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
private var playerState = 0
private lateinit var pauseToPlay: AnimatedVectorDrawableCompat
private lateinit var playToPause: AnimatedVectorDrawableCompat
+ private lateinit var pauseToPlayHeader: AnimatedVectorDrawableCompat
+ private lateinit var playToPauseHeader: AnimatedVectorDrawableCompat
private lateinit var pauseToPlaySmall: AnimatedVectorDrawableCompat
private lateinit var playToPauseSmall: AnimatedVectorDrawableCompat
@@ -196,6 +198,8 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
//For resizing purpose, we have to cache this twice even if it's from the same resource
playToPause = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_play_pause_video)!!
pauseToPlay = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_pause_play_video)!!
+ playToPauseHeader = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_play_pause_video)!!
+ pauseToPlayHeader = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_pause_play_video)!!
playToPauseSmall = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_play_pause_video)!!
pauseToPlaySmall = AnimatedVectorDrawableCompat.create(requireActivity(), R.drawable.anim_pause_play_video)!!
onSlide(0f)
@@ -386,12 +390,14 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
val drawable = if (playing) playToPause else pauseToPlay
val drawableSmall = if (playing) playToPauseSmall else pauseToPlaySmall
+ val drawableHeaderLarge = if (playing) playToPauseHeader else pauseToPlayHeader
binding.playPause.setImageDrawable(drawable)
- binding.headerLargePlayPause.setImageDrawable(drawable)
+ binding.headerLargePlayPause.setImageDrawable(drawableHeaderLarge)
binding.headerPlayPause.setImageDrawable(drawableSmall)
if (playing != wasPlaying) {
drawable.start()
drawableSmall.start()
+ drawableHeaderLarge.start()
}
playlistAdapter.setCurrentlyPlaying(playing)
More information about the Android
mailing list