Migrated unread items update to EventBus

This commit is contained in:
ByteHamster 2019-10-25 11:12:31 +02:00
parent b5ab7d6d3c
commit d4b9d0fd59
11 changed files with 89 additions and 82 deletions

View File

@ -34,6 +34,7 @@ import android.widget.Toast;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@ -84,8 +85,7 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
private static final String TAG = "MainActivity"; private static final String TAG = "MainActivity";
private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE;
| EventDistributor.UNREAD_ITEMS_UPDATE;
public static final String PREF_NAME = "MainActivityPrefs"; public static final String PREF_NAME = "MainActivityPrefs";
public static final String PREF_IS_FIRST_LAUNCH = "prefMainActivityIsFirstLaunch"; public static final String PREF_IS_FIRST_LAUNCH = "prefMainActivityIsFirstLaunch";
@ -817,6 +817,11 @@ public class MainActivity extends CastEnabledActivity implements NavDrawerActivi
snackbar.show(); snackbar.show();
} }
@Subscribe
public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
loadData();
}
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() { private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override @Override

View File

@ -17,7 +17,6 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.DownloadedEpisodesListAdapter; import de.danoeh.antennapod.adapter.DownloadedEpisodesListAdapter;
import de.danoeh.antennapod.core.event.DownloadLogEvent; import de.danoeh.antennapod.core.event.DownloadLogEvent;
import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.FeedItem; import de.danoeh.antennapod.core.feed.FeedItem;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
@ -67,14 +66,12 @@ public class CompletedDownloadsFragment extends ListFragment {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
EventDistributor.getInstance().register(contentUpdate);
loadItems(); loadItems();
} }
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
if (disposable != null) { if (disposable != null) {
disposable.dispose(); disposable.dispose();
} }
@ -141,15 +138,6 @@ public class CompletedDownloadsFragment extends ListFragment {
} }
}; };
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EventDistributor.UNREAD_ITEMS_UPDATE) != 0) {
loadItems();
}
}
};
@Subscribe @Subscribe
public void onDownloadLogChanged(DownloadLogEvent event) { public void onDownloadLogChanged(DownloadLogEvent event) {
loadItems(); loadItems();

View File

@ -24,8 +24,10 @@ import android.widget.Toast;
import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration; import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
import de.danoeh.antennapod.core.event.DownloadLogEvent;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent; import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.event.PlayerStatusEvent; import de.danoeh.antennapod.core.event.PlayerStatusEvent;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -66,8 +68,7 @@ public abstract class EpisodesListFragment extends Fragment {
public static final String TAG = "EpisodesListFragment"; public static final String TAG = "EpisodesListFragment";
private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE | private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE;
EventDistributor.UNREAD_ITEMS_UPDATE;
private static final String DEFAULT_PREF_NAME = "PrefAllEpisodesFragment"; private static final String DEFAULT_PREF_NAME = "PrefAllEpisodesFragment";
private static final String PREF_SCROLL_POSITION = "scroll_position"; private static final String PREF_SCROLL_POSITION = "scroll_position";
@ -414,14 +415,23 @@ public abstract class EpisodesListFragment extends Fragment {
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN) private void updateUi() {
public void onPlayerStatusChanged(PlayerStatusEvent event) {
loadItems(); loadItems();
if (isUpdatingFeeds != updateRefreshMenuItemChecker.isRefreshing()) { if (isUpdatingFeeds != updateRefreshMenuItemChecker.isRefreshing()) {
requireActivity().invalidateOptionsMenu(); requireActivity().invalidateOptionsMenu();
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPlayerStatusChanged(PlayerStatusEvent event) {
updateUi();
}
@Subscribe
public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
updateUi();
}
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() { private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override @Override
public void update(EventDistributor eventDistributor, Integer arg) { public void update(EventDistributor eventDistributor, Integer arg) {

View File

@ -30,6 +30,7 @@ import com.joanzapata.iconify.widget.IconTextView;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent; import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.event.PlayerStatusEvent; import de.danoeh.antennapod.core.event.PlayerStatusEvent;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -81,8 +82,7 @@ import io.reactivex.schedulers.Schedulers;
public class FeedItemlistFragment extends ListFragment { public class FeedItemlistFragment extends ListFragment {
private static final String TAG = "ItemlistFragment"; private static final String TAG = "ItemlistFragment";
private static final int EVENTS = EventDistributor.UNREAD_ITEMS_UPDATE private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE;
| EventDistributor.FEED_LIST_UPDATE;
private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id"; private static final String ARGUMENT_FEED_ID = "argument.de.danoeh.antennapod.feed_id";
@ -391,13 +391,22 @@ public class FeedItemlistFragment extends ListFragment {
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN) private void updateUi() {
public void onPlayerStatusChanged(PlayerStatusEvent event) {
refreshHeaderView(); refreshHeaderView();
loadItems(); loadItems();
updateProgressBarVisibility(); updateProgressBarVisibility();
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPlayerStatusChanged(PlayerStatusEvent event) {
updateUi();
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
updateUi();
}
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() { private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override @Override

View File

@ -35,6 +35,7 @@ import com.bumptech.glide.request.RequestOptions;
import com.joanzapata.iconify.Iconify; import com.joanzapata.iconify.Iconify;
import com.joanzapata.iconify.widget.IconButton; import com.joanzapata.iconify.widget.IconButton;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
@ -81,9 +82,6 @@ import io.reactivex.schedulers.Schedulers;
public class ItemFragment extends Fragment implements OnSwipeGesture { public class ItemFragment extends Fragment implements OnSwipeGesture {
private static final String TAG = "ItemFragment"; private static final String TAG = "ItemFragment";
private static final int EVENTS = EventDistributor.UNREAD_ITEMS_UPDATE;
private static final String ARG_FEEDITEMS = "feeditems"; private static final String ARG_FEEDITEMS = "feeditems";
private static final String ARG_FEEDITEM_POS = "feeditem_pos"; private static final String ARG_FEEDITEM_POS = "feeditem_pos";
@ -268,7 +266,6 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
EventDistributor.getInstance().register(contentUpdate);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
load(); load();
} }
@ -285,7 +282,6 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
EventBus.getDefault().unregister(this); EventBus.getDefault().unregister(this);
} }
@ -558,15 +554,10 @@ public class ItemFragment extends Fragment implements OnSwipeGesture {
} }
} }
@Subscribe
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() { public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
@Override load();
public void update(EventDistributor eventDistributor, Integer arg) { }
if ((arg & EVENTS) != 0) {
load();
}
}
};
private void load() { private void load() {
if(disposable != null) { if(disposable != null) {

View File

@ -28,6 +28,7 @@ import com.yqritc.recyclerviewflexibledivider.HorizontalDividerItemDecoration;
import de.danoeh.antennapod.core.event.PlaybackPositionEvent; import de.danoeh.antennapod.core.event.PlaybackPositionEvent;
import de.danoeh.antennapod.core.event.PlayerStatusEvent; import de.danoeh.antennapod.core.event.PlayerStatusEvent;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -74,11 +75,8 @@ import static de.danoeh.antennapod.dialog.EpisodesApplyActionFragment.ACTION_REM
* Shows all items in the queue * Shows all items in the queue
*/ */
public class QueueFragment extends Fragment { public class QueueFragment extends Fragment {
public static final String TAG = "QueueFragment"; public static final String TAG = "QueueFragment";
private static final int EVENTS = EventDistributor.UNREAD_ITEMS_UPDATE; // sent when playback position is reset
private TextView infoBar; private TextView infoBar;
private RecyclerView recyclerView; private RecyclerView recyclerView;
private QueueRecyclerAdapter recyclerAdapter; private QueueRecyclerAdapter recyclerAdapter;
@ -116,7 +114,6 @@ public class QueueFragment extends Fragment {
onFragmentLoaded(true); onFragmentLoaded(true);
} }
loadItems(true); loadItems(true);
EventDistributor.getInstance().register(contentUpdate);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
} }
@ -129,9 +126,8 @@ public class QueueFragment extends Fragment {
@Override @Override
public void onStop() { public void onStop() {
super.onStop(); super.onStop();
EventDistributor.getInstance().unregister(contentUpdate);
EventBus.getDefault().unregister(this); EventBus.getDefault().unregister(this);
if(disposable != null) { if (disposable != null) {
disposable.dispose(); disposable.dispose();
} }
} }
@ -229,6 +225,15 @@ public class QueueFragment extends Fragment {
} }
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
// Sent when playback position is reset
loadItems(false);
if (isUpdatingFeeds != updateRefreshMenuItemChecker.isRefreshing()) {
getActivity().supportInvalidateOptionsMenu();
}
}
private void saveScrollPosition() { private void saveScrollPosition() {
int firstItem = layoutManager.findFirstVisibleItemPosition(); int firstItem = layoutManager.findFirstVisibleItemPosition();
View firstItemView = layoutManager.findViewByPosition(firstItem); View firstItemView = layoutManager.findViewByPosition(firstItem);
@ -718,19 +723,6 @@ public class QueueFragment extends Fragment {
} }
}; };
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() {
@Override
public void update(EventDistributor eventDistributor, Integer arg) {
if ((arg & EVENTS) != 0) {
Log.d(TAG, "arg: " + arg);
loadItems(false);
if (isUpdatingFeeds != updateRefreshMenuItemChecker.isRefreshing()) {
getActivity().supportInvalidateOptionsMenu();
}
}
}
};
private void loadItems(final boolean restoreScrollPosition) { private void loadItems(final boolean restoreScrollPosition) {
Log.d(TAG, "loadItems()"); Log.d(TAG, "loadItems()");
if(disposable != null) { if(disposable != null) {

View File

@ -20,6 +20,7 @@ import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.SearchlistAdapter; import de.danoeh.antennapod.adapter.SearchlistAdapter;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.feed.FeedComponent; import de.danoeh.antennapod.core.feed.FeedComponent;
@ -30,6 +31,9 @@ import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
/** /**
* Performs a search operation on all feeds or one specific feed and displays the search result. * Performs a search operation on all feeds or one specific feed and displays the search result.
@ -76,7 +80,6 @@ public class SearchFragment extends ListFragment {
@Override @Override
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
EventDistributor.getInstance().register(contentUpdate);
search(); search();
} }
@ -86,7 +89,6 @@ public class SearchFragment extends ListFragment {
if(disposable != null) { if(disposable != null) {
disposable.dispose(); disposable.dispose();
} }
EventDistributor.getInstance().unregister(contentUpdate);
} }
@Override @Override
@ -103,6 +105,13 @@ public class SearchFragment extends ListFragment {
searchAdapter = new SearchlistAdapter(getActivity(), itemAccess); searchAdapter = new SearchlistAdapter(getActivity(), itemAccess);
setListAdapter(searchAdapter); setListAdapter(searchAdapter);
EventBus.getDefault().register(this);
}
@Override
public void onDestroyView() {
super.onDestroyView();
EventBus.getDefault().unregister(this);
} }
@Override @Override
@ -145,14 +154,10 @@ public class SearchFragment extends ListFragment {
MenuItemCompat.setActionView(item, sv); MenuItemCompat.setActionView(item, sv);
} }
private final EventDistributor.EventListener contentUpdate = new EventDistributor.EventListener() { @Subscribe
@Override public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
public void update(EventDistributor eventDistributor, Integer arg) { search();
if ((arg & EventDistributor.UNREAD_ITEMS_UPDATE) != 0) { }
search();
}
}
};
private void onSearchResults(List<SearchResult> results) { private void onSearchResults(List<SearchResult> results) {
searchResults = results; searchResults = results;

View File

@ -28,6 +28,7 @@ import de.danoeh.antennapod.adapter.SubscriptionsAdapter;
import de.danoeh.antennapod.core.asynctask.FeedRemover; import de.danoeh.antennapod.core.asynctask.FeedRemover;
import de.danoeh.antennapod.core.dialog.ConfirmationDialog; import de.danoeh.antennapod.core.dialog.ConfirmationDialog;
import de.danoeh.antennapod.core.event.DownloadEvent; import de.danoeh.antennapod.core.event.DownloadEvent;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import de.danoeh.antennapod.core.feed.EventDistributor; import de.danoeh.antennapod.core.feed.EventDistributor;
import de.danoeh.antennapod.core.feed.Feed; import de.danoeh.antennapod.core.feed.Feed;
import de.danoeh.antennapod.core.preferences.PlaybackPreferences; import de.danoeh.antennapod.core.preferences.PlaybackPreferences;
@ -56,8 +57,7 @@ public class SubscriptionFragment extends Fragment {
public static final String TAG = "SubscriptionFragment"; public static final String TAG = "SubscriptionFragment";
private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE private static final int EVENTS = EventDistributor.FEED_LIST_UPDATE;
| EventDistributor.UNREAD_ITEMS_UPDATE;
private static final String PREFS = "SubscriptionFragment"; private static final String PREFS = "SubscriptionFragment";
private static final String PREF_NUM_COLUMNS = "columns"; private static final String PREF_NUM_COLUMNS = "columns";
@ -304,6 +304,11 @@ public class SubscriptionFragment extends Fragment {
} }
}; };
@Subscribe
public void onUnreadItemsChanged(UnreadItemsUpdateEvent event) {
loadSubscriptions();
}
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN) @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(DownloadEvent event) { public void onEventMainThread(DownloadEvent event) {
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]"); Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");

View File

@ -0,0 +1,6 @@
package de.danoeh.antennapod.core.event;
public class UnreadItemsUpdateEvent {
public UnreadItemsUpdateEvent() {
}
}

View File

@ -21,7 +21,6 @@ public class EventDistributor extends Observable {
private static final String TAG = "EventDistributor"; private static final String TAG = "EventDistributor";
public static final int FEED_LIST_UPDATE = 1; public static final int FEED_LIST_UPDATE = 1;
public static final int UNREAD_ITEMS_UPDATE = 2;
private final Handler handler; private final Handler handler;
private final AbstractQueue<Integer> events; private final AbstractQueue<Integer> events;
@ -74,10 +73,6 @@ public class EventDistributor extends Observable {
super.addObserver(observer); super.addObserver(observer);
} }
public void sendUnreadItemsUpdateBroadcast() {
addEvent(UNREAD_ITEMS_UPDATE);
}
public void sendFeedUpdateBroadcast() { public void sendFeedUpdateBroadcast() {
addEvent(FEED_LIST_UPDATE); addEvent(FEED_LIST_UPDATE);
} }

View File

@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import de.danoeh.antennapod.core.event.DownloadLogEvent; import de.danoeh.antennapod.core.event.DownloadLogEvent;
import de.danoeh.antennapod.core.event.PlaybackHistoryEvent; import de.danoeh.antennapod.core.event.PlaybackHistoryEvent;
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import java.io.File; import java.io.File;
@ -125,7 +126,7 @@ public class DBWriter {
} }
} }
EventBus.getDefault().post(FeedItemEvent.deletedMedia(Collections.singletonList(media.getItem()))); EventBus.getDefault().post(FeedItemEvent.deletedMedia(Collections.singletonList(media.getItem())));
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
return true; return true;
} }
@ -611,7 +612,7 @@ public class DBWriter {
adapter.setFeedItemRead(played, itemIds); adapter.setFeedItemRead(played, itemIds);
adapter.close(); adapter.close();
if (broadcastUpdate) { if (broadcastUpdate) {
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
} }
}); });
} }
@ -643,7 +644,7 @@ public class DBWriter {
resetMediaPosition); resetMediaPosition);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -659,7 +660,7 @@ public class DBWriter {
adapter.setFeedItems(FeedItem.NEW, FeedItem.UNPLAYED, feedId); adapter.setFeedItems(FeedItem.NEW, FeedItem.UNPLAYED, feedId);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -675,7 +676,7 @@ public class DBWriter {
adapter.setFeedItems(FeedItem.PLAYED, feedId); adapter.setFeedItems(FeedItem.PLAYED, feedId);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -689,7 +690,7 @@ public class DBWriter {
adapter.setFeedItems(FeedItem.PLAYED); adapter.setFeedItems(FeedItem.PLAYED);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -703,7 +704,7 @@ public class DBWriter {
adapter.setFeedItems(FeedItem.NEW, FeedItem.UNPLAYED); adapter.setFeedItems(FeedItem.NEW, FeedItem.UNPLAYED);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -886,7 +887,7 @@ public class DBWriter {
adapter.open(); adapter.open();
adapter.setFeedItemAutoDownload(feedItem, autoDownload ? 1 : 0); adapter.setFeedItemAutoDownload(feedItem, autoDownload ? 1 : 0);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -905,7 +906,7 @@ public class DBWriter {
adapter.open(); adapter.open();
adapter.setFeedItemAutoDownload(feedItem, autoDownload); adapter.setFeedItemAutoDownload(feedItem, autoDownload);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }
@ -923,7 +924,7 @@ public class DBWriter {
adapter.open(); adapter.open();
adapter.setFeedsItemsAutoDownload(feed, autoDownload); adapter.setFeedsItemsAutoDownload(feed, autoDownload);
adapter.close(); adapter.close();
EventDistributor.getInstance().sendUnreadItemsUpdateBroadcast(); EventBus.getDefault().post(new UnreadItemsUpdateEvent());
}); });
} }