Commit d2adaabb authored by Edward Wang's avatar Edward Wang

AudioPlayer: check forwards as well in LongSeekListener

Close #11755
parent efd33709
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment