SponsorBlock: Fixed an issue where marked segments would persist on videos with no segments

The MarkableSeekBar now has a way to clear the marked segments.
This commit is contained in:
polymorphicshade 2020-12-15 00:24:10 -07:00
parent 63eb637ec0
commit cd9ff1a48f
2 changed files with 12 additions and 7 deletions

View file

@ -623,18 +623,18 @@ public abstract class VideoPlayer extends BasePlayer
}
private void markSegments() {
final VideoSegment[] segments = getVideoSegments();
if (segments == null || segments.length == 0) {
return;
}
if (!(playbackSeekBar instanceof MarkableSeekBar)) {
return;
}
final MarkableSeekBar markableSeekBar = (MarkableSeekBar) playbackSeekBar;
markableSeekBar.seekBarMarkers.clear();
markableSeekBar.clearMarkers();
final VideoSegment[] segments = getVideoSegments();
if (segments == null || segments.length == 0) {
return;
}
for (final VideoSegment segment : segments) {
final Integer color = parseSegmentCategory(segment.category);

View file

@ -101,4 +101,9 @@ public class MarkableSeekBar extends AppCompatSeekBar {
super.setProgressDrawable(layerDrawable);
}
public void clearMarkers() {
seekBarMarkers.clear();
super.setProgressDrawable(originalProgressDrawable);
}
}