Fixed crash when moving progressbar
This commit is contained in:
parent
fab2110715
commit
58ec618276
|
@ -387,7 +387,7 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress,
|
public void onProgressChanged(SeekBar seekBar, int progress,
|
||||||
boolean fromUser) {
|
boolean fromUser) {
|
||||||
if (fromUser) {
|
if (fromUser && PlaybackService.isRunning) {
|
||||||
prog = progress / ((float) seekBar.getMax());
|
prog = progress / ((float) seekBar.getMax());
|
||||||
duration = playbackService.getPlayer().getDuration();
|
duration = playbackService.getPlayer().getDuration();
|
||||||
txtvPosition.setText(Converter
|
txtvPosition.setText(Converter
|
||||||
|
@ -407,8 +407,10 @@ public class MediaplayerActivity extends SherlockFragmentActivity implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||||
playbackService.seek((int) (prog * duration));
|
if (PlaybackService.isRunning) {
|
||||||
setupPositionObserver();
|
playbackService.seek((int) (prog * duration));
|
||||||
|
setupPositionObserver();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue