Search in sources :

Example 1 with DownloaderUpdate

use of de.danoeh.antennapod.core.event.DownloaderUpdate in project AntennaPod by AntennaPod.

the class ItemlistFragment method onEventMainThread.

public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    downloaderList = update.downloaders;
    if (isUpdatingFeed != event.update.feedIds.length > 0) {
        updateProgressBarVisibility();
    }
    if (adapter != null && update.mediaIds.length > 0) {
        adapter.notifyDataSetChanged();
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate)

Example 2 with DownloaderUpdate

use of de.danoeh.antennapod.core.event.DownloaderUpdate in project AntennaPod by AntennaPod.

the class AllEpisodesFragment method onEventMainThread.

public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    downloaderList = update.downloaders;
    if (isUpdatingFeeds != update.feedIds.length > 0) {
        getActivity().supportInvalidateOptionsMenu();
    }
    if (listAdapter != null && update.mediaIds.length > 0) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(episodes, mediaId);
            if (pos >= 0) {
                listAdapter.notifyItemChanged(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate)

Example 3 with DownloaderUpdate

use of de.danoeh.antennapod.core.event.DownloaderUpdate in project AntennaPod by AntennaPod.

the class PlaybackHistoryFragment method onEventMainThread.

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    if (adapter != null && update.mediaIds.length > 0) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(playbackHistory, mediaId);
            if (pos >= 0) {
                adapter.notifyItemChangedCompat(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 4 with DownloaderUpdate

use of de.danoeh.antennapod.core.event.DownloaderUpdate in project AntennaPod by AntennaPod.

the class ItemFragment method onEventMainThread.

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    downloaderList = update.downloaders;
    if (item == null || item.getMedia() == null) {
        return;
    }
    long mediaId = item.getMedia().getId();
    if (ArrayUtils.contains(update.mediaIds, mediaId)) {
        if (itemsLoaded && getActivity() != null) {
            updateButtons();
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 5 with DownloaderUpdate

use of de.danoeh.antennapod.core.event.DownloaderUpdate in project AntennaPod by AntennaPod.

the class SearchFragment method onEventMainThread.

@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) {
    Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    if (adapter != null && update.mediaIds.length > 0) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(results, mediaId);
            if (pos >= 0) {
                adapter.notifyItemChangedCompat(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

DownloaderUpdate (de.danoeh.antennapod.core.event.DownloaderUpdate)11 Subscribe (org.greenrobot.eventbus.Subscribe)7