[Android] AudioPlayer: check forwards as well in LongSeekListener
Edward Wang
git at videolan.org
Thu Aug 21 17:55:17 CEST 2014
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Thu Aug 21 11:53:58 2014 -0400| [d2adaabbba60e94090895335926efef5d0ec03ac] | committer: Edward Wang
AudioPlayer: check forwards as well in LongSeekListener
Close #11755
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d2adaabbba60e94090895335926efef5d0ec03ac
---
.../src/org/videolan/vlc/gui/audio/AudioPlayer.java | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index aea961b..8748107 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -579,11 +579,13 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
class LongSeekListener implements View.OnTouchListener {
boolean forward;
int normal, pressed;
+ long length;
public LongSeekListener(boolean forwards, int normalRes, int pressedRes) {
this.forward = forwards;
this.normal = normalRes;
this.pressed = pressedRes;
+ this.length = -1;
}
int possibleSeek;
@@ -599,16 +601,17 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
vibrated = true;
}
- if(forward)
- possibleSeek += 4000;
- else {
+ if(forward) {
+ if(length <= 0 || possibleSeek < length)
+ possibleSeek += 4000;
+ } else {
if(possibleSeek > 4000)
possibleSeek -= 4000;
else if(possibleSeek <= 4000)
possibleSeek = 0;
}
- mTime.setText(Strings.millisToString(mShowRemainingTime ? possibleSeek-mAudioController.getLength() : possibleSeek));
+ mTime.setText(Strings.millisToString(mShowRemainingTime ? possibleSeek-length : possibleSeek));
mTimeline.setProgress(possibleSeek);
mProgressBar.setProgress(possibleSeek);
h.postDelayed(seekRunnable, 50);
@@ -624,6 +627,7 @@ public class AudioPlayer extends Fragment implements IAudioPlayer {
possibleSeek = mAudioController.getTime();
mPreviewingSeek = true;
vibrated = false;
+ length = mAudioController.getLength();
h.postDelayed(seekRunnable, 1000);
return true;
More information about the Android
mailing list