Merge pull request #4438 from ByteHamster/description-crash-hotfix
Fixed crash (fromCallable rethrows instead of calling onError)
This commit is contained in:
commit
490ae5ec1f
|
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
|||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.core.util.playback.Playable;
|
||||
import de.danoeh.antennapod.core.util.playback.PlaybackController;
|
||||
import de.danoeh.antennapod.core.util.playback.Timeline;
|
||||
import de.danoeh.antennapod.view.ShownotesWebView;
|
||||
|
@ -82,8 +83,10 @@ public class ItemDescriptionFragment extends Fragment {
|
|||
if (webViewLoader != null) {
|
||||
webViewLoader.dispose();
|
||||
}
|
||||
webViewLoader = Maybe.fromCallable(this::loadData)
|
||||
.subscribeOn(Schedulers.io())
|
||||
webViewLoader = Maybe.<String>create(emitter -> {
|
||||
Timeline timeline = new Timeline(getActivity(), controller.getMedia());
|
||||
emitter.onSuccess(timeline.processShownotes());
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(data -> {
|
||||
webvDescription.loadDataWithBaseURL("https://127.0.0.1", data, "text/html",
|
||||
|
@ -92,15 +95,6 @@ public class ItemDescriptionFragment extends Fragment {
|
|||
}, error -> Log.e(TAG, Log.getStackTraceString(error)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String loadData() {
|
||||
if (controller == null || controller.getMedia() == null) {
|
||||
return null;
|
||||
}
|
||||
Timeline timeline = new Timeline(getActivity(), controller.getMedia());
|
||||
return timeline.processShownotes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
|
|
Loading…
Reference in New Issue