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,6 +158,8 @@ 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();
|
||||||
|
// not all items have media, Gpodder only cares about those that do
|
||||||
|
if (media != null) {
|
||||||
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
GpodnetEpisodeAction actionPlay = new GpodnetEpisodeAction.Builder(selectedItem, Action.PLAY)
|
||||||
.currentDeviceId()
|
.currentDeviceId()
|
||||||
.currentTimestamp()
|
.currentTimestamp()
|
||||||
|
@ -167,6 +169,7 @@ public class FeedItemMenuHandler {
|
||||||
.build();
|
.build();
|
||||||
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
GpodnetPreferences.enqueueEpisodeAction(actionPlay);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case R.id.mark_unread_item:
|
case R.id.mark_unread_item:
|
||||||
selectedItem.setRead(false);
|
selectedItem.setRead(false);
|
||||||
|
|
Loading…
Reference in New Issue