mirror of
https://github.com/YTVanced/Integrations
synced 2024-12-02 16:07:26 +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;
|
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;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class ShieldButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean shouldBeShown() {
|
static boolean shouldBeShown() {
|
||||||
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,25 +83,23 @@ public class SponsorBlockSettings {
|
||||||
if (!isSponsorBlockEnabled) {
|
if (!isSponsorBlockEnabled) {
|
||||||
SkipSegmentView.hide();
|
SkipSegmentView.hide();
|
||||||
NewSegmentHelperLayout.hide();
|
NewSegmentHelperLayout.hide();
|
||||||
SponsorBlockUtils.hideShieldButton();
|
ShieldButton.changeVisibilityImmediate(false);
|
||||||
|
VotingButton.changeVisibilityImmediate(false);
|
||||||
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
PlayerController.sponsorSegmentsOfCurrentVideo = null;
|
||||||
} else if (/*isAddNewSegmentEnabled*/false) {
|
} else if (/*isAddNewSegmentEnabled*/false) {
|
||||||
SponsorBlockUtils.showShieldButton();
|
SponsorBlockUtils.showShieldButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled);
|
isAddNewSegmentEnabled = preferences.getBoolean(PREFERENCES_KEY_NEW_SEGMENT_ENABLED, isAddNewSegmentEnabled);
|
||||||
if (!/*isAddNewSegmentEnabled*/false) {
|
if (!isAddNewSegmentEnabled) {
|
||||||
NewSegmentHelperLayout.hide();
|
NewSegmentHelperLayout.hide();
|
||||||
SponsorBlockUtils.hideShieldButton();
|
ShieldButton.changeVisibilityImmediate(false);
|
||||||
} else {
|
} else {
|
||||||
SponsorBlockUtils.showShieldButton();
|
ShieldButton.changeVisibilityImmediate(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
isVotingEnabled = preferences.getBoolean(PREFERENCES_KEY_VOTING_ENABLED, isVotingEnabled);
|
isVotingEnabled = preferences.getBoolean(PREFERENCES_KEY_VOTING_ENABLED, isVotingEnabled);
|
||||||
if (!isVotingEnabled)
|
VotingButton.changeVisibilityImmediate(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);
|
||||||
|
|
|
@ -296,7 +296,7 @@ public abstract class SponsorBlockUtils {
|
||||||
|
|
||||||
public static void showShieldButton() {
|
public static void showShieldButton() {
|
||||||
View i = ShieldButton._shieldBtn.get();
|
View i = ShieldButton._shieldBtn.get();
|
||||||
if (i == null) return;
|
if (i == null || i.isShown() || !ShieldButton.shouldBeShown()) return;
|
||||||
i.setVisibility(VISIBLE);
|
i.setVisibility(VISIBLE);
|
||||||
i.bringToFront();
|
i.bringToFront();
|
||||||
i.requestLayout();
|
i.requestLayout();
|
||||||
|
@ -311,7 +311,7 @@ public abstract class SponsorBlockUtils {
|
||||||
|
|
||||||
public static void showVoteButton() {
|
public static void showVoteButton() {
|
||||||
View i = VotingButton._votingButton.get();
|
View i = VotingButton._votingButton.get();
|
||||||
if (i == null) return;
|
if (i == null || i.isShown() || !VotingButton.shouldBeShown()) return;
|
||||||
i.setVisibility(VISIBLE);
|
i.setVisibility(VISIBLE);
|
||||||
i.bringToFront();
|
i.bringToFront();
|
||||||
i.requestLayout();
|
i.requestLayout();
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class VotingButton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean shouldBeShown() {
|
static boolean shouldBeShown() {
|
||||||
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
return SponsorBlockSettings.isVotingEnabled && SponsorBlockSettings.isSponsorBlockEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue