From be1fde6f8e416cd6ddc4be9d7b01de0e718fed55 Mon Sep 17 00:00:00 2001 From: Martin Fietz Date: Sat, 4 Jul 2015 11:31:32 +0200 Subject: [PATCH] Post FeedMedia event --- .../antennapod/core/event/FeedMediaEvent.java | 24 +++++++++++++++++++ .../core/service/FeedMediaSizeService.java | 3 +++ 2 files changed, 27 insertions(+) create mode 100644 core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java diff --git a/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java b/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java new file mode 100644 index 000000000..94e186b7a --- /dev/null +++ b/core/src/main/java/de/danoeh/antennapod/core/event/FeedMediaEvent.java @@ -0,0 +1,24 @@ +package de.danoeh.antennapod.core.event; + +import de.danoeh.antennapod.core.feed.FeedMedia; + +public class FeedMediaEvent { + + public enum Action { + UPDATE + } + + public final Action action; + public final FeedMedia media; + + private FeedMediaEvent(Action action, FeedMedia media) { + this.action = action; + this.media = media; + } + + public static FeedMediaEvent update(FeedMedia media) { + return new FeedMediaEvent(Action.UPDATE, media); + } + + +} diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/FeedMediaSizeService.java b/core/src/main/java/de/danoeh/antennapod/core/service/FeedMediaSizeService.java index 1f7dfa386..ad047f10a 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/FeedMediaSizeService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/FeedMediaSizeService.java @@ -9,10 +9,12 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.List; +import de.danoeh.antennapod.core.event.FeedMediaEvent; import de.danoeh.antennapod.core.feed.FeedMedia; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.util.NetworkUtils; +import de.greenrobot.event.EventBus; public class FeedMediaSizeService extends IntentService { @@ -48,6 +50,7 @@ public class FeedMediaSizeService extends IntentService { } media.setSize(size); DBWriter.setFeedMedia(this, media); + EventBus.getDefault().post(FeedMediaEvent.update(media)); } }