Skip to content

Commit 433c6dc

Browse files
committed
Fix OnErrorNotImplementedException in SearchFragment.initSuggestionObserver()
Hopefully also fix the cause of the original error.
1 parent ed4fdad commit 433c6dc

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGrou
215215

216216
@Override
217217
public void onViewCreated(@NonNull final View rootView, final Bundle savedInstanceState) {
218+
searchBinding = FragmentSearchBinding.bind(rootView);
218219
super.onViewCreated(rootView, savedInstanceState);
219220
showSearchOnStart();
220221
initSearchListeners();
@@ -341,7 +342,6 @@ public void onActivityResult(final int requestCode, final int resultCode, final
341342
@Override
342343
protected void initViews(final View rootView, final Bundle savedInstanceState) {
343344
super.initViews(rootView, savedInstanceState);
344-
searchBinding = FragmentSearchBinding.bind(rootView);
345345

346346
searchBinding.suggestionsList.setAdapter(suggestionListAdapter);
347347
new ItemTouchHelper(new ItemTouchHelper.Callback() {
@@ -807,18 +807,21 @@ private void initSuggestionObserver() {
807807
})
808808
.subscribeOn(Schedulers.io())
809809
.observeOn(AndroidSchedulers.mainThread())
810-
.subscribe(listNotification -> {
811-
if (listNotification.isOnNext()) {
812-
if (listNotification.getValue() != null) {
813-
handleSuggestions(listNotification.getValue());
814-
}
815-
} else if (listNotification.isOnError()
816-
&& listNotification.getError() != null
817-
&& !ExceptionUtils.isInterruptedCaused(listNotification.getError())) {
818-
showSnackBarError(new ErrorInfo(listNotification.getError(),
819-
UserAction.GET_SUGGESTIONS, searchString, serviceId));
820-
}
821-
});
810+
.subscribe(
811+
listNotification -> {
812+
if (listNotification.isOnNext()) {
813+
if (listNotification.getValue() != null) {
814+
handleSuggestions(listNotification.getValue());
815+
}
816+
} else if (listNotification.isOnError()
817+
&& listNotification.getError() != null
818+
&& !ExceptionUtils.isInterruptedCaused(
819+
listNotification.getError())) {
820+
showSnackBarError(new ErrorInfo(listNotification.getError(),
821+
UserAction.GET_SUGGESTIONS, searchString, serviceId));
822+
}
823+
}, throwable -> showSnackBarError(new ErrorInfo(
824+
throwable, UserAction.GET_SUGGESTIONS, searchString, serviceId)));
822825
}
823826

824827
@Override

0 commit comments

Comments
 (0)