improved setupPositionSaver method
This commit is contained in:
parent
8236f49f90
commit
b30e5a8ff5
|
@ -331,22 +331,23 @@ public class PlaybackService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupPositionSaver() {
|
private void setupPositionSaver() {
|
||||||
if (positionSaver == null) {
|
if (positionSaver != null && !positionSaver.isCancelled()) {
|
||||||
positionSaver = new PositionSaver() {
|
positionSaver.cancel(true);
|
||||||
@Override
|
|
||||||
protected void onCancelled(Void result) {
|
|
||||||
super.onCancelled(result);
|
|
||||||
positionSaver = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostExecute(Void result) {
|
|
||||||
super.onPostExecute(result);
|
|
||||||
positionSaver = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
positionSaver.execute();
|
|
||||||
}
|
}
|
||||||
|
positionSaver = new PositionSaver() {
|
||||||
|
@Override
|
||||||
|
protected void onCancelled(Void result) {
|
||||||
|
super.onCancelled(result);
|
||||||
|
positionSaver = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostExecute(Void result) {
|
||||||
|
super.onPostExecute(result);
|
||||||
|
positionSaver = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
positionSaver.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() {
|
private MediaPlayer.OnPreparedListener preparedListener = new MediaPlayer.OnPreparedListener() {
|
||||||
|
|
Loading…
Reference in New Issue