improved setupPositionSaver method

This commit is contained in:
daniel oeh 2012-07-16 12:46:54 +02:00
parent 8236f49f90
commit b30e5a8ff5
1 changed files with 16 additions and 15 deletions

View File

@ -331,22 +331,23 @@ public class PlaybackService extends Service {
}
private void setupPositionSaver() {
if (positionSaver == null) {
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();
if (positionSaver != null && !positionSaver.isCancelled()) {
positionSaver.cancel(true);
}
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() {