mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-02-09 02:26:48 +01:00
Merge pull request #31 from caneleex/patch/buttons-behavior
fix a lot of unintended button behaviors
This commit is contained in:
commit
0797155a25
@ -272,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)
|
||||
*/
|
||||
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) {
|
||||
lastKnownVideoTime = millis;
|
||||
VideoInformation.lastKnownVideoTime = lastKnownVideoTime;
|
||||
|
@ -103,7 +103,7 @@ public class ShieldButton {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldBeShown() {
|
||||
static boolean shouldBeShown() {
|
||||
return SponsorBlockSettings.isSponsorBlockEnabled && SponsorBlockSettings.isAddNewSegmentEnabled;
|
||||
}
|
||||
|
||||
|
@ -84,13 +84,14 @@ public class SponsorBlockSettings {
|
||||
SkipSegmentView.hide();
|
||||
NewSegmentHelperLayout.hide();
|
||||
SponsorBlockUtils.hideShieldButton();
|
||||
SponsorBlockUtils.hideVoteButton();
|
||||
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();
|
||||
} else {
|
||||
|
@ -296,7 +296,7 @@ public abstract class SponsorBlockUtils {
|
||||
|
||||
public static void showShieldButton() {
|
||||
View i = ShieldButton._shieldBtn.get();
|
||||
if (i == null) return;
|
||||
if (i == null || !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 || !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…
x
Reference in New Issue
Block a user