Post FeedMedia event

This commit is contained in:
Martin Fietz 2015-07-04 11:31:32 +02:00
parent 23a3e7c766
commit be1fde6f8e
2 changed files with 27 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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));
}
}