Observing filter changes shouldn't be needed
This commit is contained in:
parent
710638e2eb
commit
3349227868
2 changed files with 1 additions and 15 deletions
|
@ -30,9 +30,6 @@ public class LibraryPresenter extends BasePresenter {
|
||||||
@Inject
|
@Inject
|
||||||
PreferencesHelper prefs;
|
PreferencesHelper prefs;
|
||||||
|
|
||||||
private Subscription searchViewSubscription;
|
|
||||||
private PublishSubject<Observable<String>> searchViewPublishSubject;
|
|
||||||
|
|
||||||
public LibraryPresenter(LibraryView view) {
|
public LibraryPresenter(LibraryView view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
App.getComponent(view.getActivity()).inject(this);
|
App.getComponent(view.getActivity()).inject(this);
|
||||||
|
@ -54,14 +51,6 @@ public class LibraryPresenter extends BasePresenter {
|
||||||
view.getActivity().startActivity(intent);
|
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() {
|
public void initializeMangas() {
|
||||||
db.manga.get()
|
db.manga.get()
|
||||||
.observeOn(mainThread())
|
.observeOn(mainThread())
|
||||||
|
@ -69,9 +58,7 @@ public class LibraryPresenter extends BasePresenter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onQueryTextChange(String query) {
|
public void onQueryTextChange(String query) {
|
||||||
if (searchViewPublishSubject != null) {
|
view.getAdapter().getFilter().filter(query);
|
||||||
searchViewPublishSubject.onNext(Observable.just(query));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,6 @@ public class LibraryFragment extends BaseFragment implements LibraryView {
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
setMangaClickListener();
|
setMangaClickListener();
|
||||||
presenter.initializeMangas();
|
presenter.initializeMangas();
|
||||||
presenter.initializeSearch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Reference in a new issue