Make lists react to events
This commit is contained in:
parent
2e6fc7a0a5
commit
dd53a6ed94
|
@ -93,7 +93,7 @@ public class PlaybackHistoryFragment extends ListFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(sticky = true)
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
public void onEvent(DownloadEvent event) {
|
public void onEvent(DownloadEvent event) {
|
||||||
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
Log.d(TAG, "onEvent() called with: " + "event = [" + event + "]");
|
||||||
DownloaderUpdate update = event.update;
|
DownloaderUpdate update = event.update;
|
||||||
|
|
|
@ -21,11 +21,11 @@ import androidx.fragment.app.Fragment;
|
||||||
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.FeedItemlistAdapter;
|
import de.danoeh.antennapod.adapter.FeedItemlistAdapter;
|
||||||
|
import de.danoeh.antennapod.core.event.DownloadEvent;
|
||||||
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
|
import de.danoeh.antennapod.core.event.UnreadItemsUpdateEvent;
|
||||||
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;
|
||||||
import de.danoeh.antennapod.core.feed.FeedItem;
|
import de.danoeh.antennapod.core.feed.FeedItem;
|
||||||
import de.danoeh.antennapod.core.storage.DBTasks;
|
|
||||||
import de.danoeh.antennapod.core.storage.FeedSearcher;
|
import de.danoeh.antennapod.core.storage.FeedSearcher;
|
||||||
import de.danoeh.antennapod.view.EmptyViewHandler;
|
import de.danoeh.antennapod.view.EmptyViewHandler;
|
||||||
import io.reactivex.Observable;
|
import io.reactivex.Observable;
|
||||||
|
@ -34,11 +34,10 @@ import io.reactivex.disposables.Disposable;
|
||||||
import io.reactivex.schedulers.Schedulers;
|
import io.reactivex.schedulers.Schedulers;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
import java.util.concurrent.FutureTask;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
@ -168,6 +167,14 @@ public class SearchFragment extends Fragment implements AdapterView.OnItemClickL
|
||||||
search();
|
search();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
|
||||||
|
public void onEventMainThread(DownloadEvent event) {
|
||||||
|
Log.d(TAG, "onEventMainThread() called with: " + "event = [" + event + "]");
|
||||||
|
if (searchAdapter != null) {
|
||||||
|
searchAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onSearchResults(List<FeedComponent> results) {
|
private void onSearchResults(List<FeedComponent> results) {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
searchResults = results;
|
searchResults = results;
|
||||||
|
|
Loading…
Reference in New Issue