mirror of
https://github.com/YTVanced/Integrations
synced 2024-11-30 15:13:03 +00:00
fix a lot of unintended button behaviors
This commit is contained in:
parent
ac46231f24
commit
f57c5e1ee0
5 changed files with 13 additions and 12 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ public class ShieldButton {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean shouldBeShown() {
|
||||
static boolean shouldBeShown() {
|
||||
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<String> enabledCategories = new ArrayList<>(possibleBehaviours.length);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -103,7 +103,7 @@ public class VotingButton {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean shouldBeShown() {
|
||||
static boolean shouldBeShown() {
|
||||
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue