-
-
Notifications
You must be signed in to change notification settings - Fork 448
feat(SponsorBlock): Add undo automatic skip button #5145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(SponsorBlock): Add undo automatic skip button #5145
Conversation
@@ -99,6 +99,10 @@ public class SegmentPlaybackController { | |||
@Nullable | |||
private static String timeWithoutSegments; | |||
|
|||
@Nullable | |||
private static SponsorSegment lastAutoSkippedSegment; | |||
private static long lastAutoSkippedSegmentStartTime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no need for a long field, when lastAutoSkippedSegment
already has the start time.
@@ -545,6 +551,9 @@ private static void skipSegment(@NonNull SponsorSegment segmentToSkip, boolean u | |||
|
|||
final boolean videoIsPaused = VideoState.getCurrent() == VideoState.PAUSED; | |||
if (!userManuallySkipped) { | |||
lastAutoSkippedSegment = segmentToSkip; | |||
lastAutoSkippedSegmentStartTime = segmentToSkip.start; | |||
SponsorBlockViewController.showUndoSkipButton(); // Show undo button after auto skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This functionality should be a setting, and should be default off since the only default auto skip is sponsors (which most users never want to watch, and thus an undo button is unnecessary on screen clutter).
@@ -35,6 +35,8 @@ public class SkipSponsorButton extends FrameLayout { | |||
private static final boolean highContrast = false; | |||
private final LinearLayout skipSponsorBtnContainer; | |||
private final TextView skipSponsorTextView; | |||
private final ImageView skipSponsorButtonIcon; // Existing field, but adding it here for clarity in diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the field isn't used then there's no reason to have it.
// Clear the stored segment after successful undo | ||
lastAutoSkippedSegment = null; | ||
lastAutoSkippedSegmentStartTime = 0; | ||
SponsorBlockViewController.hideUndoSkipButton(); // Will implement this next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the undo button set hidden? Does it remain on screen all the time until the next segment? This should hide itself similar to the auto hiding skip button.
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="#FFFFFF" | ||
android:pathData="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v6h6l-2.91-2.91c1.17-1.17 2.71-1.9 4.41-1.9 3.31 0 6 2.69 6 6s-2.69 6-6 6c-1.66 0-3.1-.69-4.18-1.82L7.2 16.2c.75.75 1.79 1.22 2.8 1.34V19c-2.02-.22-3.8-.95-5.18-2.08L2 19v-6h6l-2.91 2.91c1.17 1.17 2.71 1.9 4.41 1.9 3.31 0 6-2.69 6-6s-2.69-6-6-6z" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a screenshot of what this looks like in app.
You need to enable allow edits from maintainers |
@NomanMohammadOfficial remove the linked issue from this unfinished and abandoned pull request. Because you deleted the repo now only you can unlink the issue. |
This PR introduces an 'undo automatic skip' feature for SponsorBlock.
Changes include:
SegmentPlaybackController.java
.undoLastAutoSkip()
method to allow seeking back to the start of the skipped segment.revanced_sb_undo.xml
) for the undo button icon.revanced_sb_skip_sponsor_button.xml
layout.SkipSponsorButton.java
.SponsorBlockViewController.java
.