Search in sources :

Example 6 with DownloaderUpdate

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

the class QueueFragment method onEventMainThread.

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

Example 7 with DownloaderUpdate

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

the class EpisodesListFragment 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 (event.hasChangedFeedUpdateStatus(isUpdatingFeeds)) {
        ((PagedToolbarFragment) getParentFragment()).invalidateOptionsMenuIfActive(this);
    }
    if (update.mediaIds.length > 0) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(episodes, mediaId);
            if (pos >= 0) {
                listAdapter.notifyItemChangedCompat(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 8 with DownloaderUpdate

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

the class FeedItemlistFragment 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 (event.hasChangedFeedUpdateStatus(isUpdatingFeed)) {
        updateSyncProgressBarVisibility();
    }
    if (adapter != null && update.mediaIds.length > 0 && feed != null) {
        for (long mediaId : update.mediaIds) {
            int pos = FeedItemUtil.indexOfItemWithMediaId(feed.getItems(), mediaId);
            if (pos >= 0) {
                adapter.notifyItemChangedCompat(pos);
            }
        }
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 9 with DownloaderUpdate

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

the class PlaybackHistoryFragment method onEvent.

public void onEvent(DownloadEvent event) {
    Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    downloaderList = update.downloaders;
    if (adapter != null) {
        adapter.notifyDataSetChanged();
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate)

Example 10 with DownloaderUpdate

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

the class RunningDownloadsFragment method onEvent.

public void onEvent(DownloadEvent event) {
    Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
    DownloaderUpdate update = event.update;
    downloaderList = update.downloaders;
    if (adapter != null) {
        adapter.notifyDataSetChanged();
    }
}
Also used : DownloaderUpdate(de.danoeh.antennapod.core.event.DownloaderUpdate)

Aggregations

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