Fix OnErrorNotImplementedException in SearchFragment.initSuggestionObserver()

Hopefully also fix the cause of the original error.
This commit is contained in:
TobiGr 2021-09-04 22:36:10 +02:00
parent ed4fdadd4d
commit 433c6dc33b
1 changed files with 16 additions and 13 deletions

View File

@ -215,6 +215,7 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
@Override @Override
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) { public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
searchBinding = FragmentSearchBinding.bind(rootView);
super.onViewCreated(rootView, savedInstanceState); super.onViewCreated(rootView, savedInstanceState);
showSearchOnStart(); showSearchOnStart();
initSearchListeners(); initSearchListeners();
@ -341,7 +342,6 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
@Override @Override
protected void initViews(final View rootView, final Bundle savedInstanceState) { protected void initViews(final View rootView, final Bundle savedInstanceState) {
super.initViews(rootView, savedInstanceState); super.initViews(rootView, savedInstanceState);
searchBinding = FragmentSearchBinding.bind(rootView);
searchBinding.suggestionsList.setAdapter(suggestionListAdapter); searchBinding.suggestionsList.setAdapter(suggestionListAdapter);
new ItemTouchHelper(new ItemTouchHelper.Callback() { new ItemTouchHelper(new ItemTouchHelper.Callback() {
@ -807,18 +807,21 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
}) })
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(listNotification -> { .subscribe(
if (listNotification.isOnNext()) { listNotification -> {
if (listNotification.getValue() != null) { if (listNotification.isOnNext()) {
handleSuggestions(listNotification.getValue()); if (listNotification.getValue() != null) {
} handleSuggestions(listNotification.getValue());
} else if (listNotification.isOnError() }
&& listNotification.getError() != null } else if (listNotification.isOnError()
&& !ExceptionUtils.isInterruptedCaused(listNotification.getError())) { && listNotification.getError() != null
showSnackBarError(new ErrorInfo(listNotification.getError(), && !ExceptionUtils.isInterruptedCaused(
UserAction.GET_SUGGESTIONS, searchString, serviceId)); listNotification.getError())) {
} showSnackBarError(new ErrorInfo(listNotification.getError(),
}); UserAction.GET_SUGGESTIONS, searchString, serviceId));
}
}, throwable -> showSnackBarError(new ErrorInfo(
throwable, UserAction.GET_SUGGESTIONS, searchString, serviceId)));
} }
@Override @Override