Observing filter changes shouldn't be needed

This commit is contained in:
inorichi 2015-09-30 21:11:16 +02:00
parent 710638e2eb
commit 3349227868
2 changed files with 1 additions and 15 deletions

View file

@ -30,9 +30,6 @@ public class LibraryPresenter extends BasePresenter {
@Inject
PreferencesHelper prefs;
private Subscription searchViewSubscription;
private PublishSubject<Observable<String>> searchViewPublishSubject;
public LibraryPresenter(LibraryView view) {
this.view = view;
App.getComponent(view.getActivity()).inject(this);
@ -54,14 +51,6 @@ public class LibraryPresenter extends BasePresenter {
view.getActivity().startActivity(intent);
}
public void initializeSearch() {
searchViewPublishSubject = PublishSubject.create();
searchViewSubscription = Observable.switchOnNext(searchViewPublishSubject)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(view.getAdapter().getFilter()::filter);
}
public void initializeMangas() {
db.manga.get()
.observeOn(mainThread())
@ -69,9 +58,7 @@ public class LibraryPresenter extends BasePresenter {
}
public void onQueryTextChange(String query) {
if (searchViewPublishSubject != null) {
searchViewPublishSubject.onNext(Observable.just(query));
}
view.getAdapter().getFilter().filter(query);
}
}

View file

@ -65,7 +65,6 @@ public class LibraryFragment extends BaseFragment implements LibraryView {
setupToolbar();
setMangaClickListener();
presenter.initializeMangas();
presenter.initializeSearch();
}
@Override