Merge pull request #977 from TomHennen/fix964
Don't send Gpodder actions for items that don't have media. fixes #968
This commit is contained in:
commit
23f666a24d
|
@ -97,19 +97,6 @@ public class DefaultActionButtonCallback implements ActionButtonCallback {
|
||||||
} else {
|
} else {
|
||||||
if (!item.isRead()) {
|
if (!item.isRead()) {
|
||||||
DBWriter.markItemRead(context, item, true, true);
|
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);
|
DBWriter.markItemRead(context, selectedItem, true, false);
|
||||||
if(GpodnetPreferences.loggedIn()) {
|
if(GpodnetPreferences.loggedIn()) {
|
||||||
FeedMedia media = selectedItem.getMedia();
|
FeedMedia media = selectedItem.getMedia();
|
||||||
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
// not all items have media, Gpodder only cares about those that do
|
||||||
.currentDeviceId()
|
if (media != null) {
|
||||||
.currentTimestamp()
|
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
||||||
.started(media.getDuration() / 1000)
|
.currentDeviceId()
|
||||||
.position(media.getDuration() / 1000)
|
.currentTimestamp()
|
||||||
.total(media.getDuration() / 1000)
|
.started(media.getDuration() / 1000)
|
||||||
.build();
|
.position(media.getDuration() / 1000)
|
||||||
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
.total(media.getDuration() / 1000)
|
||||||
|
.build();
|
||||||
|
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.mark_unread_item:
|
case R.id.mark_unread_item:
|
||||||
|
|
Loading…
Reference in New Issue