diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java index ed8697adb..fc3052e20 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -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.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();