Playback position wasn't reset to 0 when playback has ended
This commit is contained in:
parent
4291a96f2f
commit
f9dd57de12
|
@ -783,7 +783,6 @@ public class PlaybackService extends Service {
|
|||
DBWriter.removeQueueItem(PlaybackService.this, item.getId(), true);
|
||||
}
|
||||
DBWriter.addItemToPlaybackHistory(PlaybackService.this, (FeedMedia) media);
|
||||
DBWriter.setFeedMedia(PlaybackService.this, (FeedMedia) media);
|
||||
long autoDeleteMediaId = ((FeedComponent) media).getId();
|
||||
if (shouldStream) {
|
||||
autoDeleteMediaId = -1;
|
||||
|
|
|
@ -215,7 +215,7 @@ public class DBWriter {
|
|||
media.setPlaybackCompletionDate(new Date());
|
||||
PodDBAdapter adapter = new PodDBAdapter(context);
|
||||
adapter.open();
|
||||
adapter.setMedia(media);
|
||||
adapter.setFeedMediaPlaybackCompletionDate(media);
|
||||
adapter.close();
|
||||
EventDistributor.getInstance().sendPlaybackHistoryUpdateBroadcast();
|
||||
|
||||
|
|
|
@ -398,6 +398,17 @@ public class PodDBAdapter {
|
|||
}
|
||||
}
|
||||
|
||||
public void setFeedMediaPlaybackCompletionDate(FeedMedia media) {
|
||||
if (media.getId() != 0) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(KEY_PLAYBACK_COMPLETION_DATE, media.getPlaybackCompletionDate().getTime());
|
||||
db.update(TABLE_NAME_FEED_MEDIA, values, KEY_ID + "=?",
|
||||
new String[]{String.valueOf(media.getId())});
|
||||
} else {
|
||||
Log.e(TAG, "setFeedMediaPlaybackCompletionDate: ID of media was 0");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert all FeedItems of a feed and the feed object itself in a single
|
||||
* transaction
|
||||
|
|
Loading…
Reference in New Issue