use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class PlaybackHistoryFragment method onEventMainThread.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
if (playbackHistory == null) {
return;
} else if (adapter == null) {
loadItems();
return;
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
int pos = FeedItemUtil.indexOfItemWithId(playbackHistory, item.getId());
if (pos >= 0) {
playbackHistory.remove(pos);
playbackHistory.add(pos, item);
adapter.notifyItemChangedCompat(pos);
}
}
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class FeedItemlistFragment method onEventMainThread.
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(FeedItemEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
if (feed == null || feed.getItems() == null) {
return;
} else if (adapter == null) {
loadItems();
return;
}
for (int i = 0, size = event.items.size(); i < size; i++) {
FeedItem item = event.items.get(i);
int pos = FeedItemUtil.indexOfItemWithId(feed.getItems(), item.getId());
if (pos >= 0) {
feed.getItems().remove(pos);
feed.getItems().add(pos, item);
adapter.notifyItemChangedCompat(pos);
}
}
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class EpisodeMultiSelectActionHandler method deleteChecked.
private void deleteChecked() {
int countHasMedia = 0;
for (FeedItem feedItem : selectedItems) {
if (feedItem.hasMedia() && feedItem.getMedia().isDownloaded()) {
countHasMedia++;
DBWriter.deleteFeedMediaOfItem(activity, feedItem.getMedia().getId());
}
}
showMessage(R.plurals.deleted_multi_episode_batch_label, countHasMedia);
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class EpisodeMultiSelectActionHandler method downloadChecked.
private void downloadChecked() {
// download the check episodes in the same order as they are currently displayed
List<DownloadRequest> requests = new ArrayList<>();
for (FeedItem episode : selectedItems) {
if (episode.hasMedia() && !episode.getFeed().isLocalFeed()) {
requests.add(DownloadRequestCreator.create(episode.getMedia()).build());
}
}
DownloadService.download(activity, true, requests.toArray(new DownloadRequest[0]));
showMessage(R.plurals.downloading_batch_label, requests.size());
}
use of de.danoeh.antennapod.model.feed.FeedItem in project AntennaPod by AntennaPod.
the class EpisodeMultiSelectActionHandler method queueChecked.
private void queueChecked() {
// Check if an episode actually contains any media files before adding it to queue
LongList toQueue = new LongList(selectedItems.size());
for (FeedItem episode : selectedItems) {
if (episode.hasMedia()) {
toQueue.add(episode.getId());
}
}
DBWriter.addQueueItem(activity, true, toQueue.toArray());
showMessage(R.plurals.added_to_queue_batch_label, toQueue.size());
}
Aggregations