summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java24
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java2
-rw-r--r--app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java19
-rw-r--r--app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java6
4 files changed, 27 insertions, 24 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
index c42695a57..ab049a8e5 100644
--- a/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
+++ b/app/src/androidTest/java/de/test/antennapod/util/playback/TimelineTest.java
@@ -55,7 +55,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -66,7 +66,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -77,7 +77,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -88,7 +88,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", 11 * 60 * 1000);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -99,7 +99,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -110,7 +110,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStr + " here.</p>", 2 * 60 * 1000);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -120,7 +120,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStrings[0] + " here. Hey look another one " + timeStrings[1] + " here!</p>", 2 * 60 * 60 * 1000);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 60 * 60 * 1000 + 10 * 60 * 1000 + 12 * 1000 }, timeStrings);
}
@@ -132,7 +132,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode " + timeStrings[0] + " here. Hey look another one " + timeStrings[1] + " here!</p>", 3 * 60 * 60 * 1000);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{ 10 * 60 * 1000 + 12 * 1000, 2 * 60 * 1000 + 12 * 1000 }, timeStrings);
}
@@ -143,7 +143,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode (" + timeStr + ") here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -154,7 +154,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode [" + timeStr + "] here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -165,7 +165,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, "<p> Some test text with a timecode <" + timeStr + "> here.</p>", Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[]{time}, new String[]{timeStr});
}
@@ -181,7 +181,7 @@ public class TimelineTest {
Playable p = newTestPlayable(null, shownotes.toString(), Integer.MAX_VALUE);
Timeline t = new Timeline(context, p);
- String res = t.processShownotes(true);
+ String res = t.processShownotes();
checkLinkCorrect(res, new long[0], new String[0]);
}
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 112e0bcb7..256615199 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemDescriptionFragment.java
@@ -85,7 +85,7 @@ public class ItemDescriptionFragment extends Fragment {
@NonNull
private String loadData() {
Timeline timeline = new Timeline(getActivity(), controller.getMedia());
- return timeline.processShownotes(true);
+ return timeline.processShownotes();
}
@Override
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 6c273e414..e1202704a 100644
--- a/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
+++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItemFragment.java
@@ -24,6 +24,7 @@ import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
+import com.google.android.material.snackbar.Snackbar;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.actionbutton.ItemActionButton;
@@ -42,6 +43,7 @@ import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.core.storage.DownloadRequester;
import de.danoeh.antennapod.core.util.Converter;
import de.danoeh.antennapod.core.util.DateUtils;
+import de.danoeh.antennapod.core.util.playback.PlaybackController;
import de.danoeh.antennapod.core.util.playback.Timeline;
import de.danoeh.antennapod.view.ShownotesWebView;
import io.reactivex.Observable;
@@ -96,6 +98,7 @@ public class ItemFragment extends Fragment {
private Button butAction2;
private Disposable disposable;
+ private PlaybackController controller;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -124,12 +127,11 @@ public class ItemFragment extends Fragment {
}
webvDescription = layout.findViewById(R.id.webvDescription);
webvDescription.setTimecodeSelectedListener(time -> {
- /*if (getActivity() != null && getActivity() instanceof MainActivity) {
- PlaybackController pc = ((MainActivity) getActivity()).getPlaybackController();
- if (pc != null) {
- pc.seekTo(time);
- }
- }*/
+ if (controller != null && item.getMedia().getIdentifier().equals(controller.getMedia().getIdentifier())) {
+ controller.seekTo(time);
+ } else {
+ Snackbar.make(getView(), R.string.play_this_to_seek_position, Snackbar.LENGTH_LONG).show();
+ }
});
registerForContextMenu(webvDescription);
@@ -191,6 +193,8 @@ public class ItemFragment extends Fragment {
public void onStart() {
super.onStart();
EventBus.getDefault().register(this);
+ controller = new PlaybackController(getActivity(), false);
+ controller.init();
}
@Override
@@ -206,6 +210,7 @@ public class ItemFragment extends Fragment {
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
+ controller.release();
}
@Override
@@ -389,7 +394,7 @@ public class ItemFragment extends Fragment {
Context context = getContext();
if (feedItem != null && context != null) {
Timeline t = new Timeline(context, feedItem);
- webviewData = t.processShownotes(false);
+ 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 6c290e3da..3ea57eb5e 100644
--- a/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java
+++ b/app/src/main/java/de/danoeh/antennapod/view/ShownotesWebView.java
@@ -3,6 +3,7 @@ package de.danoeh.antennapod.view;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.util.AttributeSet;
@@ -51,10 +52,7 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene
}
private void setup() {
- if (UserPreferences.getTheme() == R.style.Theme_AntennaPod_Dark
- || UserPreferences.getTheme() == R.style.Theme_AntennaPod_TrueBlack) {
- setBackgroundColor(ContextCompat.getColor(getContext(), R.color.black));
- }
+ setBackgroundColor(Color.TRANSPARENT);
if (!NetworkUtils.networkAvailable()) {
getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
// Use cached resources, even if they have expired