fix more issues with buttons i don't even know anymore

This commit is contained in:
caneleex 2021-04-29 22:47:40 +02:00
parent 234edac030
commit bf6c9e7b28
2 changed files with 12 additions and 8 deletions

View File

@ -204,9 +204,6 @@ public class PlayerController {
return; return;
} }
SponsorBlockUtils.showShieldButton(); // skipping from end to the video will show the buttons again
SponsorBlockUtils.showVoteButton();
SponsorSegment[] segments = sponsorSegmentsOfCurrentVideo; SponsorSegment[] segments = sponsorSegmentsOfCurrentVideo;
if (segments == null || segments.length == 0) return; if (segments == null || segments.length == 0) return;
@ -275,6 +272,10 @@ public class PlayerController {
* Called very high frequency (once every about 100ms), also in background. It sometimes triggers when a video is paused (couple times in the row with the same value) * Called very high frequency (once every about 100ms), also in background. It sometimes triggers when a video is paused (couple times in the row with the same value)
*/ */
public static void setCurrentVideoTimeHighPrecision(final long millis) { public static void setCurrentVideoTimeHighPrecision(final long millis) {
if ((millis < lastKnownVideoTime && lastKnownVideoTime >= currentVideoLength) || millis == 0) {
SponsorBlockUtils.showShieldButton(); // skipping from end to the video will show the buttons again
SponsorBlockUtils.showVoteButton();
}
if (lastKnownVideoTime > 0) { if (lastKnownVideoTime > 0) {
lastKnownVideoTime = millis; lastKnownVideoTime = millis;
VideoInformation.lastKnownVideoTime = lastKnownVideoTime; VideoInformation.lastKnownVideoTime = lastKnownVideoTime;

View File

@ -83,8 +83,8 @@ public class SponsorBlockSettings {
if (!isSponsorBlockEnabled) { if (!isSponsorBlockEnabled) {
SkipSegmentView.hide(); SkipSegmentView.hide();
NewSegmentHelperLayout.hide(); NewSegmentHelperLayout.hide();
ShieldButton.changeVisibilityImmediate(false); SponsorBlockUtils.hideShieldButton();
VotingButton.changeVisibilityImmediate(false); SponsorBlockUtils.hideVoteButton();
PlayerController.sponsorSegmentsOfCurrentVideo = null; PlayerController.sponsorSegmentsOfCurrentVideo = null;
} else if (/*isAddNewSegmentEnabled*/false) { } else if (/*isAddNewSegmentEnabled*/false) {
SponsorBlockUtils.showShieldButton(); SponsorBlockUtils.showShieldButton();
@ -93,13 +93,16 @@ public class SponsorBlockSettings {
isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled); isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled);
if (!isAddNewSegmentEnabled) { if (!isAddNewSegmentEnabled) {
NewSegmentHelperLayout.hide(); NewSegmentHelperLayout.hide();
ShieldButton.changeVisibilityImmediate(false); SponsorBlockUtils.hideShieldButton();
} else { } else {
ShieldButton.changeVisibilityImmediate(true); SponsorBlockUtils.showShieldButton();
} }
isVotingEnabled = preferences.getBoolean(PREFERENCES_KEY_VOTING_ENABLED, isVotingEnabled); isVotingEnabled = preferences.getBoolean(PREFERENCES_KEY_VOTING_ENABLED, isVotingEnabled);
VotingButton.changeVisibilityImmediate(isVotingEnabled); if (!isVotingEnabled)
SponsorBlockUtils.hideVoteButton();
else
SponsorBlockUtils.showVoteButton();
SegmentBehaviour[] possibleBehaviours = SegmentBehaviour.values(); SegmentBehaviour[] possibleBehaviours = SegmentBehaviour.values();
final ArrayList<String> enabledCategories = new ArrayList<>(possibleBehaviours.length); final ArrayList<String> enabledCategories = new ArrayList<>(possibleBehaviours.length);