diff options
author | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-03-28 10:59:07 +0100 |
---|---|---|
committer | Martin Fietz <marf@hadiko-99-4.hadiko.uni-karlsruhe.de> | 2015-04-05 22:11:19 +0200 |
commit | 67cc7c98857b3fa0897ab96b2b87f52d99e4de2f (patch) | |
tree | 6bcccf0a230c161bed1bba47d6f785b4c249f847 /app/src/main/java/de/danoeh/antennapod/menuhandler | |
parent | a8d434a803d8b5dc7d4bc51c50a0a6a2627c456c (diff) | |
download | AntennaPod-67cc7c98857b3fa0897ab96b2b87f52d99e4de2f.zip |
Sync episode actions with gpodder, smart mark as played
* Create episode actions when episodes are downloaded, played, deleted and marked as read
* Sync (download and upload) episode actions
* MediaPlayerActivity deletes almost completely played episode on close
* Improved parsing of datetime strings
* Smart mark as played can be disabled or set in the preferences
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/menuhandler')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index 8ccbdafc6..ab8613bbe 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -7,6 +7,10 @@ import android.net.Uri; import de.danoeh.antennapod.core.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.feed.FeedItem; +import de.danoeh.antennapod.core.feed.FeedMedia; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction; +import de.danoeh.antennapod.core.gpoddernet.model.GpodnetEpisodeAction.Action; +import de.danoeh.antennapod.core.preferences.GpodnetPreferences; import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.storage.DBTasks; import de.danoeh.antennapod.core.storage.DBWriter; @@ -156,9 +160,27 @@ public class FeedItemMenuHandler { break; case R.id.mark_read_item: DBWriter.markItemRead(context, selectedItem, true, true); + 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); + } break; case R.id.mark_unread_item: DBWriter.markItemRead(context, selectedItem, false, true); + if(GpodnetPreferences.loggedIn()) { + GpodnetEpisodeAction actionNew = new GpodnetEpisodeAction.Builder(selectedItem, Action.NEW) + .currentDeviceId() + .currentTimestamp() + .build(); + GpodnetPreferences.enqueueEpisodeAction(actionNew); + } break; case R.id.add_to_queue_item: DBWriter.addQueueItem(context, selectedItem.getId()); |