diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2022-10-15 11:06:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 11:06:06 +0200 |
commit | 8ff9dd829aa24ef7f0581dadcf3726a64f289955 (patch) | |
tree | 2397eac221f3ea0f6c957804d7c85ad635cd2f48 /app | |
parent | 5dc3699361fd438a127beeafd49aa2c9b5269574 (diff) | |
parent | 7d0b0e57eeee5d7d958ab6f85cd37fa7f85f66ec (diff) | |
download | AntennaPod-8ff9dd829aa24ef7f0581dadcf3726a64f289955.zip |
Merge pull request #6147 from ByteHamster/shownotes-cleaner
Remove text colors from shownotes
Diffstat (limited to 'app')
3 files changed, 13 insertions, 12 deletions
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 518450f92..8a7d2432a 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java @@ -14,7 +14,7 @@ import androidx.fragment.app.Fragment; import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.util.playback.PlaybackController; -import de.danoeh.antennapod.core.util.playback.Timeline; +import de.danoeh.antennapod.core.util.gui.ShownotesCleaner; import de.danoeh.antennapod.model.feed.FeedMedia; import de.danoeh.antennapod.model.playback.Playable; import de.danoeh.antennapod.view.ShownotesWebView; @@ -99,8 +99,9 @@ public class ItemDescriptionFragment extends Fragment { } DBReader.loadDescriptionOfFeedItem(feedMedia.getItem()); } - Timeline timeline = new Timeline(getActivity(), media.getDescription(), media.getDuration()); - emitter.onSuccess(timeline.processShownotes()); + ShownotesCleaner shownotesCleaner = new ShownotesCleaner( + getActivity(), media.getDescription(), media.getDuration()); + emitter.onSuccess(shownotesCleaner.processShownotes()); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java index 04aeef1c5..c80545bb2 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java @@ -58,7 +58,7 @@ import de.danoeh.antennapod.core.util.FeedItemUtil; import de.danoeh.antennapod.ui.common.CircularProgressBar; import de.danoeh.antennapod.ui.common.ThemeUtils; import de.danoeh.antennapod.core.util.playback.PlaybackController; -import de.danoeh.antennapod.core.util.playback.Timeline; +import de.danoeh.antennapod.core.util.gui.ShownotesCleaner; import de.danoeh.antennapod.view.ShownotesWebView; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; @@ -438,7 +438,7 @@ public class ItemFragment extends Fragment { if (feedItem != null && context != null) { int duration = feedItem.getMedia() != null ? feedItem.getMedia().getDuration() : Integer.MAX_VALUE; DBReader.loadDescriptionOfFeedItem(feedItem); - Timeline t = new Timeline(context, feedItem.getDescription(), duration); + ShownotesCleaner t = new ShownotesCleaner(context, feedItem.getDescription(), duration); webviewData = t.processShownotes(); } return feedItem; diff --git a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java index 3f4cc17ae..9dc4a76c6 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java @@ -30,7 +30,7 @@ import de.danoeh.antennapod.core.util.Converter; import de.danoeh.antennapod.core.util.IntentUtils; import de.danoeh.antennapod.core.util.NetworkUtils; import de.danoeh.antennapod.core.util.ShareUtils; -import de.danoeh.antennapod.core.util.playback.Timeline; +import de.danoeh.antennapod.core.util.gui.ShownotesCleaner; public class ShownotesWebView extends WebView implements View.OnLongClickListener { private static final String TAG = "ShownotesWebView"; @@ -73,8 +73,8 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { - if (Timeline.isTimecodeLink(url) && timecodeSelectedListener != null) { - timecodeSelectedListener.accept(Timeline.getTimecodeLinkTime(url)); + if (ShownotesCleaner.isTimecodeLink(url) && timecodeSelectedListener != null) { + timecodeSelectedListener.accept(ShownotesCleaner.getTimecodeLinkTime(url)); } else { IntentUtils.openInBrowser(getContext(), url); } @@ -137,8 +137,8 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene ViewCompat.setElevation(s.getView(), 100); s.show(); } else if (itemId == R.id.go_to_position_item) { - if (Timeline.isTimecodeLink(selectedUrl) && timecodeSelectedListener != null) { - timecodeSelectedListener.accept(Timeline.getTimecodeLinkTime(selectedUrl)); + if (ShownotesCleaner.isTimecodeLink(selectedUrl) && timecodeSelectedListener != null) { + timecodeSelectedListener.accept(ShownotesCleaner.getTimecodeLinkTime(selectedUrl)); } else { Log.e(TAG, "Selected go_to_position_item, but URL was no timecode link: " + selectedUrl); } @@ -157,9 +157,9 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene return; } - if (Timeline.isTimecodeLink(selectedUrl)) { + if (ShownotesCleaner.isTimecodeLink(selectedUrl)) { menu.add(Menu.NONE, R.id.go_to_position_item, Menu.NONE, R.string.go_to_position_label); - menu.setHeaderTitle(Converter.getDurationStringLong(Timeline.getTimecodeLinkTime(selectedUrl))); + menu.setHeaderTitle(Converter.getDurationStringLong(ShownotesCleaner.getTimecodeLinkTime(selectedUrl))); } else { Uri uri = Uri.parse(selectedUrl); final Intent intent = new Intent(Intent.ACTION_VIEW, uri); |