diff --git a/app/src/main/java/pl/jakubweg/PlayerController.java b/app/src/main/java/pl/jakubweg/PlayerController.java index 0cb7982..93de59d 100644 --- a/app/src/main/java/pl/jakubweg/PlayerController.java +++ b/app/src/main/java/pl/jakubweg/PlayerController.java @@ -204,6 +204,9 @@ public class PlayerController { return; } + SponsorBlockUtils.showShieldButton(); // skipping from end to the video will show the buttons again + SponsorBlockUtils.showVoteButton(); + SponsorSegment[] segments = sponsorSegmentsOfCurrentVideo; if (segments == null || segments.length == 0) return; diff --git a/app/src/main/java/pl/jakubweg/ShieldButton.java b/app/src/main/java/pl/jakubweg/ShieldButton.java index b2774c3..670174c 100644 --- a/app/src/main/java/pl/jakubweg/ShieldButton.java +++ b/app/src/main/java/pl/jakubweg/ShieldButton.java @@ -103,7 +103,7 @@ public class ShieldButton { } } - private static boolean shouldBeShown() { + static boolean shouldBeShown() { return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled; } diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java b/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java index 91c47e1..d9630af 100644 --- a/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java +++ b/app/src/main/java/pl/jakubweg/SponsorBlockSettings.java @@ -83,25 +83,23 @@ public class SponsorBlockSettings { if (!isSponsorBlockEnabled) { SkipSegmentView.hide(); NewSegmentHelperLayout.hide(); - SponsorBlockUtils.hideShieldButton(); + ShieldButton.changeVisibilityImmediate(false); + VotingButton.changeVisibilityImmediate(false); PlayerController.sponsorSegmentsOfCurrentVideo = null; } else if (/*isAddNewSegmentEnabled*/false) { SponsorBlockUtils.showShieldButton(); } isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled); - if (!/*isAddNewSegmentEnabled*/false) { + if (!isAddNewSegmentEnabled) { NewSegmentHelperLayout.hide(); - SponsorBlockUtils.hideShieldButton(); + ShieldButton.changeVisibilityImmediate(false); } else { - SponsorBlockUtils.showShieldButton(); + ShieldButton.changeVisibilityImmediate(true); } isVotingEnabled = preferences.getBoolean(PREFERENCES_KEY_VOTING_ENABLED, isVotingEnabled); - if (!isVotingEnabled) - SponsorBlockUtils.hideVoteButton(); - else - SponsorBlockUtils.showVoteButton(); + VotingButton.changeVisibilityImmediate(isVotingEnabled); SegmentBehaviour[] possibleBehaviours = SegmentBehaviour.values(); final ArrayList enabledCategories = new ArrayList<>(possibleBehaviours.length); diff --git a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java b/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java index 6e1c8d5..d79fa6c 100644 --- a/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java +++ b/app/src/main/java/pl/jakubweg/SponsorBlockUtils.java @@ -296,7 +296,7 @@ public abstract class SponsorBlockUtils { public static void showShieldButton() { View i = ShieldButton._shieldBtn.get(); - if (i == null) return; + if (i == null || i.isShown() || !ShieldButton.shouldBeShown()) return; i.setVisibility(VISIBLE); i.bringToFront(); i.requestLayout(); @@ -311,7 +311,7 @@ public abstract class SponsorBlockUtils { public static void showVoteButton() { View i = VotingButton._votingButton.get(); - if (i == null) return; + if (i == null || i.isShown() || !VotingButton.shouldBeShown()) return; i.setVisibility(VISIBLE); i.bringToFront(); i.requestLayout(); diff --git a/app/src/main/java/pl/jakubweg/VotingButton.java b/app/src/main/java/pl/jakubweg/VotingButton.java index 215b49c..b0bd09e 100644 --- a/app/src/main/java/pl/jakubweg/VotingButton.java +++ b/app/src/main/java/pl/jakubweg/VotingButton.java @@ -103,7 +103,7 @@ public class VotingButton { } } - private static boolean shouldBeShown() { + static boolean shouldBeShown() { return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled; }