From 2a84466d3fe0f96f786346646f7afa1d2d5a709b Mon Sep 17 00:00:00 2001 From: Hans-Peter Lehmann Date: Mon, 25 May 2026 22:31:18 +0200 Subject: [PATCH] Fix clicking position links in shownotes (#8477) ### Description Fix clicking position links in shownotes with new playback service ### Checklist - [x] I have read the contribution guidelines: https://github.com/AntennaPod/AntennaPod/blob/develop/CONTRIBUTING.md#submit-a-pull-request - [x] I have performed a self-review of my code, going through my changes line by line and carefully considering why this line change is necessary - [x] I have run the automated code checks using `./gradlew checkstyle lint` - [x] My code follows the style guidelines of the AntennaPod project: https://antennapod.org/contribute/develop/app/code-style - [x] I have mentioned the corresponding issue and the relevant keyword (e.g., "Closes: #xy") in the description (see https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) - [x] If it is a core feature, I have added automated tests --- .../antennapod/ui/screen/episode/ItemFragment.java | 6 ++++++ .../playback/audio/ItemDescriptionFragment.java | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemFragment.java index 8fa69e679..832ad1a71 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/episode/ItemFragment.java @@ -24,6 +24,7 @@ import com.skydoves.balloon.ArrowOrientation; import com.skydoves.balloon.ArrowOrientationRules; import com.skydoves.balloon.Balloon; import com.skydoves.balloon.BalloonAnimation; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.actionbutton.CancelDownloadActionButton; import de.danoeh.antennapod.actionbutton.DeleteActionButton; @@ -125,6 +126,11 @@ public class ItemFragment extends Fragment { new MessageEvent(getString(R.string.play_this_to_seek_position_message))); return; } + if (BuildConfig.USE_MEDIA3_PLAYBACK_SERVICE) { + PlaybackController.bindToMedia3Service(getActivity(), controller -> + controller.seekTo(time)); + return; + } PlaybackController.bindToService(getActivity(), playbackService -> { if (item.getMedia() != null && playbackService.getPlayable() != null && Objects.equals(item.getMedia().getIdentifier(), diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/ItemDescriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/ItemDescriptionFragment.java index b78a07e5c..7f1768828 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/playback/audio/ItemDescriptionFragment.java @@ -13,6 +13,7 @@ import android.view.ViewGroup; import androidx.fragment.app.Fragment; +import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.playback.service.PlaybackController; @@ -49,9 +50,15 @@ public class ItemDescriptionFragment extends Fragment { Log.d(TAG, "Creating view"); View root = inflater.inflate(R.layout.item_description_fragment, container, false); webvDescription = root.findViewById(R.id.webview); - webvDescription.setTimecodeSelectedListener(time -> + webvDescription.setTimecodeSelectedListener(time -> { + if (BuildConfig.USE_MEDIA3_PLAYBACK_SERVICE) { + PlaybackController.bindToMedia3Service(getActivity(), controller -> + controller.seekTo(time)); + } else { PlaybackController.bindToService(getActivity(), playbackService -> - playbackService.seekTo(time))); + playbackService.seekTo(time)); + } + }); webvDescription.setPageFinishedListener(() -> { // Restoring the scroll position might not always work webvDescription.postDelayed(ItemDescriptionFragment.this::restoreFromPreference, 50);