[Android] Fix long press behavior in audio player
Robert Stone
git at videolan.org
Tue May 25 12:00:44 UTC 2021
vlc-android | branch: master | Robert Stone <rhstone at gmail.com> | Mon May 24 23:50:27 2021 -0700| [8e6d4e03fa0c1726c75c6b5200f08cdbe3100874] | committer: Robert Stone
Fix long press behavior in audio player
> https://code.videolan.org/videolan/vlc-android/commit/8e6d4e03fa0c1726c75c6b5200f08cdbe3100874
---
.../src/org/videolan/vlc/gui/audio/AudioPlayer.kt | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
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 97d0d70f4..1969e53d3 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
@@ -586,20 +586,10 @@ class AudioPlayer : Fragment(), PlaylistAdapter.IPlayer, TextWatcher, IAudioPlay
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> {
handler.removeCallbacks(seekRunnable)
previewingSeek = false
- if (event.eventTime - event.downTime < 1000) {
- if (forward) onNextClick(v) else onPreviousClick(v)
- } else {
- if (forward) {
- if (possibleSeek < playlistModel.length)
- playlistModel.time = possibleSeek.toLong()
- else
- onNextClick(v)
- } else {
- if (possibleSeek > 0)
- playlistModel.time = possibleSeek.toLong()
- else
- onPreviousClick(v)
- }
+ if (event.eventTime - event.downTime >= 1000L) {
+ playlistModel.time = possibleSeek.toLong().coerceAtLeast(0L).coerceAtMost(playlistModel.length)
+ v.isPressed = false
+ return true
}
return false
}
More information about the Android
mailing list