Don't send Gpodder actions for items that don't have media.
Fixes AntennaPod/AntennaPod#964
This commit is contained in:
parent
5d553394ba
commit
51e3f55561
|
@ -97,19 +97,6 @@ public class DefaultActionButtonCallback implements ActionButtonCallback {
|
|||
} else {
|
||||
if (!item.isRead()) {
|
||||
DBWriter.markItemRead(context, item, true, true);
|
||||
|
||||
if(GpodnetPreferences.loggedIn()) {
|
||||
// gpodder: send played action
|
||||
FeedMedia media = item.getMedia();
|
||||
GpodnetEpisodeAction action = new GpodnetEpisodeAction.Builder(item, GpodnetEpisodeAction.Action.PLAY)
|
||||
.currentDeviceId()
|
||||
.currentTimestamp()
|
||||
.started(media.getDuration() / 1000)
|
||||
.position(media.getDuration() / 1000)
|
||||
.total(media.getDuration() / 1000)
|
||||
.build();
|
||||
GpodnetPreferences.enqueueEpisodeAction(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,14 +158,17 @@ public class FeedItemMenuHandler {
|
|||
DBWriter.markItemRead(context, selectedItem, true, false);
|
||||
if(GpodnetPreferences.loggedIn()) {
|
||||
FeedMedia media = selectedItem.getMedia();
|
||||
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
||||
.currentDeviceId()
|
||||
.currentTimestamp()
|
||||
.started(media.getDuration() / 1000)
|
||||
.position(media.getDuration() / 1000)
|
||||
.total(media.getDuration() / 1000)
|
||||
.build();
|
||||
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
||||
// not all items have media, Gpodder only cares about those that do
|
||||
if (media != null) {
|
||||
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
||||
.currentDeviceId()
|
||||
.currentTimestamp()
|
||||
.started(media.getDuration() / 1000)
|
||||
.position(media.getDuration() / 1000)
|
||||
.total(media.getDuration() / 1000)
|
||||
.build();
|
||||
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case R.id.mark_unread_item:
|
||||
|
|
Loading…
Reference in New Issue